-
-
Save proprietary/4a0af151c98cb9520bf0580ab86081a5 to your computer and use it in GitHub Desktop.
deletes currently playing song in Clementine (works on GNU/Linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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