3
set paths [split $env(PATH) ":"]
5
foreach path $paths { if {[file exist $path/xmms]} { set found 1 } }
7
if {[info exist found]} {
11
# Gets the current playing song.
13
set file "/tmp/xmms-info"
14
if {![file exist $file]} {return 0}
16
set gets [open $file r]
18
while {![eof $gets]} {
20
set pos [string first ":" $tmp]
21
set index [string map {" " "_"} [string range $tmp 0 $pos]]
22
set info($index) [string range $tmp [expr {$pos+2}] end]
28
switch -- $info(Status:) {
29
"Playing" { lappend return $info(Title:); lappend return $info(File:) }
30
"Paused" { lappend return $info(Title:); lappend return $info(File:) }
31
"Stopped" { set return 0 }
32
default { set return 0 }
35
status_log "Song is $return\n"
39
# Use this procedure to:
40
# - Display current song. (1)
41
# - Send current song. (2)
42
# - Change nick to $nick - song. (3)
43
proc xmms {win_name action} {
47
set song [lindex $info 0]
48
set file [lindex $info 1]
50
if {$info == "0"} { msg_box [trans xmmserr]; return 0 }
55
::amsn::MessageSend .${win_name} 0 "[trans playing $song]"
58
::amsn::FileTransferSend .${win_name} $file
62
# This stage should be improved, how should we do it?
63
# - Should it be a "custom state" where we can set the "songnick" ?
64
# - Should it set the nick to "$currentnick - $song" ? if so, we need to make a nick. cache.
65
# Can someone make the gui for this ? :)
67
set newnick [::config::getKey songnick]
68
if { $newnick == "" } {
69
# should this tell the user to set a nick? or shall it set the nick to the song??
70
::MSN::changeName [lindex $user_info 3] $song
72
# We must find a solution to remove the song if someone use this function twice!
73
::MSN::changeName [lindex $user_info 3] "$newnick - $song"