Skip to content

Instantly share code, notes, and snippets.

@abdulsattar
Created January 22, 2014 21:43
Show Gist options
  • Save abdulsattar/8567944 to your computer and use it in GitHub Desktop.
Save abdulsattar/8567944 to your computer and use it in GitHub Desktop.
Delete the currently playing song in Rhythmbox
require 'dbus'
require 'uri'
require 'shellwords'
bus = DBus::SessionBus.instance
service = bus.service('org.gnome.Rhythmbox3')
object = service.object("/org/mpris/MediaPlayer2")
object.introspect
interface = object['org.mpris.MediaPlayer2.Player']
metadata = interface['Metadata']
uri = metadata['xesam:url']
file = URI::decode(uri).gsub('file://','')
`trash #{file.shellescape}` if File.exists? file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment