(
&self,
options: QueryablePlaylist,
inclusive: bool,
conn: &mut PooledConnection<ConnectionManager<LoggingConnection<SqliteConnection>>>,
)
| 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, |
no test coverage detected