menu menubar {
Media Player:/dialog -md mp3 mp3
}
dialog mp3 {
title "Media Player"
size -1 -1 116 99
option dbu
list 6, 2 17 112 67, sort size hsbar vsbar
button ">/||", 16, 53 85 14 12
button ">>|", 20, 69 85 15 12
button "|<<", 21, 36 85 15 12
button "¤", 25, 88 85 10 12
button "^", 60, 4 85 9 12
button "v", 61, 14 85 9 12
button "<", 3, 2 2 9 12
text "Directories", 5, 13 1 102 7
text "", 4, 13 9 102 7
menu "File", 1
item "On Top", 50, 1
item break, 51, 1
item "Add Directory", 2, 1
item "Delete Directory", 26, 1
item break, 7, 1
item "Exit", 8, 1
menu "Player", 29
item "Play/Pause", 30, 29
item "Stop", 32, 29
item break, 33, 29
item "Next Song", 34, 29
item "Previous Song", 35, 29
item break, 63, 29
item "Seek Forward", 36, 29
item "Seek Backwards", 37, 29
item break, 57, 29
item "Edit Playlists", 28, 29
menu "Volume", 38
item "Up", 39, 38
item "Down", 40, 38
item break, 55, 38
item "Volume Control", 56, 38
menu "Options", 41
item "Mute", 42, 41
item break, 53, 41
item "Repeat", 43, 41
item "Shuffle", 44, 41
menu "Message", 45
item "Edit", 46, 45
item break, 48, 45
item "Enabled", 47, 45
}
on *:DIALOG:mp3:init:*:{
.timerMP3 0 1 /time.left
if (!$ini(mp3.ini,Set)) {
writeini mp3.ini Set vol 65535
writeini mp3.ini Set shuf 0
writeini mp3.ini Set rep 0
writeini mp3.ini Set mut 0
vol -p 65535
}
if (!$ini(mp3.ini,Dir)) {
var %n = $$?="Directory Name", %d = $$sdir(*,Select your music folder)
writeini mp3.ini Dir $replace(%n,$chr(32),-) %d
did -a mp3 6 %n
}
elseif ($ini(mp3.ini,Dir)) {
var %x = 1
while ($ini(mp3.ini,Dir,%x)) {
did -a mp3 6 $replace($ini(mp3.ini,Dir,%x),-,$chr(32))
inc %x
}
}
var %z = 1
while ($ini(mp3.ini,%z)) {
var %p = $replace($ini(mp3.ini,%z),-,$chr(32))
if (%p == Dir || %p == Set || %p == msg || %p == list) { goto end }
else { did -a mp3 6 %p }
:end
inc %z
}
if ($readini(mp3.ini,-n,Set,shuf)) { did -c mp3 44 }
if ($readini(mp3.ini,-n,Set,rep)) { did -c mp3 43 }
if ($readini(mp3.ini,-n,Set,mut)) { did -c mp3 42 }
if ($readini(mp3.ini,-n,msg,m)) { did -c mp3 47 }
did -z mp3 6
did -b mp3 3,16,20,21,25,26,30,32,34-37,60,61
}
on *:DIALOG:mp3:close:*:{
.timerMP3 off
splay -p stop
writeini mp3.ini Set shuf $did(44).state
writeini mp3.ini Set rep $did(43).state
writeini mp3.ini Set mut $did(42).state
}
on *:DIALOG:mp3:sclick:3:{
did -ra mp3 5 Directories
did -r mp3 4,6
did -b mp3 3,16,20,21,25,26,30,32,34-37,60,61
did -e mp3 2
splay -p stop
var %x = 1
while ($ini(mp3.ini,Dir,%x)) {
did -a mp3 6 $replace($ini(mp3.ini,Dir,%x),-,$chr(32))
inc %x
}
var %z = 1
while ($ini(mp3.ini,%z)) {
var %p = $replace($ini(mp3.ini,%z),-,$chr(32))
if (%p == Dir || %p == Set || %p == msg || %p == list) { goto end }
else { did -a mp3 6 %p }
:end
inc %z
}
}
on *:DIALOG:mp3:sclick:60:{
if ($did(6).sel) {
if ($did(6).sel == 1) { halt }
var %n = $did(6).sel, %t = $did(6).seltext
did -d mp3 6 %n
did -i mp3 6 $calc(%n -1) %t
did -c mp3 6 $calc(%n -1)
}
}
on *:DIALOG:mp3:sclick:61:{
if ($did(6).sel) {
if ($did(6).sel == $did(6).lines) { halt }
var %n = $did(6).sel, %t = $did(6).seltext
did -d mp3 6 %n
did -i mp3 6 $calc(%n +1) %t
did -c mp3 6 $calc(%n +1)
}
}
on *:DIALOG:mp3:menu:43:{
if ($did(43).state) { did -u mp3 43 }
else { did -c mp3 43 }
}
on *:DIALOG:mp3:menu:44:{
if ($did(44).state) { did -u mp3 44 }
else { did -c mp3 44 }
}
on *:DIALOG:mp3:menu:2:{
:start
var %n = $$?="Directory Name"
if ($readini(mp3.ini,-n,Dir,$replace(%n,$chr(32),-))) {
if ($input(The name $qt(%n) is already in use by the system or another directory name $+ $crlf $+ $crlf $+ Select a new name?,yw,Already taken)) { goto start }
}
else {
var %d = $$sdir(*,Select your music folder)
writeini mp3.ini Dir $replace(%n,$chr(32),-) %d
if ($did(5) == directories) { did -a mp3 6 %n }
}
}
on *:DIALOG:mp3:menu:8:{
.timerMP3 off
splay -p stop
writeini mp3.ini Set shuf $did(44).state
writeini mp3.ini Set rep $did(43).state
writeini mp3.ini Set mut $did(42).state
dialog -x mp3
}
on *:DIALOG:mp3:menu:26:{
if ($did(6).sel && $did(5) == directories) {
var %x = $replace($did(6).seltext,$chr(32),-)
if ($readini(mp3.ini,-n,Dir,%x)) {
did -d mp3 6 $did(mp3,6).sel
remini mp3.ini Dir %x
}
else {
did -d mp3 6 $did(mp3,6).sel
remini mp3.ini %x
}
did -b mp3 26
}
}
on *:DIALOG:mp3:menu:28:{ dialog -md play play }
on *:DIALOG:mp3:menu:39:{
var %x = $round($calc($readini(mp3.ini,-n,set,vol) /65535*100),0), %r = $calc(%x +5)
if (%r > 100) { noop $input(The volume is already at max,oi,Max) }
else {
vol -p $calc(%r /100*65535)
writeini -n mp3.ini Set vol $round($calc(%r /100*65535),0)
if ($dialog(vc)) {
did -ra vc 1 Percent: %r $+ $chr(37)
did -ra vc 2 Real: $round($calc(%r /100*65535),0)
}
}
}
on *:DIALOG:mp3:menu:40:{
var %x = $round($calc($readini(mp3.ini,-n,set,vol) /65535*100),0), %r = $calc(%x -5)
if (%r < 0) { noop $input(The volume is already at minimum,oi,Minimum) }
else {
vol -p $calc(%r /100*65535)
writeini -n mp3.ini Set vol $round($calc(%r /100*65535),0)
if ($dialog(vc)) {
did -ra vc 1 Percent: %r $+ $chr(37)
did -ra vc 2 Real: $round($calc(%r /100*65535),0)
}
}
}
on *:DIALOG:mp3:sclick:6:{
if ($did(5) == Directories) {
if ($did(6).sel) { did -e mp3 26 }
else { did -b mp3 26 }
}
}
on *:DIALOG:mp3:dclick:6:{
if ($did(5) == directories) {
if ($readini(mp3.ini,-n,Dir,$replace($did(6).seltext,$chr(32),-))) {
did -a mp3 5 $did(6).seltext
var %name = $did(6).seltext
did -r mp3 6
noop $findfile($readini(mp3.ini,-n,Dir,$replace(%name,$chr(32),-)),*.mp3,0,1,did -a mp3 6 $gettok($1-,-1,92))
noop $findfile($readini(mp3.ini,-n,Dir,$replace(%name,$chr(32),-)),*.wma,0,1,did -a mp3 6 $gettok($1-,-1,92))
noop $findfile($readini(mp3.ini,-n,Dir,$replace(%name,$chr(32),-)),*.wav,0,1,did -a mp3 6 $gettok($1-,-1,92))
}
else {
did -a mp3 5 $did(6).seltext
var %name = $did(6).seltext
did -r mp3 6
var %x = 1
while ($ini(mp3.ini,%name,%x)) {
did -a mp3 6 $replace($ini(mp3.ini,%name,%x),-,$chr(32))
inc %x
}
}
did -z mp3 6
did -e mp3 3,16,20,21,25,26,30,32,34-37,60,61
did -b mp3 2,26
}
else {
if ($readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-))) {
if ($file($ifmatch $+ $did(6).seltext)) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-)) $+ $did(6).seltext }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
elseif ($readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6).seltext,$chr(32),-))) {
if ($file($ifmatch)) { splay -p $readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6).seltext,$chr(32),-)) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -ra mp3 4 $did(6).seltext
display.msg
}
}
on *:DIALOG:mp3:menu:42:{
if ($did(42).state) {
vol -pu2
did -u mp3 42
}
else {
vol -pu1
did -c mp3 42
}
}
on *:DIALOG:mp3:menu:56:{ dialog -ma vc vc }
on *:DIALOG:mp3:sclick,menu:16,30:{
if ($insong.pause) { splay -p resume }
elseif ($insong) { splay -p pause }
else {
if ($did(6).sel) { var %x = $did(6).seltext }
else {
var %x = $did(6,1)
did -c mp3 6 1
}
did -ra mp3 4 %x
display.msg
if ($readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-))) {
if ($file($ifmatch $+ %x)) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-)) $+ %x }
else { noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found) }
}
elseif ($readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6).seltext,$chr(32),-))) {
if ($file($ifmatch)) { splay -p $readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6).seltext,$chr(32),-)) }
else { noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found) }
}
else { noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found) }
}
}
on *:DIALOG:mp3:menu:36:{ splay -p seek $calc($insong.pos +10000) }
on *:DIALOG:mp3:menu:37:{ splay -p seek $calc($insong.pos -10000) }
on *:DIALOG:mp3:sclick,menu:20,34:{
var %x = $iif($calc($did(6).sel +1) < $calc($did(6).lines +1),$v1,1)
if ($readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-))) {
if ($file($ifmatch $+ $did(6,%x))) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-)) $+ $did(6,%x) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
elseif ($readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6,%x),$chr(32),-))) {
if ($file($ifmatch)) { splay -p $readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6,%x),$chr(32),-)) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -ra mp3 4 $did(6,%x)
did -c mp3 6 %x
display.msg
}
on *:DIALOG:mp3:sclick,menu:21,35:{
var %x = $iif($calc($did(6).sel -1) > 0,$v1,$did(6).lines)
if ($readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-))) {
if ($file($ifmatch $+ $did(6,%x))) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(5),$chr(32),-)) $+ $did(6,%x) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
elseif ($readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6,%x),$chr(32),-))) {
if ($file($ifmatch)) { splay -p $readini(mp3.ini,-n,$replace($did(5),$chr(32),-),$replace($did(6,%x),$chr(32),-)) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -ra mp3 4 $did(6,%x)
did -c mp3 6 %x
display.msg
}
on *:DIALOG:mp3:sclick,menu:25,32:{
did -r mp3 4
splay -p stop
}
on *:DIALOG:mp3:menu:46:{ dialog -ma msg msg }
on *:DIALOG:mp3:menu:47:{
if ($did(mp3,47).state) {
did -u mp3 47
writeini mp3.ini msg m 0
}
else {
did -c mp3 47
writeini mp3.ini msg m 1
}
}
on *:DIALOG:mp3:menu:50:{
if ($did(mp3,50).state) {
did -u mp3 50
dialog -n mp3
}
else {
did -c mp3 50
dialog -o mp3
}
}
on *:MP3END:{
if ($readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-))) {
if ($did(mp3,43).state) {
if ($file($readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-)) $+ $did(mp3,6).seltext)) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-)) $+ $did(mp3,6).seltext }
else { noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found) }
}
elseif ($did(mp3,44).state) {
:start
var %x = $rand(1,$did(mp3,6).lines)
if ($did(mp3,6,%x) == $did(mp3,5)) { goto start }
if ($file($readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-)) $+ $did(mp3,6,%x))) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-)) $+ $did(mp3,6,%x) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -c mp3 6 %x
did -ra mp3 4 $did(mp3,6,%x)
display.msg
}
else {
var %x = $did(mp3,6).lines, %n = $iif($did(mp3,6,%x) == $did(mp3,4),1,$calc($did(mp3,6).sel +1))
if ($file($readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-)) $+ $did(mp3,6,%n))) { splay -p $readini(mp3.ini,-n,Dir,$replace($did(mp3,5),$chr(32),-)) $+ $did(mp3,6,%n) }
else {
noop noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -c mp3 6 %n
did -ra mp3 4 $did(mp3,6,%n)
display.msg
}
}
elseif ($readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6).seltext,$chr(32),-))) {
if ($did(mp3,43).state) {
if ($file($readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6).seltext,$chr(32),-)))) { splay -p $readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6).seltext,$chr(32),-)) }
else { noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found) }
}
elseif ($did(mp3,44).state) {
:start2
var %x = $rand(1,$did(mp3,6).lines)
if ($did(mp3,6,%x) == $did(mp3,5)) { goto start2 }
if ($file($readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6,%x),$chr(32),-)))) { splay -p $readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6,%x),$chr(32),-)) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -c mp3 6 %x
did -ra mp3 4 $did(mp3,6,%x)
display.msg
}
else {
var %x = $did(mp3,6).lines, %n = $iif($did(mp3,6,%x) == $did(mp3,4),1,$calc( $did(mp3,6).sel + 1 ))
if ($file($readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6,%n),$chr(32),-)))) { splay -p $readini(mp3.ini,-n,$replace($did(mp3,5),$chr(32),-),$replace($did(mp3,6,%n),$chr(32),-)) }
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
did -c mp3 6 %n
did -ra mp3 4 $did(mp3,6,%n)
display.msg
}
}
else {
noop $input(The song you requested to play was not found to exist $+ $crlf $+ This could be caused by: $+ $crlf $+ $crlf • The directory set was moved/deleted $+ $crlf • The song was moved/deleted,ow,Song not found)
halt
}
}
alias /time.left { dialog -t mp3 Media Player $iif($insong,- $time($calc(($insong.length - $insong.pos) / 1000),n:ss)) }
alias /display.msg {
if ($readini(mp3.ini,-n,msg,m) && $gettok($did(mp3,6).seltext,-1,46) == mp3) {
var %x = 1
while ($readini(mp3.ini,-n,msg,m $+ %x)) {
var %line = %line $replace($ifmatch,<b>,$chr(2),<c>, $chr(3),<n>,$chr(15),<u>,$chr(31),*album*,$iif($sound($insong.fname).album,$ifmatch,~),*title*, $iif($sound($insong.fname).title,$ifmatch,~),*artist*,$iif($sound($insong.fname).artist,$ifmatch,~),*year* ,$iif($sound($insong.fname).year,$ifmatch,~),*genre*,$iif($sound($insong.fname).genre,$ifmatch,~),*track*, $iif($sound($insong.fname).track,$ifmatch,~),*bitrate*,$iif($sound($insong.fname).bitrate,$ifmatch,~),*length*, $iif($insong.length,$remove($duration($calc( $ifmatch / 1000 ),3),00:0),~))
inc %x
}
if (!%line) { halt }
if ($readini(mp3.ini,-n,msg,a)) { amsg %line }
if ($readini(mp3.ini,-n,msg,e)) { echo -a %line }
if ($readini(mp3.ini,-n,msg,c)) {
var %n = $+(@,$replace($gettok($ifmatch,2-,32),$chr(32),-))
if (!$window(%n)) { window -k0 %n }
aline %n %line
}
}
}
dialog play {
title "Media Player - Playlists"
size -1 -1 183 84
option dbu
box "Playlists", 1, 2 1 70 66
list 2, 5 9 63 55, size sort
box "Songs", 3, 76 1 104 66
list 4, 79 9 98 55, size
button "Add", 5, 31 70 37 12
button "Remove", 6, 68 70 37 12
button "Edit", 7, 105 70 37 12
}
on *:DIALOG:play:init:*:{
var %x = 1
while ($ini(mp3.ini,%x)) {
var %n = $replace($ini(mp3.ini,%x),-,$chr(32))
if (%n == Dir || %n == Set || %n == msg || %n == list) { goto end }
else { did -a play 2 %n }
:end
inc %x
}
}
on *:DIALOG:play:dclick:2:{
did -r play 4
var %x = 1
while ($ini(mp3.ini,$replace($did(play,2).seltext,$chr(32),-),%x)) {
did -a play 4 $replace($ini(mp3.ini,$replace($did(play,2).seltext,$chr(32),-),%x),-,$chr(32))
inc %x
}
}
on *:DIALOG:play:sclick:5:{
:start
var %x = $$?="Playlist Name"
if ($ini(mp3.ini,%x)) {
if ($input(The name $qt(%x) is already in use by the system or another playlist $+ $crlf $+ $crlf $+ Enter a new name?,yw,Name taken)) { goto start }
else { halt }
}
set %name %x
dialog -ma playe playe
did -r play 4
}
on *:DIALOG:play:sclick:6:{
var %x = $iif($did(play,2).seltext,$ifmatch,$$?="Playlist Name")
did -d play 2 $did(play,2).sel
.remini mp3.ini %x
did -r play 4
}
on *:DIALOG:play:sclick:7:{
var %x = $iif($did(play,2).seltext,$ifmatch,$$?="Playlist Name")
set %name %x
did -d play 2 $did(play,2).sel
dialog -ma playe playe
var %n = 1
while ($ini(mp3.ini,$replace(%x,$chr(32),-),%n)) {
did -a playe 6 $ini(mp3.ini,$replace(%x,$chr(32),-),%n)
inc %n
}
did -r play 4
}
dialog playe {
title "Media Player - Playlist"
size -1 -1 200 78
option dbu
box "Directories", 1, 2 1 56 61
list 2, 5 9 50 50, size
box "Songs", 3, 61 1 66 61
list 4, 64 9 60 50, size
box "Playlist Songs", 5, 130 1 66 61
list 6, 133 9 60 50, size
button "Add", 7, 66 64 26 12
button "Remove", 8, 94 64 26 12
button "^", 9, 153 64 9 12
button "v", 10, 163 64 9 12
text "Close to save", 11, 7 66 33 8
}
on *:DIALOG:playe:init:*:{
var %x = 1
while ($ini(mp3.ini,dir,%x)) {
did -a playe 2 $replace($ini(mp3.ini,dir,%x),-,$chr(32))
inc %x
}
if (%name != $null) {
var %n = 1
while ($ini(mp3.ini,$replace(%name,$chr(32),-),%n)) {
did -a playe 6 $replace($ini(mp3.ini,$replace(%name,$chr(32),-),%n),-,$chr(32)) $+ - $+ $readini(mp3.ini,-n,$replace(%name,$chr(32),-),$replace($ini(mp3.ini,$replace(%name,$chr(32),-),%n),$chr(32),-))
inc %n
}
.remini mp3.ini $replace(%name,$chr(32),-)
dialog -t playe Media Player - Playlist: %name
}
}
on *:DIALOG:playe:close:*:{
if ($did(playe,6).lines > 0 && %name != $null) {
did -a play 2 %name
var %x = 1
while ($did(playe,6,%x)) {
writeini mp3.ini $replace(%name,$chr(32),-) $replace($gettok($did(playe,6,%x),1,45),$chr(32),-) $gettok($did(playe,6,%x),2,45)
inc %x
}
unset %name
did -r play 4
}
}
on *:DIALOG:playe:dclick:2:{
did -r playe 4
noop $findfile($readini(mp3.ini,-n,Dir,$replace($did(playe,2).seltext,$chr(32),-)),*.mp3,0,1,did -a playe 4 $gettok($1-,-1,92))
noop $findfile($readini(mp3.ini,-n,Dir,$replace($did(playe,2).seltext,$chr(32),-)),*.wma,0,1,did -a playe 4 $gettok($1-,-1,92))
noop $findfile($readini(mp3.ini,-n,Dir,$replace($did(playe,2).seltext,$chr(32),-)),*.wav,0,1,did -a playe 4 $gettok($1-,-1,92))
}
on *:DIALOG:playe:sclick:7:{
if ($did(playe,4).seltext) { did -a playe 6 $did(playe,4).seltext $+ - $+ $readini(mp3.ini,-n,Dir,$replace($did(playe,2).seltext,$chr(32),-)) $+ $did(playe,4).seltext }
}
on *:DIALOG:playe:sclick:8:{
if ($did(playe,6).seltext) { did -d playe 6 $did(playe,6).sel }
}
on *:DIALOG:playe:sclick:9:{
if ($did(6).sel) {
if ($did(6).sel == 1) { halt }
var %n = $did(6).sel, %t = $did(6).seltext
did -d playe 6 %n
did -i playe 6 $calc(%n -1) %t
did -c playe 6 $calc(%n -1)
}
}
on *:DIALOG:playe:sclick:10:{
if ($did(6).sel) {
if ($did(6).sel == $did(6).lines) { halt }
var %n = $did(6).sel, %t = $did(6).seltext
did -d playe 6 %n
did -i playe 6 $calc(%n +1) %t
did -c playe 6 $calc(%n +1)
}
}
dialog msg {
title "Media Player - Message"
size -1 -1 153 89
option dbu
check "AMSG", 1, 2 2 24 10
check "Echo", 2, 28 2 21 10
check "Custom Window", 3, 2 12 49 10
edit "", 4, 59 12 50 10, autohs
text "@", 5, 53 13 5 8
box "Message", 6, 2 23 150 48
edit "", 7, 5 31 145 37, multi return autovs
button "?", 8, 125 5 10 12
button "Ok", 9, 5 74 24 12, ok
button "Cancel", 10, 33 74 24 12, cancel
}
on *:DIALOG:msg:init:*:{
if ($readini(mp3.ini,-n,msg,a)) { did -c msg 1 }
if ($readini(mp3.ini,-n,msg,e)) { did -c msg 2 }
if ($gettok($readini(mp3.ini,-n,msg,c),1,32)) { did -c msg 3 }
if ($gettok($readini(mp3.ini,-n,msg,c),2-,32)) { did -a msg 4 $ifmatch }
var %x = 1
while ($readini(mp3.ini,-n,msg,m $+ %x)) {
did -o msg 7 %x $replace($ifmatch,<b>,$chr(2),<c>,$chr(3),<n>,$chr(15),<u>,$chr(31))
inc %x
}
}
on *:DIALOG:msg:sclick:9:{
writeini mp3.ini msg a $did(msg,1).state
writeini mp3.ini msg e $did(msg,2).state
writeini mp3.ini msg c $did(msg,3).state $iif($did(msg,4),$ifmatch)
var %x = 1, %n = $readini(mp3.ini,-n,msg,m)
while ($did(msg,7,%x)) {
writeini mp3.ini msg m $+ %x $replace($ifmatch,$chr(2),<b>,$chr(3),<c>,$chr(15),<n>,$chr(31),<u>)
inc %x
}
while ($readini(mp3.ini,-n,msg,m $+ %x)) {
remini mp3.ini msg m $+ %x
inc %x
}
}
on *:DIALOG:msg:sclick:8:{ dialog -ma msgh msgh }
dialog msgh {
title "Message - Help"
size -1 -1 136 81
option dbu
text "Code Replacements", 1, 9 1 48 8
text "*album*= Album Name", 2, 2 13 55 8
text "*title* = Title Name", 3, 2 21 47 8
text "*artist* = Artist Name", 4, 2 29 54 8
text "*year* = Year Released", 5, 2 37 59 8
text "*genre* = Genre", 6, 2 45 42 8
text "*track* = Track #", 7, 2 53 44 8
text "*bitrate* = Bitrate", 8, 2 61 45 8
text "*length* = Song Length", 14, 2 69 59 8
text "| | | | | | | | | | | |", 9, 66 1 2 79
text "The message will be all in one line.", 10, 72 1 60 14
text "You should not supply the @ in the custom window name.", 11, 72 17 60 20
text "Echo will echo the info to your active window.", 12, 72 39 60 15
text "If the song is not a MP3, the message will not be displayed.", 13, 72 56 60 20
}
dialog vc {
title "Volume Control"
size -1 -1 51 36
option dbu
text "", 1, 6 3 39 8
text "", 2, 6 12 39 8
button "^", 3, 14 22 9 12
button "v", 4, 26 22 9 12
}
on *:DIALOG:vc:init:*:{
var %t = $readini(mp3.ini,-n,set,vol)
did -ra vc 1 Percent: $calc($round(%t,0) /65535*100) $+ $chr(37)
did -ra vc 2 Real: $round(%t,0)
}
on *:DIALOG:vc:sclick:3:{
var %x = $calc($remove($did(1),$chr(37),Percent:) +5)
if (%x > 100) { noop $input(The volume is already at max,oi,Max) }
else {
did -ra vc 1 Percent: %x $+ $chr(37)
did -ra vc 2 Real: $round($calc(%x /100*65535),0)
vol -p $calc(%x /100*65535)
writeini -n mp3.ini Set vol $round($calc(%x /100*65535),0)
}
}
on *:DIALOG:vc:sclick:4:{
var %x = $calc($remove($did(1),$chr(37),Percent:) -5)
if (%x < 0) { noop $input(The volume is already at minimum,oi,Minimum) }
else {
did -ra vc 1 Percent: %x $+ $chr(37)
did -ra vc 2 Real: $round($calc(%x /100*65535),0)
vol -p $calc(%x /100*65535)
writeini -n mp3.ini Set vol $round($calc(%x /100*65535),0)
}
}