# HG changeset patch # User darius # Date 971350882 0 # Node ID b370e0bbe0507e3170e3cdfd1c6deea4ea93814e # Parent b6c495b5eeda56fbc04940b2d58dc504ecdaa72c Remove the check every second, since it breaks stuff :-/ diff -r b6c495b5eeda -r b370e0bbe050 mservtk.tcl --- a/mservtk.tcl Tue Oct 03 10:18:34 2000 +0000 +++ b/mservtk.tcl Thu Oct 12 11:41:22 2000 +0000 @@ -72,6 +72,7 @@ gui_updatesongs; gui_updatequeue; + gui_updateinfo; update_timer; while {1} { @@ -358,8 +359,8 @@ pack .top.tinfo.sub.title -side top -expand 0; label .top.tinfo.sub.length -text "Length:"; pack .top.tinfo.sub.length -side top -expand 0; - label .top.tinfo.sub.time -text "Time:"; - pack .top.tinfo.sub.time -side top -expand 0; +# label .top.tinfo.sub.time -text "Time:"; +# pack .top.tinfo.sub.time -side top -expand 0; label .top.tinfo.sub.album -text "Album:"; pack .top.tinfo.sub.album -side top -expand 0; label .top.tinfo.sub.misc -text "Misc:"; @@ -420,9 +421,11 @@ set tmp [lindex [lindex [array get songs *:listid:$id] 1] 0]; log "%s" "Queue - '$songs($tmp:name)' by '$songs($tmp:author)' ($tmp)"; + set cookie [acquire_lock]; n_write "QUEUE [split $tmp {:}]"; n_getrtn rtn; - + release_lock $cookie; + if {$rtn(code) != 247} { if {$rtn(code) == 510} { msg_box "Queue" "You can't have the same\nsong in the queue twice!"; @@ -522,7 +525,7 @@ n_getrtn rtn; release_lock $cookie; - log "%s" "Control Got $rtn(code) $rtn(data)"; +# log "%s" "Control Got $rtn(code) $rtn(data)"; } proc gui_top {} { @@ -589,7 +592,7 @@ proc gui_updatequeue {} { global state songs queue; - log "%s" "Updating queue"; +# log "%s" "Updating queue"; .bot.queue.list delete 0 end; @@ -665,25 +668,15 @@ release_lock $cookie; if {$rtn(code) != 222} { - set left "x:xx"; set played "x:xx"; } else { set played [lindex [split [lindex $rtn(lines) 0] "\t"] 8]; - -# scan $played "%d:%d" played_m played_s; -# set played [expr ($played_m * 60) + $played_s]; -# scan $length "%d:%f" len_m len_s; -# set len [expr ($len_m * 60) + $len_s]; - -# set left [expr $len - $played]; -# set left_m [expr int($left / 60)]; -# set left [format "%02d:%02d" $left_m [expr int($left - ($left_m * 60))]]; } .top.tinfo.sub.author configure -text "Author: $author"; .top.tinfo.sub.title configure -text "Title: $title"; .top.tinfo.sub.length configure -text "Length: $length"; - .top.tinfo.sub.time configure -text "Time: $played"; +# .top.tinfo.sub.time configure -text "Time: $played"; .top.tinfo.sub.album configure -text "Album: $album"; .top.tinfo.sub.misc configure -text "Misc: $misc"; .top.tinfo.sub.rate1 configure -text "Rating: $rate1"; @@ -714,7 +707,7 @@ incr i; } } elseif {$rtn(code) == 404} { - log "%s" "Queue empty"; +# log "%s" "Queue empty"; } else { log "%s" "Failed to get queue ($rtn(code) $rtn(data))"; } @@ -789,8 +782,9 @@ proc update_timer {} { - gui_updateinfo; +# gui_updateinfo; + after 900 update_timer; } @@ -809,7 +803,7 @@ # Greeting from server n_getrtn rtn; - puts $rtn(data); + log "%s" $rtn(data); if {$rtn(code) != "200"} { error "Server failed to send greeting"; } @@ -853,7 +847,7 @@ proc n_rthandler {code data} { global songs; - log "%s" "Got RT - $code $data"; +# log "%s" "Got RT - $code $data"; switch -- $code { 600 { @@ -865,6 +859,8 @@ } 240 - + 602 - + 615 - 618 - 619 - 620 - @@ -873,7 +869,8 @@ 627 - 628 - 629 { - log "%s" "Updating queue on idle"; +# log "%s" "Updating queue on idle"; + gui_updateinfo; gui_updatequeue; } @@ -1046,6 +1043,7 @@ } if {[catch {main} msg]} { - catch {tk_dialog .dummy "Error!" $msg error 0 "OK"}; + catch {tk_dialog .dummy "Error!" [format "%s\n%s" $msg $errorInfo] error 0 "OK"}; + exit 1; }