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

Method get_playlist_songs

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

Source from the content-addressed store, hash-verified

642
643 #[tracing::instrument(level = "debug", skip(self, conn))]
644 pub fn get_playlist_songs(
645 &self,
646 options: QueryablePlaylist,
647 inclusive: bool,
648 conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
649 ) -> Result<Vec<QueryableSong>> {
650 let binding = self.get_playlists(options, inclusive, conn)?;
651 trace!("Fetching playlist songs");
652 let playlist = binding.first();
653 if playlist.is_none() {
654 return Ok(vec![]);
655 }
656
657 let playlist = playlist.unwrap();
658 let playlist_data: Vec<AlbumBridge> = QueryDsl::filter(
659 playlist_bridge,
660 schema::playlist_bridge::playlist.eq(playlist.playlist_id.clone()),
661 )
662 .load(conn)?;
663
664 let songs: Vec<QueryableSong> = QueryDsl::filter(
665 allsongs,
666 _id.eq_any(playlist_data.into_iter().map(|v| v.song)),
667 )
668 .load(conn)?;
669 info!("Fetched playlist songs");
670
671 Ok(songs)
672 }
673
674 fn get_song_from_queryable(
675 &self,

Callers 1

get_songs_by_optionsMethod · 0.80

Calls 4

get_playlistsMethod · 0.80
cloneMethod · 0.80
loadMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected