class Anyplayer::Amarok

Public Instance Methods

album() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 44
def album
  amarok_get_meta "album"
end
artist() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 40
def artist
  amarok_get_meta "artist"
end
launched?() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 48
def launched?
  not %x(qdbus org.kde.amarok 2>&1).match(
    /does not exist|not found|cannot find the path specified/
  )
end
next() click to toggle source
Calls superclass method Anyplayer::Player#next
# File lib/anyplayer/players/amarok.rb, line 19
def next
  amarok "Next"
  super
end
pause() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 10
def pause
  amarok "Pause"
end
platforms() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 54
def platforms
  [:unix, :linux]
end
play() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 6
def play
  amarok "Play"
end
playpause() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 2
def playpause
  amarok "PlayPause"
end
prev() click to toggle source
Calls superclass method Anyplayer::Player#prev
# File lib/anyplayer/players/amarok.rb, line 14
def prev
  amarok "Prev"
  super
end
track() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 36
def track
  amarok_get_meta "title"
end
voldown() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 24
def voldown
  amarok "VolumeDown 5"
end
volume() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 32
def volume
  amarok "VolumeGet"
end
volup() click to toggle source
# File lib/anyplayer/players/amarok.rb, line 28
def volup
  amarok "VolumeUp 5"
end

Private Instance Methods

amarok(command) click to toggle source
# File lib/anyplayer/players/amarok.rb, line 60
def amarok(command)
  %x(qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.#{command}).rstrip
end
amarok_get_meta(name) click to toggle source
# File lib/anyplayer/players/amarok.rb, line 64
def amarok_get_meta(name)
  amarok("GetMetadata").match(/#{name}: (\S.*)/)[1] rescue nil
end