Skip to content

Instantly share code, notes, and snippets.

@proprietary
Created March 8, 2018 22:55
Show Gist options
  • Save proprietary/4a0af151c98cb9520bf0580ab86081a5 to your computer and use it in GitHub Desktop.
Save proprietary/4a0af151c98cb9520bf0580ab86081a5 to your computer and use it in GitHub Desktop.
deletes currently playing song in Clementine (works on GNU/Linux)
#!/usr/bin/env bash
# Deletes currently playing song in Clementine (works on GNU/Linux). Helps thin out a music library.
# 1. chmod a+x rmcl
# 2. add to PATH
# 3. use in GNOME by Alt+F2 + 'rmcl', easy
function is_playing() {
qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player PlaybackStatus
}
function current_song() {
qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep -Po 'xesam:url: file:\/\/\K(.+)$'
}
function skip_song() {
qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 Pause
qdbus org.mpris.MediaPlayer2.clementine /org/mpris/MediaPlayer2 Next
}
file=$(current_song)
if [ -e "$file" ]
then
rm -f "$file"
if [ $(is_playing) == "Playing" ]
then
skip_song
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment