Skip to content

Commit

Permalink
"Remove and skip" song from playlist and just "Remove" from playlist #…
Browse files Browse the repository at this point in the history
  • Loading branch information
vdesabou committed Dec 4, 2022
1 parent d2ae4de commit 346788a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
25 changes: 22 additions & 3 deletions spotify-mini-player/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15137,7 +15137,7 @@ Example: https://open.spotify.com/track/6hxgHNJjadmCHAJPXw6AYL</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>skip_first_seconds_of_episode</string>
<string>skip_first_seconds_of_podcast</string>
</dict>
<dict>
<key>config</key>
Expand All @@ -15158,6 +15158,25 @@ Example: https://open.spotify.com/track/6hxgHNJjadmCHAJPXw6AYL</string>
<key>variable</key>
<string>previous_track_for_real</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<true/>
<key>required</key>
<false/>
<key>text</key>
<string></string>
</dict>
<key>description</key>
<string>When removing current track from library, skip to next track. Keep playing it otherwise</string>
<key>label</key>
<string>⏭️ Skip current track when removed</string>
<key>type</key>
<string>checkbox</string>
<key>variable</key>
<string>skip_current_track_when_removed</string>
</dict>
<dict>
<key>config</key>
<dict>
Expand All @@ -15169,7 +15188,7 @@ Example: https://open.spotify.com/track/6hxgHNJjadmCHAJPXw6AYL</string>
<string></string>
</dict>
<key>description</key>
<string></string>
<string>This will reduce a bit notifications</string>
<key>label</key>
<string>📵Reduce notifications</string>
<key>type</key>
Expand Down Expand Up @@ -17418,7 +17437,7 @@ Example: https://open.spotify.com/track/6hxgHNJjadmCHAJPXw6AYL</string>
<key>description</key>
<string>🚫Automatically set, do not modify !</string>
<key>label</key>
<string>🎙️Shows enabled</string>
<string>📻Podcasts enabled</string>
<key>type</key>
<string>checkbox</string>
<key>variable</key>
Expand Down
21 changes: 11 additions & 10 deletions spotify-mini-player/src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4198,19 +4198,20 @@ function removeTrackFromPlaylist($w, $track_uri, $playlist_uri, $playlist_name,

// https://github.com/vdesabou/alfred-spotify-mini-player/issues/522
// Automatically play next track when removing track from playlist
if ($output_application == 'MOPIDY') {
invokeMopidyMethod($w, 'core.playback.next', array());
} else if ($output_application == 'APPLESCRIPT') {
exec("osascript -e 'tell application \"Spotify\" to next track'");
} else {
$device_id = getSpotifyConnectCurrentDeviceId($w);
if ($device_id != '') {
nextTrackSpotifyConnect($w, $device_id);
if(getenv('skip_current_track_when_removed')) {
if ($output_application == 'MOPIDY') {
invokeMopidyMethod($w, 'core.playback.next', array());
} else if ($output_application == 'APPLESCRIPT') {
exec("osascript -e 'tell application \"Spotify\" to next track'");
} else {
displayNotificationWithArtwork($w, 'No Spotify Connect device is available', './images/warning.png', 'Error!');
$device_id = getSpotifyConnectCurrentDeviceId($w);
if ($device_id != '') {
nextTrackSpotifyConnect($w, $device_id);
} else {
displayNotificationWithArtwork($w, 'No Spotify Connect device is available', './images/warning.png', 'Error!');
}
}
}

if ($refreshLibrary) {
if(getenv('automatically_refresh_library') == 1) {
refreshLibrary($w);
Expand Down

0 comments on commit 346788a

Please sign in to comment.