MCPcopy Create free account
hub / github.com/Moosync/Moosync / get_genre_songs

Method get_genre_songs

src-tauri/database/src/database.rs:615–641  ·  view source on GitHub ↗
(
        &self,
        options: QueryableGenre,
        inclusive: bool,
        conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
    )

Source from the content-addressed store, hash-verified

613
614 #[tracing::instrument(level = "debug", skip(self, conn))]
615 pub fn get_genre_songs(
616 &self,
617 options: QueryableGenre,
618 inclusive: bool,
619 conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
620 ) -> Result<Vec<QueryableSong>> {
621 trace!("Fetching genre songs");
622 let binding = self.get_genres(options, inclusive, conn)?;
623 let genre = binding.first();
624 if genre.is_none() {
625 return Ok(vec![]);
626 }
627
628 let genre = genre.unwrap();
629 let genre_data: Vec<AlbumBridge> = QueryDsl::filter(
630 genre_bridge,
631 schema::genre_bridge::genre.eq(genre.genre_id.clone()),
632 )
633 .load(conn)?;
634
635 let songs: Vec<QueryableSong> =
636 QueryDsl::filter(allsongs, _id.eq_any(genre_data.into_iter().map(|v| v.song)))
637 .load(conn)?;
638
639 info!("Fetched genre songs");
640 Ok(songs)
641 }
642
643 #[tracing::instrument(level = "debug", skip(self, conn))]
644 pub fn get_playlist_songs(

Callers 1

get_songs_by_optionsMethod · 0.80

Calls 4

get_genresMethod · 0.80
cloneMethod · 0.80
loadMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected