Skip to content

Commit

Permalink
#277 More playlist management updates
Browse files Browse the repository at this point in the history
* always update the client's playlist reference on `playlist save`
* remove playlist references from clients on `playlists delete`
  • Loading branch information
mherger committed Aug 2, 2020
1 parent 5eb4432 commit 4d757fe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Slim/Control/Commands.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,7 @@ sub playlistSaveCommand {

$request->addResult('__playlist_id', $playlistObj->id);

if ($client && $playlistObj->title ne Slim::Utils::Strings::string('UNTITLED')
&& (!$client->currentPlaylist || $playlistObj->id == $client->currentPlaylist->id)
) {
if ($client && $playlistObj->title ne Slim::Utils::Strings::string('UNTITLED')) {
$client->currentPlaylist($playlistObj);
$client->currentPlaylistUpdateTime(Time::HiRes::time());
$client->currentPlaylistModified(0);
Expand Down Expand Up @@ -2300,6 +2298,14 @@ sub playlistsDeleteCommand {
});
}

foreach my $client ( Slim::Player::Client::clients() ) {
if ($client->currentPlaylist && $client->currentPlaylist->id == $playlistObj->id) {
# must send defined, but falsy value
$client->currentPlaylist(0);
$client->currentPlaylistUpdateTime(Time::HiRes::time());
}
}

_wipePlaylist($playlistObj);

$request->setStatusDone();
Expand Down

0 comments on commit 4d757fe

Please sign in to comment.