Correction de petits bugs d'interface
This commit is contained in:
@@ -40,6 +40,8 @@ impl ToDIDL for Album {
|
||||
searchable: Some("1".to_string()),
|
||||
title: self.formatted_title(),
|
||||
class: "object.container.album.musicAlbum".to_string(),
|
||||
artist: Some(self.artist.name.clone()),
|
||||
album_art: self.image_cached.clone().or_else(|| self.image.clone()),
|
||||
containers: Vec::new(),
|
||||
items: Vec::new(),
|
||||
})
|
||||
@@ -138,6 +140,8 @@ impl ToDIDL for Playlist {
|
||||
searchable: Some("1".to_string()),
|
||||
title: self.name.clone(),
|
||||
class: "object.container.playlistContainer".to_string(),
|
||||
album_art: self.image_cached.clone().or_else(|| self.image.clone()),
|
||||
artist: self.owner.as_ref().map(|o| o.name.clone()),
|
||||
containers: Vec::new(),
|
||||
items: Vec::new(),
|
||||
})
|
||||
|
||||
@@ -568,7 +568,8 @@ impl QobuzSource {
|
||||
for mut item in items {
|
||||
// Extraire cache_pk depuis l'URL du resource
|
||||
let cache_pk = if let Some(resource) = item.resources.first() {
|
||||
resource.url
|
||||
resource
|
||||
.url
|
||||
.strip_prefix("/audio/flac/")
|
||||
.map(|s| s.to_string())
|
||||
} else {
|
||||
@@ -577,7 +578,11 @@ impl QobuzSource {
|
||||
|
||||
if let Some(pk) = cache_pk {
|
||||
// Récupérer track_id depuis metadata
|
||||
if let Ok(Some(track_id_value)) = self.inner.cache_manager.get_audio_metadata(&pk, "qobuz_track_id") {
|
||||
if let Ok(Some(track_id_value)) = self
|
||||
.inner
|
||||
.cache_manager
|
||||
.get_audio_metadata(&pk, "qobuz_track_id")
|
||||
{
|
||||
if let Some(track_id) = track_id_value.as_str() {
|
||||
item.id = format!("qobuz:track:{}", track_id);
|
||||
} else {
|
||||
@@ -647,11 +652,7 @@ impl QobuzSource {
|
||||
|
||||
// 2. Cache cover
|
||||
let cover_pk = if let Some(ref image_url) = album.image {
|
||||
self.inner
|
||||
.cache_manager
|
||||
.cache_cover(image_url)
|
||||
.await
|
||||
.ok()
|
||||
self.inner.cache_manager.cache_cover(image_url).await.ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
@@ -685,6 +686,11 @@ impl QobuzSource {
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::PlaylistError(e.to_string()))?;
|
||||
|
||||
writer
|
||||
.set_artist(Some(album.artist.name.clone()))
|
||||
.await
|
||||
.map_err(|e| MusicSourceError::PlaylistError(e.to_string()))?;
|
||||
|
||||
if let Some(pk) = cover_pk {
|
||||
writer
|
||||
.set_cover_pk(Some(pk))
|
||||
@@ -731,6 +737,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Discover Catalog".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -746,6 +754,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Discover Genres".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -761,6 +771,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "My Music".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -776,6 +788,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Albums".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -791,6 +805,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Tracks".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -806,6 +822,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Artists".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -821,6 +839,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Playlists".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -892,6 +912,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: artist.name.clone(),
|
||||
class: "object.container".to_string(),
|
||||
artist: Some(artist.name.clone()),
|
||||
album_art: artist.image_cached.clone().or_else(|| artist.image.clone()),
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
})
|
||||
@@ -942,6 +964,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: tag.display_name().to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
});
|
||||
@@ -959,6 +983,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Playlists".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -973,6 +999,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Albums (Ideal Discography)".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -987,6 +1015,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Albums (Qobuzissime)".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1001,6 +1031,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Albums (New Releases)".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1015,6 +1047,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Artists".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1065,7 +1099,11 @@ impl QobuzSource {
|
||||
|
||||
let containers: Vec<Container> = albums
|
||||
.into_iter()
|
||||
.filter_map(|album| album.to_didl_container("qobuz:discover:albums:qobuzissime").ok())
|
||||
.filter_map(|album| {
|
||||
album
|
||||
.to_didl_container("qobuz:discover:albums:qobuzissime")
|
||||
.ok()
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(BrowseResult::Containers(containers))
|
||||
@@ -1107,6 +1145,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: artist.name.clone(),
|
||||
class: "object.container".to_string(),
|
||||
artist: Some(artist.name.clone()),
|
||||
album_art: artist.image_cached.clone().or_else(|| artist.image.clone()),
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
})
|
||||
@@ -1156,6 +1196,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: genre.name.clone(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
})
|
||||
@@ -1188,6 +1230,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "New Releases".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1202,6 +1246,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Ideal Discography".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1216,6 +1262,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Qobuzissime".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1230,6 +1278,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Editor Picks".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1244,6 +1294,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Press Awards".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1258,6 +1310,8 @@ impl QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Qobuz Playlists".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![],
|
||||
items: vec![],
|
||||
}
|
||||
@@ -1392,19 +1446,29 @@ impl QobuzSource {
|
||||
["qobuz", "discover"] => ObjectIdType::DiscoverCatalog,
|
||||
["qobuz", "discover", "playlists"] => ObjectIdType::DiscoverPlaylists,
|
||||
["qobuz", "discover", "albums", "ideal"] => ObjectIdType::DiscoverAlbumsIdeal,
|
||||
["qobuz", "discover", "albums", "qobuzissime"] => ObjectIdType::DiscoverAlbumsQobuzissime,
|
||||
["qobuz", "discover", "albums", "qobuzissime"] => {
|
||||
ObjectIdType::DiscoverAlbumsQobuzissime
|
||||
}
|
||||
["qobuz", "discover", "albums", "new"] => ObjectIdType::DiscoverAlbumsNew,
|
||||
["qobuz", "discover", "artists"] => ObjectIdType::DiscoverArtists,
|
||||
["qobuz", "discover", "playlists", tag] => ObjectIdType::DiscoverPlaylistsByTag(tag.to_string()),
|
||||
["qobuz", "discover", "playlists", tag] => {
|
||||
ObjectIdType::DiscoverPlaylistsByTag(tag.to_string())
|
||||
}
|
||||
|
||||
// Discover Genres
|
||||
["qobuz", "genres"] => ObjectIdType::DiscoverGenres,
|
||||
["qobuz", "genre", id] => ObjectIdType::GenreRoot(id.to_string()),
|
||||
["qobuz", "genre", id, "new-releases"] => ObjectIdType::GenreNewReleases(id.to_string()),
|
||||
["qobuz", "genre", id, "new-releases"] => {
|
||||
ObjectIdType::GenreNewReleases(id.to_string())
|
||||
}
|
||||
["qobuz", "genre", id, "ideal"] => ObjectIdType::GenreIdealDiscography(id.to_string()),
|
||||
["qobuz", "genre", id, "qobuzissime"] => ObjectIdType::GenreQobuzissime(id.to_string()),
|
||||
["qobuz", "genre", id, "editor-picks"] => ObjectIdType::GenreEditorPicks(id.to_string()),
|
||||
["qobuz", "genre", id, "press-awards"] => ObjectIdType::GenrePressAwards(id.to_string()),
|
||||
["qobuz", "genre", id, "editor-picks"] => {
|
||||
ObjectIdType::GenreEditorPicks(id.to_string())
|
||||
}
|
||||
["qobuz", "genre", id, "press-awards"] => {
|
||||
ObjectIdType::GenrePressAwards(id.to_string())
|
||||
}
|
||||
["qobuz", "genre", id, "playlists"] => ObjectIdType::GenrePlaylists(id.to_string()),
|
||||
|
||||
// Favourites
|
||||
@@ -1440,13 +1504,13 @@ enum ObjectIdType {
|
||||
|
||||
// Discover Genres
|
||||
DiscoverGenres,
|
||||
GenreRoot(String), // genre_id
|
||||
GenreNewReleases(String), // genre_id
|
||||
GenreIdealDiscography(String), // genre_id
|
||||
GenreQobuzissime(String), // genre_id
|
||||
GenreEditorPicks(String), // genre_id
|
||||
GenrePressAwards(String), // genre_id
|
||||
GenrePlaylists(String), // genre_id
|
||||
GenreRoot(String), // genre_id
|
||||
GenreNewReleases(String), // genre_id
|
||||
GenreIdealDiscography(String), // genre_id
|
||||
GenreQobuzissime(String), // genre_id
|
||||
GenreEditorPicks(String), // genre_id
|
||||
GenrePressAwards(String), // genre_id
|
||||
GenrePlaylists(String), // genre_id
|
||||
|
||||
// Favourites
|
||||
Favourites,
|
||||
@@ -1488,6 +1552,8 @@ impl MusicSource for QobuzSource {
|
||||
searchable: Some("1".to_string()),
|
||||
title: "Qobuz".to_string(),
|
||||
class: "object.container".to_string(),
|
||||
artist: None,
|
||||
album_art: None,
|
||||
containers: vec![
|
||||
self.build_discover_catalog_container(),
|
||||
self.build_discover_genres_container(),
|
||||
@@ -1509,16 +1575,22 @@ impl MusicSource for QobuzSource {
|
||||
ObjectIdType::DiscoverCatalog => self.browse_discover_catalog().await,
|
||||
ObjectIdType::DiscoverPlaylists => self.browse_discover_playlists().await,
|
||||
ObjectIdType::DiscoverAlbumsIdeal => self.browse_discover_albums_ideal().await,
|
||||
ObjectIdType::DiscoverAlbumsQobuzissime => self.browse_discover_albums_qobuzissime().await,
|
||||
ObjectIdType::DiscoverAlbumsQobuzissime => {
|
||||
self.browse_discover_albums_qobuzissime().await
|
||||
}
|
||||
ObjectIdType::DiscoverAlbumsNew => self.browse_discover_albums_new().await,
|
||||
ObjectIdType::DiscoverArtists => self.browse_discover_artists().await,
|
||||
ObjectIdType::DiscoverPlaylistsByTag(tag) => self.browse_discover_playlists_tag(&tag).await,
|
||||
ObjectIdType::DiscoverPlaylistsByTag(tag) => {
|
||||
self.browse_discover_playlists_tag(&tag).await
|
||||
}
|
||||
|
||||
// Discover Genres
|
||||
ObjectIdType::DiscoverGenres => self.browse_discover_genres().await,
|
||||
ObjectIdType::GenreRoot(id) => self.browse_genre(&id).await,
|
||||
ObjectIdType::GenreNewReleases(id) => self.browse_genre_new_releases(&id).await,
|
||||
ObjectIdType::GenreIdealDiscography(id) => self.browse_genre_ideal_discography(&id).await,
|
||||
ObjectIdType::GenreIdealDiscography(id) => {
|
||||
self.browse_genre_ideal_discography(&id).await
|
||||
}
|
||||
ObjectIdType::GenreQobuzissime(id) => self.browse_genre_qobuzissime(&id).await,
|
||||
ObjectIdType::GenreEditorPicks(id) => self.browse_genre_editor_picks(&id).await,
|
||||
ObjectIdType::GenrePressAwards(id) => self.browse_genre_press_awards(&id).await,
|
||||
@@ -1952,11 +2024,7 @@ impl MusicSource for QobuzSource {
|
||||
.get_or_create_album_playlist_items(&album_id, usize::MAX)
|
||||
.await?;
|
||||
|
||||
let items: Vec<Item> = all_items
|
||||
.into_iter()
|
||||
.skip(offset)
|
||||
.take(limit)
|
||||
.collect();
|
||||
let items: Vec<Item> = all_items.into_iter().skip(offset).take(limit).collect();
|
||||
|
||||
Ok(BrowseResult::Items(items))
|
||||
}
|
||||
|
||||
2027
pmoqobuz/src/source.rs.bak
Normal file
2027
pmoqobuz/src/source.rs.bak
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user