Repository: aome510/spotify-player (language: rust)

Issue:
Artist's albums of the same year disappear
**Describe the bug**
In the Album pane of the artist page albums that have the same year (and possibly same year) show only once. 

**To Reproduce**
For example, I encountered this looking for Audioslave's Revelations album. It seems to show up on the artist page, but selecting that album refers to an album dated 2006-09-01 with just a single track. I suppose this an EP.

Searching for Revelations does yield the full album and I can open it from there. It is of the same year, but a different day: 2006-08-29. See also the images below.

**Expected behaviour**
Both albums should show. Ideally they have an indicator how they're different, but as a first step simply having both would already be great.

**Screenshots**

Overview with just one album:
![screenshot_2024-06-12-172612](https://github.com/aome510/spotify-player/assets/677296/e587ba02-515b-4d35-ae28-3b1fcaff0add)

The selected album just has one track. Album date: 2006-09-01
![screenshot_2024-06-12-172620](https://github.com/aome510/spotify-player/assets/677296/72e97284-2b51-4ad3-92a8-32512c71c0dd)

Album with the same artist, name & year, but different month and day: 2006-08-29. This can be accessed through search.
![screenshot_2024-06-12-172557](https://github.com/aome510/spotify-player/assets/677296/a0b66f8a-c788-4abc-aa9d-d2a27aa13b0b)


**Environment**

- OS: Linux - Debian testing (Trixie)
- Application version:  0.18.2 (installed through cargo)
- Application features: `cargo install spotify_player --no-default-features --features pulseaudio-backend,streaming,notify,media-control,sixel`
![screenshot_2024-06-12-172620](https://github.com/aome510/spotify-player/assets/677296/72e97284-2b51-4ad3-92a8-32512c71c0dd)
![screenshot_2024-06-12-172612](https://github.com/aome510/spotify-player/assets/677296/e587ba02-515b-4d35-ae28-3b1fcaff0add)
![screenshot_2024-06-12-172557](https://github.com/aome510/spotify-player/assets/677296/a0b66f8a-c788-4abc-aa9d-d2a27aa13b0b)


Artist's albums of the same year disappear
**Describe the bug**
In the Album pane of the artist page albums that have the same year (and possibly same year) show only once. 

**To Reproduce**
For example, I encountered this looking for Audioslave's Revelations album. It seems to show up on the artist page, but selecting that album refers to an album dated 2006-09-01 with just a single track. I suppose this an EP.

Searching for Revelations does yield the full album and I can open it from there. It is of the same year, but a different day: 2006-08-29. See also the images below.

**Expected behaviour**
Both albums should show. Ideally they have an indicator how they're different, but as a first step simply having both would already be great.

**Screenshots**

Overview with just one album:
![screenshot_2024-06-12-172612](https://github.com/aome510/spotify-player/assets/677296/e587ba02-515b-4d35-ae28-3b1fcaff0add)

The selected album just has one track. Album date: 2006-09-01
![screenshot_2024-06-12-172620](https://github.com/aome510/spotify-player/assets/677296/72e97284-2b51-4ad3-92a8-32512c71c0dd)

Album with the same artist, name & year, but different month and day: 2006-08-29. This can be accessed through search.
![screenshot_2024-06-12-172557](https://github.com/aome510/spotify-player/assets/677296/a0b66f8a-c788-4abc-aa9d-d2a27aa13b0b)


**Environment**

- OS: Linux - Debian testing (Trixie)
- Application version:  0.18.2 (installed through cargo)
- Application features: `cargo install spotify_player --no-default-features --features pulseaudio-backend,streaming,notify,media-control,sixel`
![screenshot_2024-06-12-172620](https://github.com/aome510/spotify-player/assets/677296/72e97284-2b51-4ad3-92a8-32512c71c0dd)
![screenshot_2024-06-12-172612](https://github.com/aome510/spotify-player/assets/677296/e587ba02-515b-4d35-ae28-3b1fcaff0add)
![screenshot_2024-06-12-172557](https://github.com/aome510/spotify-player/assets/677296/a0b66f8a-c788-4abc-aa9d-d2a27aa13b0b)




Discussion / hints:

Fix patch:
diff --git a/spotify_player/src/client/mod.rs b/spotify_player/src/client/mod.rs
index 757f010a..96c89e1b 100644
--- a/spotify_player/src/client/mod.rs
+++ b/spotify_player/src/client/mod.rs
@@ -1538,21 +1538,13 @@ impl Client {
 
     /// Process a list of albums, which includes
     /// - sort albums by the release date
-    /// - remove albums with duplicated names
     fn process_artist_albums(&self, albums: Vec<Album>) -> Vec<Album> {
         let mut albums = albums.into_iter().collect::<Vec<_>>();
 
         albums.sort_by(|x, y| x.release_date.partial_cmp(&y.release_date).unwrap());
 
-        // use a HashSet to keep track albums with the same name
-        let mut seen_names = std::collections::HashSet::new();
+        albums.reverse();
 
-        albums.into_iter().rfold(vec![], |mut acc, a| {
-            if !seen_names.contains(&a.name) {
-                seen_names.insert(a.name.clone());
-                acc.push(a);
-            }
-            acc
-        })
+        albums
     }
 }
diff --git a/spotify_player/src/ui/page.rs b/spotify_player/src/ui/page.rs
index 25a57e80..25e4331e 100644
--- a/spotify_player/src/ui/page.rs
+++ b/spotify_player/src/ui/page.rs
@@ -728,7 +728,7 @@ fn render_artist_context_page_windows(
     let (album_list, n_albums) = {
         let album_items = albums
             .into_iter()
-            .map(|a| (format!("{1} • {0}", a.name, a.year()), false))
+            .map(|a| (format!("{1} • {0}", a.name, a.release_date), false))
             .collect::<Vec<_>>();
 
         utils::construct_list_widget(


Test patch: