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

Method get_artist_songs

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

Source from the content-addressed store, hash-verified

582
583 #[tracing::instrument(level = "debug", skip(self, conn))]
584 pub fn get_artist_songs(
585 &self,
586 options: QueryableArtist,
587 inclusive: bool,
588 conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
589 ) -> Result<Vec<QueryableSong>> {
590 trace!("Fetching artist songs");
591 let binding = self.get_artists(options, inclusive, conn)?;
592 let artist = binding.first();
593 if artist.is_none() {
594 return Ok(vec![]);
595 }
596
597 let artist = artist.unwrap();
598 let artist_data: Vec<AlbumBridge> = QueryDsl::filter(
599 artist_bridge,
600 schema::artist_bridge::artist.eq(artist.artist_id.clone()),
601 )
602 .load(conn)?;
603
604 let songs: Vec<QueryableSong> = QueryDsl::filter(
605 allsongs,
606 _id.eq_any(artist_data.into_iter().map(|v| v.song)),
607 )
608 .load(conn)?;
609 info!("Fetched artist songs");
610
611 Ok(songs)
612 }
613
614 #[tracing::instrument(level = "debug", skip(self, conn))]
615 pub fn get_genre_songs(

Callers 1

get_songs_by_optionsMethod · 0.80

Calls 4

get_artistsMethod · 0.80
cloneMethod · 0.80
loadMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected