Browse Source

++mptk

master
Maxim Likhachev 5 years ago
parent
commit
b855442ef9
  1. 1
      README.md
  2. 58
      mptk

1
README.md

@ -35,6 +35,7 @@ will create the symbolic link for each script in the \<path> directory. @@ -35,6 +35,7 @@ will create the symbolic link for each script in the \<path> directory.
- [a2mp3](a2mp3) converts wav audio files to mp3 format.
- [axaudio](axaudio) gets an information and audio stream from Axia Livewire network.
- [mptk](mptk) allows to control mpd via mpc and store song's rating into id3v2 commentary tag.
- [retag](retag) writes id3 tags based on file path.
- [radio](radio) plays the internet radio stations from a list stored in the file.
- [vls](vls) runs vlc-ncurses with increased speed.

58
mptk

@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
#!/usr/bin/env tclsh
# Ghetto MPD controller
package require Tk
set music_directory "/mnt/DATA/Музыка/"
array set buttons {
prev 玲
toggle ▶
next 怜
}
proc mpc {args} {
exec mpc {*}$args
}
proc current_file {} {
lindex [split [exec mpc -f {%file%}] "\n"] 0
}
proc rate {rating} {
set filename [file join $::music_directory [current_file]]
exec mid3v2 --delete-frames=COMM $filename
exec mid3v2 --COMM $rating $filename
mpc update
}
proc update_status {} {
set ::mpd_status [mpc]
after 500 update_status
}
update_status
frame .status
frame .rating -pady 10
frame .control -pady 10
pack .status -fill x -expand true -padx 20 -pady 20
pack [label .status.current -font {Sans 20} -textvariable ::mpd_status]
pack .rating
foreach rating {1 2 3 4 5 5+} {
pack [button .rating.$rating -text $rating -font {Sans 60} -width 2 -command "rate $rating"] -side left
}
pack .control
foreach btn {prev toggle next} {
pack [button .control.$btn -text $buttons($btn) -font {Sans 80} -width 4 -command "mpc $btn"] -side left
}
bind . <KeyPress-Control_L><KeyPress-q> exit
bind . <KeyPress-Control_R><KeyPress-q> exit
Loading…
Cancel
Save