[Mp3 Player Junction]

By sukhbira on Dec 17, 2012

Simple Mp3 Player With Away,auto protection and auto thanx for voice,op etc; Enjoy

dialog mplayer {
  title "Mp3 Player"
  size -1 -1 144 204
  option dbu
  list 1, 7 9 126 99, hsbar vsbar size
  button "Prev", 2, 2 149 14 12
  button " Play", 3, 18 149 28 12
  button "Pause", 4, 47 149 28 12
  button "Resume", 5, 76 150 28 12
  button "Stop", 6, 105 149 20 12
  button "Next", 7, 125 149 14 12
  text " Now Playing: ", 8, 5 125 54 8, center
  edit "", 9, 6 134 123 12, read center
  box "Volume", 10, 11 109 49 8
  button "+", 11, 20 118 14 6, flat
  button "-", 12, 36 117 14 7, flat
  button "»Add Directory", 13, 4 165 49 12
  button "»Add Song", 14, 56 164 37 12
  button "Delete File", 15, 94 164 37 12
  button "Clear List", 16, 75 108 37 12
  box "Song Show on Channels", 17, 9 177 116 22
  radio "On", 18, 12 184 50 10, result
  radio "Off", 19, 67 184 50 10
}

alias up {
  set %currentvolume $vol(mp3)
  inc %currentvolume 5000
  if ( %currentvolume > 65535 ) { set %currentvolume 65535 }
  vol -p %currentvolume
}
alias down {
  set %currentvolume $vol(mp3)
  dec %currentvolume 5000
  if ( %currentvolume < 0 ) { set %currentvolume 0 }
  vol -p %currentvolume
}

alias read.playlist {
  %ln = 0
  set %lines $lines(playlist.txt)
  :loop
  if (%ln == %lines) { goto end }
  inc %ln
  did -az mplayer 1 $nopath($read(playlist.txt, %ln))
  goto loop
  :end {
  }
}
on 1:dialog:mplayer:sclick:18: set %annou ON
on 1:dialog:mplayer:sclick:18: set %annou OFF
on 1:dialog:mplayer:sclick:11: up
on 1:dialog:mplayer:sclick:12: down
on 1:dialog:mplayer:sclick:6: splay -p stop | unset %mp3.fname
on 1:dialog:mplayer:sclick:4: pause
on 1:dialog:mplayer:sclick:7: next
on 1:dialog:mplayer:sclick:2: prev
on 1:dialog:mplayer:sclick:14: set %m.playlist $dir="select an mp3:" [ %mp3dir $+ *.mp3 ] | if (%m.playlist == $null) halt | else { write playlist.txt %m.playlist | did -az mplayer 1 $nopath(%m.playlist) | unset %m.playlist }  
on 1:dialog:mplayer:sclick:13: add.dir
on 1:dialog:mplayer:sclick:3: mp32 $read(playlist.txt, %a.line)
on 1:dialog:mplayer:sclick:15: write -dl $+ %a.line playlist.txt | did -dz mplayer 1 %a.line
on 1:dialog:mplayer:sclick:1: set %a.line $did(mplayer,1).sel
on 1:dialog:mplayer:sclick:16: write -c playlist.txt | did -rz mplayer 1
on 1:dialog:mplayer:init:*:{
  read.playlist
  did -a mplayer 9 $remove($nopath(%mp3.fname),.mp3))

}

alias add.dir {
  set %p.dir $sdir="select a dir:" C:\ | if (%p.dir == $null) halt | else { goto start }
  :start
  set %x 0
  :loop
  inc %x 1
  if ($findfile(%p.dir,*.mp3,%x) == $null) { goto end }
  else {
    write playlist.txt $findfile(%p.dir,*.mp3,%x)
    did -az mplayer 1 $findfile(%p.dir,*.mp3,%x)
    goto loop
  }
  :end
  halt
}

alias mp32 {
  set %mp3.fname $1-
  if (%mp3.fname != $null) {
    splay -p %mp3.fname
    set %length $replace($round($calc($file(%mp3.fname).size / 126 / $gettok($mp3(%mp3.fname).bitrate,1,3)),0),mins,m,secs,s)
    if (%annou == on) { //ame 12[4-12=4<12Plays Song4>12=4-12] $nopath(%mp3.fname)4>12=4-12] 12[4-12=4<12Album4>12=4-12] 12[4-12=4<12 $+ $sound(%mp3song).album $+ 4>12=4-12] 12[4-12=4<12.Bitrate4>12=4-12][ $+ $sound(%mp3song).bitrate  Kbps $+ 12]4-12=4<12 }
    dialog -x mplayer mplayer
    dialog -m mplayer mplayer
  }
}
alias pause {
  if ($did(mplayer,6).state == 0) { splay resume }
  else { splay pause }
}

alias next {
  set %total $lines(playlist.txt)
  %active = 0
  if ($lines(playlist.txt) = 1) { mp32 $read(playlist.txt,1) | goto end }
  if ($lines(playlist.txt) = 0) { var %x = $input(There Are No Songs. Load A Play List,o,Warning) | goto end }
  else { goto loop }
  :loop
  inc %active 1
  if ($read(playlist.txt, %active) = %mp3.fname) { inc %active 1 | checkstat next | mp32 $read(playlist.txt, %active) | unset %active | goto end }
  if (%active > %total) { $input(There Are No More Songs. Use Previous or Load Another PlayList,o,Warning) | goto end }
  else { goto loop }
  :end
}
alias prev {
  set %total $lines(playlist.txt)
  %active = 0
  if ($lines(playlist.txt) = 1) { mp32 $read(playlist.txt,1) | goto end }
  if ($lines(playlist.txt) = 0) { var %x = $input(There Are No More Songs. Use Previous or Load Another PlayList,o,Warning) | goto end }
  else { goto loop }
  :loop
  inc %active 1
  if ($read(playlist.txt, %active) = %mp3.fname) { dec %active 1 | checkstat prev | mp32 $read(playlist.txt, %active) | unset %active | goto end }
  if (%active > %total) { $input(There Are No More Songs. Use Next button,o,warning) | goto end }
  else { goto loop }
  :end
}

alias checkstat {
  if ($1 = next) {
    if (%active > %total) { set %active 1 }
  }
  if ($1 = prev) {
    if (%active = 0) { set %active $lines(playlist.txt) }
  }
}

menu * {
  -
  Mp3Player: /dialog -m mplayer mplayer
}

Comments

Sign in to comment.
sukhbira   -  Dec 18, 2012

thanx deathjoker :)

 Respond  
VxD aka DEATHJ0KER   -  Dec 18, 2012

well done, I like the way that protects the 'user

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.