Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play button for album and playlist #561

Conversation

SarahRemus
Copy link

This PR fixes issue #493.

Implementation details:
I implemented a play button for albums and playlists, similar to the one in Spotify.
The button is shown in the header bar next to the starring button.
image

  • When the button is clicked, the first song of the playlist/ album is played. After that, the button icon changes to the 'pause-icon'.
  • If the playlist is paused and then the play button is clicked again, the currently playing track will be resumed.
  • If track T is part of playlist P and T is started from a different place, P will show the 'pause-icon' as a track of this playlist is currently playing
  • Shuffle is disabled, when playing a playlist/ album.

@xou816 xou816 force-pushed the play_button_for_album_and_playlist branch from 5331616 to 90e9a2a Compare February 12, 2023 21:58
Copy link
Owner

@xou816 xou816 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a somewhat late review if you're still around! thanks for the contribution :)

Comment on lines +267 to +298

fn autoscroll_to_playing(&self) -> bool {
true
}

fn is_selection_enabled(&self) -> bool {
self.selection()
.map(|s| s.is_selection_enabled())
.unwrap_or(false)
}

fn song_state(&self, id: &str) -> SongState {
let is_playing = self.current_song_id().map(|s| s.eq(id)).unwrap_or(false);
let is_selected = self
.selection()
.map(|s| s.is_song_selected(id))
.unwrap_or(false);
SongState {
is_selected,
is_playing,
}
}

fn toggle_select(&self, id: &str) {
if let Some(selection) = self.selection() {
if selection.is_song_selected(id) {
self.deselect_song(id);
} else {
self.select_song(id);
}
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think these are not need/already part of the trait?

Comment on lines +17 to +24
fn playlist_song_ids(&self) -> Option<Vec<String>> {
None
}

fn playlist_is_playing(&self) -> bool {
false
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get what you were trying to do -- but we don´t need these in the trait. code expecting a PlaylistModel will not need these methods

None
}

fn playlist_is_playing(&self) -> bool {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a simpler way to implement this logic : you can look in the PlaybackState for source, you might have to add an accessor there but thats fine :)

@@ -95,6 +95,19 @@
</child>
</object>
</child>
<child>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have some box around the buttons if we're goign to have more than one -- see how it looks on mobile

@SarahRemus
Copy link
Author

Thanks for your review! I currently have exams, but once they are done in a few weeks, I will come back to this project and implement your change requests on all my PR's :)

@xou816
Copy link
Owner

xou816 commented Feb 22, 2023

No worries at all, that gives me the time to go through the other PRs as well :)

@xou816
Copy link
Owner

xou816 commented Feb 26, 2023

(just a heads up, there'll probably be a couple of merge conflicts, and more coming up -- sorry for the inconvenience, feel free to reach out if needed)

@Zaedus
Copy link
Contributor

Zaedus commented Jun 2, 2023

I have some free time. If its alright @xou816 and @SarahRemus, could I try and take what I see here and create a new PR for the current development branch since this has gone a little inactive?

@xou816
Copy link
Owner

xou816 commented Jun 5, 2023

Sure yeah!

@michaelBelsanti
Copy link

I don't think shuffle should be disabled when playing a playlist. In the official Spotify client, if shuffle is enabled the playlist is started from a random song and shuffle stays on.

@Diegovsky
Copy link
Collaborator

Closing since this was superseeded by #662

@Diegovsky Diegovsky closed this Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants