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