#!/usr/bin/perl # ---------- announceroK ---------- # Version 0.2 # 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 IRC::print "\cC2\cBannounceroK has loaded successfully.\003"; IRC::print "\cC2/announcerok for list of commands."; Xchat::register("announceroK", "0.2","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"); 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"); } sub amarok { chomp($isplaying = `dcop --no-user-time amarok default isPlaying`); if($isplaying eq "true") { chomp($playing = `dcop amarok default nowPlaying`); # Displays "Artist - Title" 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($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 amarok`); # Displays amaroK version # Action announce, example "*User is doncing to Song Title by Song Artist (1:30/3:30)". Has colors. Xchat::command("me \cC14is doncing to\003 \cC13$title\003 \cC14by\003 \cC13$artist\003 \cC14($timenow/$timetotal)"); # Message announce, example " Now playing Song Title by Song Artist (1:30/3:30)". Has colors. #Xchat::command("say \cC14Now playing\003 \cC13$title\003 \cC14by\003 \cC13$artist\003 \cC14($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..."); }