#!/usr/bin/perl # ---------- announceroK ---------- # Version 0.3 # Created by Jen (jen@caffeinated-dreams.net) # ---------- Commands ---------- # /amarok .......... displays current track # /next .............. go to next track # /prev .............. go to previous track # /stop ............. stop amarok # /play ............. play track # /pause .......... pause track # /mute ........... mute song # ----------------------------------------- IRC::print "\cC2\cBannounceroK has loaded successfully.\003"; IRC::print "\cC2/announcerok for list of commands."; Xchat::register("announceroK", "0.3","Display what's on amaroK"); Xchat::hook_command("announcerok", "announcerok"); Xchat::hook_command("amarok", "amarok"); Xchat::hook_command("next", "amarok_next"); Xchat::hook_command("prev", "amarok_prev"); Xchat::hook_command("stop", "amarok_stop"); Xchat::hook_command("play", "amarok_play"); Xchat::hook_command("pause", "amarok_pause"); Xchat::hook_command("mute", "amarok_mute"); sub announcerok { IRC::print("\cC2\cBCommands are:"); IRC::print("\cC2/amarok\003 \cC14to display song"); IRC::print("\cC2/next\003 \cC14to go to next track"); IRC::print("\cC2/prev\003 \cC14to go to previous track"); IRC::print("\cC2/stop\003 \cC14to stop amarok"); IRC::print("\cC2/play \cC14to play track"); IRC::print("\cC2/pause \cC14to pause track (again to resume)"); IRC::print("\cC2/mute \cC14to mute song"); } sub amarok { chomp($isplaying = `dcop --no-user-time amarok default isPlaying`); if($isplaying eq "true") { #chomp($playing = `dcop amarok default nowPlaying`); # Displays "Artist - Title", this isn't being used right now... chomp($title = `dcop --no-user-time amarok default title`); # Displays song title chomp($artist = `dcop --no-user-time amarok default artist`); # Displays song artist chomp($album = `dcop --no-user-time amarok default album`); # Displays album if($album eq "") { $albumstr = "n/a"; } else { $albumstr = $album } chomp($timenow = `dcop --no-user-time amarok default currentTime`); # Displays current position in song in minutes chomp($timetotal =`dcop --no-user-time amarok default totalTime`); # Displays length of song in minutes chomp($version = `amarok -version | grep amaro`); # Displays amaroK version, this isn't being used right now... chomp($genre = `dcop --no-user-time amarok default genre`); # Displays genre if($genre eq "") { $genrestr = "n/a"; } else { $genrestr = $genre; } chomp($bitrate = `dcop --no-user-time amarok default bitrate`); # Displays bitrate # BLOATED Action announce! SLOW! Shows much useless crap (bitrate/genre/version)! #Xchat::command("me is listening to \0032$title\003 by \0032$artist\003 from the album \0032$albumstr\003. ($timenow/$timetotal) [] ($genrestr) ($bitrate) (\0032$version\003)"); # Normal Action announce. Xchat::command("me is listening to \0032$title\003 by \0032$artist\003 from the album \0032$albumstr\003. ($timenow/$timetotal)"); # Message announce. #Xchat::command("say Now playing \0032$title\003 by\003 \0032$artist\003 ($timenow/$timetotal)"); } else { IRC::print "\cC2\cBNo song is currently playing!\003"; } } sub amarok_next { $next = `dcop amarok default next`; IRC::print("\cC2Going to next track..."); } sub amarok_prev { $prev = `dcop amarok default prev`; IRC::print("\cC2Going to previous track..."); } sub amarok_stop { $stop = `dcop amarok default stop`; IRC::print("\cC2Stopping amaroK"); } sub amarok_play { $play = `dcop amarok default play`; IRC::print("\cC2Playing..."); } sub amarok_pause { $pause = `dcop amarok default pause`; IRC::print("\cC2Pausing..."); } sub amarok_mute { $mute = `dcop amarok default mute`; IRC::print("\cC2Muting..."); }