|
|
|
@ -23,6 +23,7 @@
@@ -23,6 +23,7 @@
|
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
package require Tk |
|
|
|
|
# package require Img |
|
|
|
|
|
|
|
|
|
set music_directory "/mnt/DATA/Музыка/" |
|
|
|
|
|
|
|
|
@ -73,17 +74,24 @@ namespace eval mpd {
@@ -73,17 +74,24 @@ namespace eval mpd {
|
|
|
|
|
set status [::mpd::cmd status] |
|
|
|
|
|
|
|
|
|
if {![string match "ERROR:*" $currentsong] && ![string match "ERROR:*" $status]} { |
|
|
|
|
array set song {} |
|
|
|
|
array set song { |
|
|
|
|
artist {} |
|
|
|
|
title {} |
|
|
|
|
date {} |
|
|
|
|
album {} |
|
|
|
|
genre {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach metadata [list {*}$currentsong {*}$status] { |
|
|
|
|
regexp -expanded {^([^:]+):\s+(.*)$} $metadata match key value |
|
|
|
|
set song([string tolower $key]) $value |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# parray song |
|
|
|
|
|
|
|
|
|
if {[info exists song(id)]} { |
|
|
|
|
if {[info exists song(comment)]} { |
|
|
|
|
::gui::hl_rating $song(comment) |
|
|
|
|
} else { |
|
|
|
|
::gui::hl_rating {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
set current_position [expr {round($song(elapsed)) * 30 / round($song(duration))}] |
|
|
|
@ -116,7 +124,7 @@ namespace eval mpd {
@@ -116,7 +124,7 @@ namespace eval mpd {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc current_file {} { |
|
|
|
|
set filename [file join $::music_directory [value [lindex [cmd currentsong] 0]]] |
|
|
|
|
file join $::music_directory [value [lindex [cmd currentsong] 0]] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
proc previous {} { cmd previous } |
|
|
|
@ -173,6 +181,17 @@ namespace eval gui {
@@ -173,6 +181,17 @@ namespace eval gui {
|
|
|
|
|
proc update_status {} { |
|
|
|
|
set ::mpd_status [::mpd::status] |
|
|
|
|
|
|
|
|
|
# set current_directory [file dirname [::mpd::current_file]] |
|
|
|
|
|
|
|
|
|
# set cover [lindex [glob -directory $current_directory "{cover,folder}.{png,jpg}"] 0] |
|
|
|
|
|
|
|
|
|
# if {[file exists $cover]} { |
|
|
|
|
# exec convert $cover -resize 210x210 -gravity center -extent 210x210 /tmp/mptk.png |
|
|
|
|
# image create photo cover -file /tmp/mptk.png -height 210 -width 210 |
|
|
|
|
# file delete /tmp/mptk.png |
|
|
|
|
# .status.cover configure -image cover |
|
|
|
|
# } |
|
|
|
|
|
|
|
|
|
after 1000 ::gui::update_status |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -181,7 +200,8 @@ namespace eval gui {
@@ -181,7 +200,8 @@ namespace eval gui {
|
|
|
|
|
frame .rating -pady 10 |
|
|
|
|
frame .control -pady 10 |
|
|
|
|
|
|
|
|
|
pack .status -fill x -expand true -padx 20 -pady 20 |
|
|
|
|
pack .status -expand true -padx 20 -pady 20 |
|
|
|
|
# pack [label .status.cover -borderwidth 10] -fill x -side left |
|
|
|
|
pack [label .status.current -font {Sans 20} -textvariable ::mpd_status] |
|
|
|
|
|
|
|
|
|
pack .rating |
|
|
|
@ -198,6 +218,12 @@ namespace eval gui {
@@ -198,6 +218,12 @@ namespace eval gui {
|
|
|
|
|
|
|
|
|
|
update_status |
|
|
|
|
|
|
|
|
|
bind . <KeyPress-1> {::mpd::rate 1} |
|
|
|
|
bind . <KeyPress-2> {::mpd::rate 2} |
|
|
|
|
bind . <KeyPress-3> {::mpd::rate 3} |
|
|
|
|
bind . <KeyPress-4> {::mpd::rate 4} |
|
|
|
|
bind . <KeyPress-5> {::mpd::rate 5} |
|
|
|
|
|
|
|
|
|
bind . <KeyPress-z> {::mpd::random} |
|
|
|
|
bind . <KeyPress-R> {::mpd::consume} |
|
|
|
|
|
|
|
|
@ -211,5 +237,11 @@ namespace eval gui {
@@ -211,5 +237,11 @@ namespace eval gui {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if {[auto_execok mid3v2] == {}} { |
|
|
|
|
puts "ERROR: mid3v2 executable not found. Please install it and run \`[file tail $argv0]\' again." |
|
|
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
gui::init |
|
|
|
|
|
|
|
|
|