|
|
@ -26,6 +26,18 @@ package require Tk |
|
|
|
|
|
|
|
|
|
|
|
set music_directory "/mnt/DATA/Музыка/" |
|
|
|
set music_directory "/mnt/DATA/Музыка/" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc float2time {float} { |
|
|
|
|
|
|
|
set seconds [expr {int(fmod($float, 60))}] |
|
|
|
|
|
|
|
set minutes [expr {int($float / 60)}] |
|
|
|
|
|
|
|
set hours [expr {int($minutes / 60)}] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {$hours == 0} { |
|
|
|
|
|
|
|
format "%02d:%02d" $minutes $seconds |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
format "%02d:%02d:%02d" $hours $minutes $seconds |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
namespace eval mpd { |
|
|
|
namespace eval mpd { |
|
|
|
array set settings { |
|
|
|
array set settings { |
|
|
|
host 127.0.0.1 |
|
|
|
host 127.0.0.1 |
|
|
@ -43,6 +55,8 @@ namespace eval mpd { |
|
|
|
set mpd_status [lindex $mpd_answer 0] |
|
|
|
set mpd_status [lindex $mpd_answer 0] |
|
|
|
set answer_code [lindex $mpd_answer end-1] |
|
|
|
set answer_code [lindex $mpd_answer end-1] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close $mpd |
|
|
|
|
|
|
|
|
|
|
|
if {$answer_code == "OK"} { |
|
|
|
if {$answer_code == "OK"} { |
|
|
|
if {![string match "ACK*" $answer_code]} { |
|
|
|
if {![string match "ACK*" $answer_code]} { |
|
|
|
return [lrange $mpd_answer 1 end-2] |
|
|
|
return [lrange $mpd_answer 1 end-2] |
|
|
@ -65,17 +79,26 @@ namespace eval mpd { |
|
|
|
set song([string tolower $key]) $value |
|
|
|
set song([string tolower $key]) $value |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if {$song(state) != "stop"} { |
|
|
|
# parray song |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {[info exists song(id)]} { |
|
|
|
if {[info exists song(comment)]} { |
|
|
|
if {[info exists song(comment)]} { |
|
|
|
::gui::hl_rating $song(comment) |
|
|
|
::gui::hl_rating $song(comment) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return [format "♫ %s/%s: %s - %s\n\[%s - %s\]\n~ %s ~\n\[%s\] repeat: %s random: %s single: %s consume: %s" \ |
|
|
|
set current_position [expr {round($song(elapsed)) * 30 / round($song(duration))}] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [format "♫ %s/%s: %s - %s\n\[%s - %s\]\n\ |
|
|
|
|
|
|
|
~ %s ~\n\n\[%s\] repeat: %s random: %s single: %s consume: %s\n\ |
|
|
|
|
|
|
|
\[%s\] %s/%s" \ |
|
|
|
[incr song(song)] $song(playlistlength) \ |
|
|
|
[incr song(song)] $song(playlistlength) \ |
|
|
|
$song(artist) $song(title) $song(date) \ |
|
|
|
$song(artist) $song(title) $song(date) \ |
|
|
|
$song(album) $song(genre) $song(state) \ |
|
|
|
$song(album) $song(genre) $song(state) \ |
|
|
|
[state $song(repeat)] [state $song(random)] \ |
|
|
|
[state $song(repeat)] [state $song(random)] \ |
|
|
|
[state $song(single)] [state $song(consume)]] |
|
|
|
[state $song(single)] [state $song(consume)] \ |
|
|
|
|
|
|
|
"[string repeat ━ $current_position]᚛[string repeat ─ [expr {30-$current_position}]]" \ |
|
|
|
|
|
|
|
[float2time $song(elapsed)] \ |
|
|
|
|
|
|
|
[float2time $song(duration)]] |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return "\[stopped\]" |
|
|
|
return "\[stopped\]" |
|
|
|
} |
|
|
|
} |
|
|
|