This is an mp3 player with a playlist, and "now" function. just type /player for the mp3 player, and /setup for "now playing" setup.
dialog mp3 {
title "hawks mp3 player"
size -1 -1 264 170
option pixel
button "<<", 2, 1 110 50 30 ok tab 11
button "||", 3, 52 110 50 30
button "", 4, 104 110 50 30
button "|>", 5, 156 110 50 30
button ">>", 6, 208 110 50 30
button "close", 10, 1 140 260 30, ok
list 7, 1 0 208 120, hsbar vsbar extel
button "add file" 8, 210 1 50 50
button "del file" 9, 210 50 50 50
}
on 1:dialog:mp3:sclick:8: {
set %song1 $sfile(/)
write playlist.txt %song1
did -a mp3 7 $nopath(%song1)
}
on 1:dialog:mp3:sclick:9: {
set %del1 $did(mp3, 9).seltext
set %del2 $did(mp3, 7).sel
write -dw [ $+ [ * [ $+ [ %del1 [ $+ [ * ] ] ] ] ] ] playlist.txt
did -d mp3 7 %del2
}
on 1:dialog:mp3:init:0: {
set %number 1
:next
set %song2 $read(playlist.txt, %number )
did -a mp3 7 $nopath(%song2)
inc %number 1
if ( %song2 != $null ) { goto next }
}
on 1:dialog:mp3:sclick:5: {
if ( %pause == on ) {
set %pause off
splay -p resume
}
else {
unset %play1
unset %play3
set %play1 $did(mp3, 7).seltext
set %play2 $did(mp3, 7).sel
set %play3 $read(playlist.txt, w, * [ $+ [ %play1 ] ] [ $+ [ * ] ] )
splay %play3
set %listening $nopath(%play3)
inc %play2 1
}
}
on 1:MP3END: {
set %play3 $read(playlist.txt, %play2)
splay %play3
set %listening $nopath(%play3)
inc %play2 1
}
on 1:dialog:mp3:sclick:4: {
splay stop
}
on 1:dialog:mp3:sclick:6: {
splay $read(playlist.txt, %play2)
set %path $read(playlist.txt, %play2)
set %listening $nopath(%path)
inc %play2 1
}
on 1:dialog:mp3:sclick:2: {
dec %play2 1
splay $read(playlist.txt, %play2)
set %path $read(playlist.txt, %play2)
set %listening $nopath(%path)
}
on 1:dialog:mp3:sclick:3: {
set %pause on
splay -p pause
}
alias song {
if ( %islist == me ) {
describe $chan %text %listening
}
else {
msg $chan %text %listening
}
}
alias setup {
set %islist $$?="When you say what you're listening to, shall it be in /me or /say. (me for /me and say for /say)"
set %text $$?="And what do you want to say? Example: Now playing: or is listening to"
echo ok, type /song to show what song you're listening to
}
alias player {
dialog -md mp3 mp3
}