Multimedia V2.0

By `Kazuma on Nov 27, 2005

Whee, I'm back now. >.<' So here's the Mp3 Player I made. It doesn't show up in a big dialog and show the songs, but when you set your directory and hit "Play" it goes to where you set it and you can choose. I'm just horrible with dialogs. Anyway, hope you all enjoy. ^.^;

####################################### Media Player V2.0 ###########################################
# By `Kazuma
#  Version 2.0
#   No Rips please =P
#    Questions or comments
#  Email Sanzukou@hotmail.com
#   Thanks.
#    Media Player 2.0
#     Updated!
#############################################################################################################

menu menubar {
  -
  [Mp3 Player]
  .Play:/s.play
  .Silent:/msplay
  .Random
  ..Start:{
    set %rplay on
    /rplay
  }
  ..Off:/set %rplay off
  .-
  .Setup:/mset
}

alias mset {
  set %m.player $dir="Select Your Mp3 Player" [ c:\ $+ *. ]
  set %m.dir $sdir="Where are your Mp3 Stored?" [ c:\ ]
}

alias s.play {
  set %m.song $dir="What do you want to play?" [ %m.dir $+ *.mp3 ]
  if ($mp3(%m.song).artist = $null) mname.n
  else mname
  run %m.song
  ame  %sk $+ (- Media Player -) %m.name .:: %m.rate $+ %bk $+ kbps $+ %sk $+ / $+ $round(%m.size,2) $+ %bk $+ mb $+ %sk $+ / $+ %bk $+ %m.length $+ %sk ::.
}
alias mname {
  $song.length(%m.song)
  set %m.name $mp3(%m.song).artist - $mp3(%m.song).title
  set %m.size $calc($lof(%m.song) / 1050024)
  set %m.length %m $+ : $+ %timsec
}
alias mname.n {
  $song.length(%m.song)
  set %m.name $nopath(%m.song)
  set %m.name $replace(%m.name,.mp3,%null)
  set %m.size $calc($lof(%m.song) / 1050024)
  set %m.length %m $+ : $+ %timsec
}
alias msplay {
  set %m.song $dir="What do you want to play?" [ %m.dir $+ *.mp3 ]
  run %m.song
}
alias rplay {
  if (%rplay == on) {
    ranfile
    if ($mp3(%m.song).artist = $null) mname.n
    else mname
    run %m.song
    ame  %sk $+ (- Media Player -) %m.name .:: %m.rate $+ %bk $+ kbps $+ %sk $+ / $+ $round(%m.size,2) $+ %bk $+ mb $+ %sk $+ / $+ %bk $+ %m.length $+ %sk ::.
    timer1 1 %totsecs /rplay
  }
  else halt
}

alias song.length {
  set %m.rate $mp3(%m.song).bitrate
  set %bitrate %m.rate $+ 000 
  if ( %bitrate == N/A000 ) { set %bitrate 128000 }
  %bitrate = %bitrate / 8 
  %n = $lof($1-) 
  %n = %n / %bitrate 
  %m = %n / 60 
  %timsec = %n % 60 
  %m = $int(%m) 
  %timsec = $int(%timsec)
  %totsecs = %m * 60 
  %totsecs = %totsecs + %timsec
  if (0 isin %timsec) {
    if (%timsec == 0) { set %timsec 00 }
    if (%timsec == 1) { set %timsec 10 }
    if (%timsec == 2) { set %timsec 20 }
    if (%timsec == 3) { set %timsec 30 }
    if (%timsec == 4) { set %timsec 40 }
    if (%timsec == 5) { set %timsec 50 }
  }
  else {
    if (%timsec == 1) { set %timsec 01 }
    if (%timsec == 2) { set %timsec 02 }
    if (%timsec == 3) { set %timsec 03 }
    if (%timsec == 4) { set %timsec 04 }
    if (%timsec == 5) { set %timsec 05 }
    if (%timsec == 6) { set %timsec 06 }
    if (%timsec == 7) { set %timsec 07 }
    if (%timsec == 8) { set %timsec 08 }
    if (%timsec == 9) { set %timsec 09 }
  }
}

alias ranfile {
  var %1 = 0,%2,%3,%4 = 1,%5 = 0,%6
  :top
  inc %1
  if ( %1 > %4 ) {
    if ( %2 == 0 ) { -echo Could not locate an mp3 | halt }
    set %1 0 | set %3 $rand(1,%2)
    goto next
  }
  set %file.r [ $+ [ %1 ] ] $findfile($shortfn(%m.dir),*.mp3,*)
  set %2 $calc( %2 + [ %file.r [ $+ [ %1 ] ] ] )
  goto top
  :next
  inc %1
  set %6 %5
  set %5 $calc( %5 + [ %file.r [ $+ [ %1 ] ] ] )
  if ( %3 <= %5 ) { set %m.song $findfile($shortfn(%m.dir),*.mp3,$calc( %3 - %6 )) | return }
  if ( %1 > %4 ) { halt }
  goto next
}

Comments

Sign in to comment.
RoninWarrior   -  Nov 28, 2005

if you wrote this and tested it like you are supposed to the you of all people should know if it will randomly play songs all the way through ?

 Respond  
`Kazuma   -  Nov 28, 2005

Well actually, Yes I think it will.

 Respond  
`Kazuma   -  Nov 28, 2005

No, it will not.

 Respond  
nark0tics   -  Nov 28, 2005

Now will this continue to play songs down the list if you click \"random\"?

 Respond  
`Kazuma   -  Nov 28, 2005

Updated;
Edited the \'Kbps\' and changed message.

 Respond  
`Kazuma   -  Nov 27, 2005

Fixed random play.

 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.