diff -u music-old/infoamarok music/infoamarok --- music-old/infoamarok 2007-10-28 01:21:52.000000000 +1000 +++ music/infoamarok 2008-02-09 13:25:35.000000000 +1100 @@ -11,6 +11,7 @@ dcop amarok player artist dcop amarok player encodedURL dcop amarok player coverImage + dcop amarok player album else #No so we set to state stopped echo 0 Only in music: infoamarok~ Common subdirectories: music-old/lang and music/lang diff -u music-old/music.tcl music/music.tcl --- music-old/music.tcl 2007-12-24 19:36:53.000000000 +1100 +++ music/music.tcl 2008-02-09 13:29:12.000000000 +1100 @@ -206,7 +206,7 @@ activated {1} \ display {1} \ songart {1} \ - separator {-} \ + display_style {%title - %artist} \ changepic {0} \ mpd_ip {127.0.0.1} \ mpd_port {6600} \ @@ -283,8 +283,10 @@ set info [::music::GetSong] set song [lindex $info 0] - set file [lindex $info 1] - set artfile [lindex $info 2] + set artist [lindex $info 1] + set file [lindex $info 2] + set artfile [lindex $info 3] + set album [lindex $info 4] #First add the nickname the user choosed in config to the name variable set name "$config(nickname)" @@ -308,9 +310,12 @@ #Change the nickname if the user did'nt uncheck that config. if {$config(display) && ![string equal $info $oldinfo] } { - if {[::config::getKey protocol] == 11} { + if {[::config::getKey protocol] >= 11} { if { $song != "0"} { - ::MSN::changeCurrentMedia Music 1 "{0}" $song + # Convert our formatting string into the .NET-format one. + set style [string map {"%title" "{0}" "%artist" "{1}" "%album" "{2}"} $config(display_style)] + #::music::log $style + ::MSN::changeCurrentMedia Music 1 $style $song $artist $album } else { ::MSN::changeCurrentMedia Music 0 "{0}" "" } @@ -561,7 +566,7 @@ #If we are online, start the loop if {[::MSN::myStatusIs] != "FLN" } { if { $::music::config(display) } { - if {[::config::getKey protocol] == 11} { + if {[::config::getKey protocol] >= 11} { ::MSN::changeCurrentMedia Music 0 "{0}" "" } else { set nick [::abook::getPersonal MFN] @@ -600,7 +605,7 @@ #Remove the song from the nick if we are online if {[::MSN::myStatusIs] != "FLN" && $::music::config(activated) } { - if {[::config::getKey protocol] == 11} { + if {[::config::getKey protocol] >= 11} { ::MSN::changeCurrentMedia Music 0 "{0}" "" } else { ::music::changenick "$config(oldnickname)" @@ -742,19 +747,10 @@ #order for song and artist name frame $mainFrame.order -class degt pack $mainFrame.order -anchor w -expand true -fill both - label $mainFrame.order.label -text "[trans choose_order]" -padx 5 -font sboldf - radiobutton $mainFrame.order.1 -text "[trans songartist]" -variable ::music::config(songart) -value 1 - radiobutton $mainFrame.order.2 -text "[trans artistsong]" -variable ::music::config(songart) -value 2 - radiobutton $mainFrame.order.3 -text "[trans song]" -variable ::music::config(songart) -value 3 - label $mainFrame.order.separator_label -text "[trans separator]" -padx 5 -font sboldf - entry $mainFrame.order.separator_entry -bg #ffffff -width 10 -textvariable ::music::config(separator) - pack $mainFrame.order.label \ - $mainFrame.order.1 \ - $mainFrame.order.2 \ - $mainFrame.order.3 \ - -anchor w -side top - pack $mainFrame.order.separator_label \ - $mainFrame.order.separator_entry \ + label $mainFrame.order.style_label -text "[trans style]" -padx 5 -font sboldf + entry $mainFrame.order.style_entry -bg #ffffff -width 20 -textvariable ::music::config(display_style) + pack $mainFrame.order.style_label \ + $mainFrame.order.style_entry \ -anchor w -side left #changepic @@ -773,19 +769,10 @@ #order for song and artist name frame $mainFrame.order -class degt pack $mainFrame.order -anchor w -expand true -fill both - label $mainFrame.order.label -text "[trans choose_order]" -padx 5 -font sboldf - radiobutton $mainFrame.order.1 -text "[trans songartist]" -variable ::music::config(songart) -value 1 - radiobutton $mainFrame.order.2 -text "[trans artistsong]" -variable ::music::config(songart) -value 2 - radiobutton $mainFrame.order.3 -text "[trans song]" -variable ::music::config(songart) -value 3 - label $mainFrame.order.separator_label -text "[trans separator]" -padx 5 -font sboldf - entry $mainFrame.order.separator_entry -bg #ffffff -width 10 -textvariable ::music::config(separator) - pack $mainFrame.order.label \ - $mainFrame.order.1 \ - $mainFrame.order.2 \ - $mainFrame.order.3 \ - -anchor w -side top - pack $mainFrame.order.separator_label \ - $mainFrame.order.separator_entry \ + label $mainFrame.order.style_label -text "[trans style]" -padx 5 -font sboldf + entry $mainFrame.order.style_entry -bg #ffffff -width 20 -textvariable ::music::config(display_style) + pack $mainFrame.order.style_label \ + $mainFrame.order.style_entry \ -anchor w -side left } @@ -807,19 +794,10 @@ #order for song and artist name frame $mainFrame.order -class degt pack $mainFrame.order -anchor w -expand true -fill both - label $mainFrame.order.label -text "[trans choose_order]" -padx 5 -font sboldf - radiobutton $mainFrame.order.1 -text "[trans songartist]" -variable ::music::config(songart) -value 1 - radiobutton $mainFrame.order.2 -text "[trans artistsong]" -variable ::music::config(songart) -value 2 - radiobutton $mainFrame.order.3 -text "[trans song]" -variable ::music::config(songart) -value 3 - label $mainFrame.order.separator_label -text "[trans separator]" -padx 5 -font sboldf - entry $mainFrame.order.separator_entry -bg #ffffff -width 10 -textvariable ::music::config(separator) - pack $mainFrame.order.label \ - $mainFrame.order.1 \ - $mainFrame.order.2 \ - $mainFrame.order.3 \ - -anchor w -side top - pack $mainFrame.order.separator_label \ - $mainFrame.order.separator_entry \ + label $mainFrame.order.style_label -text "[trans style]" -padx 5 -font sboldf + entry $mainFrame.order.style_entry -bg #ffffff -width 20 -textvariable ::music::config(display_style) + pack $mainFrame.order.style_label \ + $mainFrame.order.style_entry \ -anchor w -side left #ip @@ -874,37 +852,27 @@ return 0 } - #Get the 4 first lines + #Get the information set status [lindex $tmplst 0] set song [lindex $tmplst 1] set art [lindex $tmplst 2] set path [lindex $tmplst 3] set artpath [lindex $tmplst 4] + set album [lindex $tmplst 5] if {[string first "nocover" [file tail $artpath]] != -1} { set artpath "" } - if {$status == "0"} { return 0 + } + + if { ![string compare -nocase [string range $path 0 4] "file:"] } { + set path [urldecode [string range $path 7 end]] } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - if { ![string compare -nocase [string range $path 0 4] "file:"] } { - lappend return [urldecode [string range $path 7 end]] - } else { - lappend return "" - } - lappend return $artpath + set path "" } - return $return + + return [list $song $art $path $artpath $album] } ############################################### @@ -938,22 +906,13 @@ if {$status == "0" || $status == "stopped"} { return 0 - } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - if { [file exists $path] } { - lappend return $path - } } - return $return + + if { ![file exists $path] } { + set path "" + } + + return [list $song $art $path "" ""] } ############################################### @@ -983,30 +942,14 @@ return 0 } - append Title [lindex $tmplst 1] append Artist [lindex $tmplst 2] append Uri [lindex $tmplst 3] append CoverUri [lindex $tmplst 4] - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $Title " " $::music::config(separator) " " $Artist - } elseif {$::music::config(songart) == 2} { - append songart $Artist " " $::music::config(separator) " " $Title - } elseif {$::music::config(songart) == 3} { - append songart $Title - } - - #First element in the returned list is the artist + song in desired format - lappend return $songart - #Second element is the path to the music-file - lappend return [urldecode [string range $Uri 7 end]] - #Third element is the path to the album cover-art (if available, else it is "") - lappend return $CoverUri + set Uri [urldecode [string range $Uri 7 end]] - return $return + return [list $Title $Artist $Uri $CoverUri ""] } ########################################################### @@ -1043,11 +986,12 @@ append songart "Paused" } - append newPath "file://" $path ; - lappend return $songart - lappend return [urldecode [string range $newPath 5 end]] + # !!! Was this unneeded in the first place? + #append newPath "file://" $path ; + #lappend return [urldecode [string range $newPath 5 end]] - return $return + # !!! This is bad. + return [list $songart "" $path "" ""] } ############################################### @@ -1086,21 +1030,9 @@ if {$status != "playing"} { return 0 - } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - lappend return [urldecode [string range $path 5 end]] - - return $return } + + return [list $song $art $path "" ""] } ############################################### @@ -1129,18 +1061,7 @@ set Title "" set Artist "" if {[regexp {(.*) \- \(.* \- (.*)\)} $::music::actualsong -> Title Artist]} { - #Define in which order we want to show the song (from the config) - #Use the separator(from the conf) between song and artist - if {$::music::config(songart) == 1} { - append songart $Title " " $::music::config(separator) " " $Artist - } elseif {$::music::config(songart) == 2} { - append songart $Artist " " $::music::config(separator) " " $Title - } elseif {$::music::config(songart) == 3} { - append songart $Title - } - #First element in the returned list is the artist + song in desired format - lappend return $songart - return $return + return [list $Title $Artist "" "" ""] } return 0 } @@ -1248,21 +1169,8 @@ return 0 } } - #Define in which order we want to show the song (from the config) - #Use the separator(from the conf) between song and artist - if {$::music::config(songart) == 1} { - append songart $Title " " $::music::config(separator) " " $Artist - } elseif {$::music::config(songart) == 2} { - append songart $Artist " " $::music::config(separator) " " $Title - } elseif {$::music::config(songart) == 3} { - append songart $Title - } - #First element in the returned list is the artist + song in desired format - lappend return $songart - #Second element is the path to the music-file - #lappend return [file join $::music::config(mpd_music_directory) $File] - #Third element is the path to the album cover-art (if available, else it is "") - #lappend return $CoverUri + + return [list $Title $Artist "" "" ""] close $chan return $return @@ -1308,23 +1216,8 @@ if {$Title == "" && $File != ""} { set Title [getfilename $File] } - #Define in which order we want to show the song (from the config) - #Use the separator(from the conf) between song and artist - if {$::music::config(songart) == 1} { - append songart $Title " " $::music::config(separator) " " $Artist - } elseif {$::music::config(songart) == 2} { - append songart $Artist " " $::music::config(separator) " " $Title - } elseif {$::music::config(songart) == 3} { - append songart $Title - } - #First element in the returned list is the artist + song in desired format - lappend return $songart - #Second element is the path to the music-file - lappend return $File - #Third element is the path to the album cover-art (if available, else it is "") - #lappend return $CoverUri - return $return + return [list $Title $Artist $File "" ""] } else { return 0 } @@ -1369,23 +1262,14 @@ set path [lindex $tmplst 2] set songlength [lindex $tmplst 3] } + if {$songlength == "-1"} { return 0 - } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - lappend return [urldecode [string range $path 5 end]] } - - return $return + + set path [urldecode [string range $path 5 end]] + + return [list $song $art $path "" ""] } ############################################### @@ -1471,22 +1355,9 @@ if {$status == "0"} { ::music::log "Status is 0" return 0 - } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - lappend return $path - lappend return $artfile } - return $return - + + return [list $song $art $path $artfile ""] } @@ -1507,20 +1378,9 @@ if {$status == "0"} { return 0 - } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - lappend return $path } - return $return + + return [list $song $art $path "" ""] } ############################################### @@ -1540,18 +1400,8 @@ if { [string compare -nocase $type "Music"] || ($art == "" && $song == "") } { return 0 - } else { - #Define in which order we want to show the song (from the config) - #Use the separator(from the cong) betwen song and artist - if {$::music::config(songart) == 1} { - append songart $song " " $::music::config(separator) " " $art - } elseif {$::music::config(songart) == 2} { - append songart $art " " $::music::config(separator) " " $song - } elseif {$::music::config(songart) == 3} { - append songart $song - } - lappend return $songart - return $return } + + return [list $song $art "" "" ""] } } Only in music: music.tcl~ Common subdirectories: music-old/MusicWA and music/MusicWA Common subdirectories: music-old/pixmaps and music/pixmaps Common subdirectories: music-old/.svn and music/.svn