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

Method get_album_songs

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

Source from the content-addressed store, hash-verified

551
552 #[tracing::instrument(level = "debug", skip(self, conn))]
553 pub fn get_album_songs(
554 &self,
555 options: QueryableAlbum,
556 inclusive: bool,
557 conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
558 ) -> Result<Vec<QueryableSong>> {
559 trace!("Fetching album songs");
560 let binding = self.get_albums(options, inclusive, conn)?;
561 let album = binding.first();
562 if album.is_none() {
563 return Ok(vec![]);
564 }
565
566 let album = album.unwrap();
567 let album_data: Vec<AlbumBridge> = QueryDsl::filter(
568 album_bridge,
569 schema::album_bridge::album.eq(album.album_id.clone()),
570 )
571 .load(conn)?;
572
573 let songs: Vec<QueryableSong> = QueryDsl::filter(
574 allsongs,
575 _id.eq_any(album_data.iter().map(|v| v.song.clone())),
576 )
577 .load(conn)?;
578
579 info!("Fetched album songs");
580 Ok(songs)
581 }
582
583 #[tracing::instrument(level = "debug", skip(self, conn))]
584 pub fn get_artist_songs(

Callers 1

get_songs_by_optionsMethod · 0.80

Calls 4

get_albumsMethod · 0.80
cloneMethod · 0.80
loadMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected