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