Recycled-IRC
http://www.recycled-irc.net/forum/

[TCL-XChat-Linux] NowPlaying AmaroK
http://www.recycled-irc.net/forum/viewtopic.php?f=5&t=1160
Page 1 sur 1

Auteur:  Fl0w3D [ Mer Mars 12, 2008 9:47 pm ]
Sujet du message:  [TCL-XChat-Linux] NowPlaying AmaroK

Petit script pour dire aux gens qui s'en foutent ce qu'on écoute sur Amarok... fonctionne avec DCOP.

Utilisation :
/np

Code:
# XChat-AmaroK script by Fl0w3D - Source originale : SIYB
# Script sous licence GNU/GPL - Modifications et redistributions autorisées

##### Configuration

# L'alias pour appeler le script
set ::config(alias) "np"


#### Code

proc getsong {} {
   set ::info(nowplaying) [exec dcop amarok player nowPlaying]
   set ::info(artist)  [exec dcop amarok player artist]
   if {[exec dcop amarok player album] !=  ""} {
      set ::info(album)  04(14[exec dcop amarok player album]04)
   }
   if {[exec dcop amarok player album] ==  ""} {
      set ::info(album)  ""
   }
   set ::info(title)  [exec dcop amarok player title]
   set ::info(track)  [exec dcop amarok player track]
   set ::info(time) [exec dcop amarok player totalTime]
   set ::info(ctime) [exec dcop amarok player currentTime]
   set ::info(bitrate) [exec dcop amarok player bitrate]
   set ::info(path) [exec dcop amarok player path]
   set ::info(playCount) [exec dcop amarok player trackPlayCounter]
   set ::info(note) [exec dcop amarok player rating]

   # Vérification de l'état du lecteur
   if {$::info(nowplaying) ==  "call failed"} {
      print "Amarok n'est pas lancé.."
      return
   }

   ###  "Skins"

   set d(1) "$::info(artist) - $::info(title) $::info(album) \[$::info(ctime)/$::info(time)\] \[$::info(bitrate) kbps\]"
   set ::config(format) "$d(1)"
}

alias $config(alias) {
   getsong
   /say $::config(format)
   complete
}


Pour afficher le compteur d'écoute et/ou la note attribuée, ajoutez
Code:
 \[Écouté $::info(playCount) fois - Noté $::info(note)/10\]

dans la ligne commençant par set d(1), avant le dernier "

Page 1 sur 1 Heures au format UTC + 1 heure
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/