Mp3 Player

By Del_Felesif on Oct 19, 2005

Ok. . .pretty simple, there may be a few bugs, so tell me if it's not working right. I'm working on adding the 'remove' button, but I can't quite get it to work on this particular script. The 'Set' Button sets how many songs you want to play.

I made a few changes to it. I'm not sure if I'm completely done with it. Please, tell me if any error messages show up.

dialog jons_mp3 {
  title "Jon's Mp3 Player"
  size -1 -1 505 225
  list 1, 5 5 245 190, size
  button "Add", 2, 255 40 70 30, ok
  button "Mp3 Dir", 3, 310 150 50 20
  edit "", 4, 255 175 240 20, read
  text "Dir:", 5, 255 155 50 20
  button "Play", 6, 255 5 70 30, default
  list 7, 0 0 0 0, size
  button "Stop", 8, 255 75 70 30
  button "Reset Playlist", 9, 400 5 100 20
  check "Message in Channel", 10, 255 113 125 15
  edit "1", 11, 405 45 40 20
  box "Songs", 12, 400 30 100 65
  button "Set", 13, 455 45 40 20
  edit "", 14, 5 200 490 20, read
  check "Random", 15, 400 113 100 15
  button "Random", 16, 400 128 58 20
  button "Remove", 17, 330 40 70 30
  button "Close", 18, 450 150 50 20
  button "Play All", 19, 405 70 90 20
  button "Mute", 20, 330 75 70 30
  button "Whole Playlist", 22, 325 5 75 30
  button "Send Message", 23, 255 128 115 20
}
on *:dialog:jons_mp3:close:0: { set %mp3.open no | set %mp3.dunno no }
alias mp3 {
  if ( %mp3.open == no ) {
    dialog -md jons_mp3 jons_mp3
  }
}
on *:DIALOG:jons_mp3:init:*: {
  set %mp3.open yes
  if ( %mp3songs.number == 1 ) {
    did -r jons_mp3 14
    did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number song.
  }
  if ( %mp3songs.number != 1 ) {
    did -r jons_mp3 14
    did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number songs.
  }
  did -a jons_mp3 4 %mp3.dir
  if (%mp3.playlist != Directory) {
    didtok jons_mp3 1 44 %mp3.playlist
    didtok jons_mp3 7 44 %mp3.playlist2
  }
  if ( %mp3.msg == on ) {
    did -c jons_mp3 10
  }
  if ( %mp3.random == on ) {
    did -c jons_mp3 15
  }
  .timer 1 .2 /did -c jons_mp3 1 %mp3.line2
  .timer 1 .2 /did -c jons_mp3 7 %mp3.line2
  if (%mp3.playlist == Directory) {
    set %mp3.found $findfile(%mp3.dir,*.wma,0,did -a jons_mp3 1 $nopath($1-))
    set %mp3.found $findfile(%mp3.dir,*.mp3,0,did -a jons_mp3 1 $nopath($1-))
  }
  set %mp3.numberlines $did(jons_mp3,1).lines
}

on *:DIALOG:jons_mp3:sclick:*: {
  if ($did == 1) {
    set %mp3.line2 $did(jons_mp3,1).sel
    set %mp3.gonnaplay $did(jons_mp3,1).seltext
    did -c jons_mp3 7 %mp3.line2
    set %mp3.gonnaplay2 $did(jons_mp3,7).seltext
  }
  if ($did == 2) {
    var %mp3.file = $sfile(%mp3.dir,Choose an mp3. . .,Add)
    if ( %mp3.file != $null ) {
      if (%mp3.playlist == Directory) {
        set %mp3.playlist  
        set %mp3.playlist2  
      }
      did -a jons_mp3 1 $nopath(%mp3.file))
      did -a jons_mp3 7 $nopath(%mp3.file))
      if (%mp3.playlist != Your playlist is empty ) {
        set %mp3.playlist %mp3.playlist $+ , $+ $nopath(%mp3.file))
        set %mp3.playlist2 %mp3.playlist2 $+ , $+ $nofile(%mp3.file))
        .timer 1 .5 mp3
      }
      if (%mp3.playlist == Your playlist is empty ) {
        set %mp3.playlist $nopath(%mp3.file))
        set %mp3.playlist2 $nofile(%mp3.file))
        .timer 1 .5 mp3
      }
    }
  }
  if ($did == 3) {
    set %mp3.new.dir $sdir="Mp3 directory" c:\
    if ( %mp3.new.dir != $null ) {
      set %mp3.dir %mp3.new.dir
      did -r jons_mp3 4
      did -a jons_mp3 4 %mp3.dir
    }
    dialog -x jons_mp3
    set %mp3.open no
    mp3
  }
  if ($did == 6) {
    set %mp3.send.message %mp3.gonnaplay
    if (%mp3.playlist != Directory) {
      if (%mp3.line2 == $null) {
        splay %mp3.gonnaplay2 $+ %mp3.gonnaplay
      }
    }
    if (%mp3.playlist == Directory) {
      splay %mp3.dir $+ %mp3.gonnaplay
    }
    set %mp3songs.played 1
    did -r jons_mp3 14
    if ( %mp3songs.number == 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number song.
    }
    if ( %mp3songs.number != 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number songs.
    }
    if (%mp3.msg == On ) {
      amsg $me likes 9~*~ $remove(%mp3.send.message,.mp3,.wma) 9~*~
    }
  }
  if ($did == 8) {
    splay stop
    set %mp3.send.message Playing Absolutely Nothing
  }
  if ($did == 9) {
    set %mp3.playlist  Your playlist is empty
    set %mp3.playlist2 Nothing
    did -r jons_mp3 1
    did -r jons_mp3 7
    didtok jons_mp3 1 44 %mp3.playlist
    didtok jons_mp3 7 44 %mp3.playlist2
    set %mp3.numberlines 0
  }
  if ($did == 10) { { if (%mp3.msg == On) { set %mp3.msg Off } | else { set %mp3.msg On } }
  }
  if ($did == 13) {
    did -t jons_mp3 6
    set %mp3songs.number $did(jons_mp3,11).text
    if ( %mp3songs.played > %mp3songs.number ) {
      set %mp3songs.played %mp3songs.number
    }
    if ( %mp3songs.number == 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number song.
    }
    if ( %mp3songs.number != 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number songs.
    }
  }
  if ($did == 15) { { if (%mp3.random == On) { set %mp3.random Off } | else { set %mp3.random On } }
  }
  if ($did == 16) {
    if (%mp3.playlist != Directory) {
      set %mp3songs.played 1
      set %mp3.gonnaplay $did(jons_mp3,1).seltext
      set %mp3.send.message %mp3.gonnaplay
      set %mp3.line2 $rand(1,%mp3.numberlines)
      did -c jons_mp3 7 %mp3.line2
      did -r jons_mp3 14
      set %mp3.gonnaplay2 $did(jons_mp3,7).seltext
      splay %mp3.gonnaplay2 $+ %mp3.gonnaplay
    }
    if (%mp3.playlist == Directory) {
      set %mp3songs.played 1
      set %mp3.line2 $rand(1,%mp3.numberlines)
      did -c jons_mp3 1 %mp3.line2
      set %mp3.gonnaplay $did(jons_mp3,1).seltext
      set %mp3.send.message %mp3.gonnaplay
      splay %mp3.dir $+ %mp3.gonnaplay
    }
    if ( %mp3songs.number == 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number song.
    }
    if ( %mp3songs.number != 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number songs.
    }
  }
  if ($did == 17) {
    set %mp3.playlist $removecs(%mp3.playlist,%mp3.gonnaplay)
    set %mp3.playlist2 $removecs(%mp3.playlist2,%mp3.gonnaplay2)
  }
  if ($did == 18) {
    dialog -x jons_mp3
    set %mp3.open no
    set %mp3.dunno no
  }
  if ($did == 19) {
    set %mp3songs.number $did(jons_mp3,1).lines
    set %mp3.line2 1
    did -c jons_mp3 1 %mp3.line2
    if (%mp3.playlist != Directory) {
      did -c jons_mp3 7 %mp3.line2
    }
    did -r jons_mp3 14
    set %mp3.gonnaplay $did(jons_mp3,1).seltext
    if (%mp3.playlist != Directory) {
      set %mp3.gonnaplay2 $did(jons_mp3,7).seltext
      splay %mp3.gonnaplay2 $+ %mp3.gonnaplay
    }
    if (%mp3.playlist == Directory) {
      splay %mp3.dir $+ %mp3.gonnaplay
    }
    set %mp3.random off
    did -u jons_mp3 15
    set %mp3songs.played 1
    if (%mp3.msg == On ) {
      amsg $me likes 9~*~ $remove(%mp3.send.message,.mp3,.wma) 9~*~
    }
    if ( %mp3songs.number == 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number song.
    }
    if ( %mp3songs.number != 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number songs.
    }
  }
  if ($did == 20) {
  if ($vol(master).mute == $false) { vol -vu1 | did -o jons_mp3 20 1 Unmute } | elseif ($vol(master).mute == $true) { vol -vu2 | did -o jons_mp3 20 1 Mute } }
  if ($did == 22) {
    did -r jons_mp3 1
    did -r jons_mp3 7
    set %mp3.found $findfile(%mp3.dir,*.wma,0,did -a jons_mp3 1 $nopath($1-))
    set %mp3.found $findfile(%mp3.dir,*.mp3,0,did -a jons_mp3 1 $nopath($1-))
    set %mp3.playlist Directory
  }
  if ( $did == 23) {
    if (%mp3.send.message != Playing Absolutely Nothing) {
      msg $active $me likes 9~*~ $remove(%mp3.send.message,.mp3,.wma) 9~*~
    }
    else {
      echo -a You're not playing anything!
    }
  }
}
on *:DIALOG:jons_mp3:edit:11: {
  did -t jons_mp3 13
}
on *:LOAD: {
  set %mp3.open no
  set %mp3.msg on
  set %mp3songs.played 0
  set %mp3songs.number 1
  set %mp3.random off
  set %mp3.numberlines 0
  echo -a Welcome to Jon's Mp3 Playe
  echo -a Open with /mp3.
  echo -a This mp3 player does not work well with other mp3 players.
}

on 1:MP3END: {
  set %mp3.send.message Playing Absolutely Nothing
  if ( %mp3songs.number > %mp3songs.played ) {
    set %mp3songs.played $calc(%mp3songs.played + 1)
    if (%mp3.open == no) {
      set %mp3.dunno yes
      mp3
    } 
    if (%mp3.random == off ) {
      set %mp3.line2 $calc(%mp3.line2 + 1)
      did -c jons_mp3 1 %mp3.line2
      if ( %mp3.playlist != Directory ) {
        did -c jons_mp3 7 %mp3.line2
      }
      did -r jons_mp3 14
      if ( %mp3.line2 > %mp3.numberlines ) {
        did -c jons_mp3 1 1
        if ( %mp3.playlist != Directory ) {
          did -c jons_mp3 7 1
        }
        did -r jons_mp3 14
      }
      set %mp3.gonnaplay $did(jons_mp3,1).seltext
      set %mp3.send.message %mp3.gonnaplay
      if ( %mp3.playlist != Directory ) {
        set %mp3.gonnaplay2 $did(jons_mp3,7).seltext
        splay %mp3.gonnaplay2 $+ %mp3.gonnaplay
      }
      if ( %mp3.playlist == Directory ) {
        splay %mp3.dir  $+ %mp3.gonnaplay
      }
    }
    if (%mp3.random == on ) {
      set %mp3.line2 $rand(1,%mp3.numberlines)
      did -c jons_mp3 1 %mp3.line2
      if ( %mp3.playlist != Directory ) {
        did -c jons_mp3 7 %mp3.line2
      }
      did -r jons_mp3 14
      set %mp3.gonnaplay $did(jons_mp3,1).seltext
      set %mp3.send.message %mp3.gonnaplay
      if ( %mp3.playlist != Directory ) {
        set %mp3.gonnaplay2 $did(jons_mp3,7).seltext
        splay %mp3.gonnaplay2 $+ %mp3.gonnaplay
      }
      if ( %mp3.playlist == Directory ) {
        splay %mp3.dir  $+ %mp3.gonnaplay
      }
    }
    if (%mp3.msg == On ) {
      amsg $me likes 9~*~ $remove(%mp3.send.message,.mp3,.wma) 9~*~
    }
    if ( %mp3songs.number == 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number song.
    }
    if ( %mp3songs.number != 1 ) {
      did -r jons_mp3 14
      did -a jons_mp3 14 You have played %mp3songs.played $+ / $+ %mp3songs.number songs.
    }
  }
  if ( %mp3.dunno == yes ) {
    dialog -x jons_mp3
    set %mp3.open no
    set %mp3.dunno no
  }
}

Comments

Sign in to comment.
corax   -  Sep 01, 2006

Unfortunatelly This not working here. After load it onto remotes and seen menu any try add files or use anything- Only criticall errors.

  • /splay: no such file.
    When i try put [play] of this what should be seen after load files It restart my client.
    This is fatall error script for me.
 Respond  
hawkshaw   -  Aug 31, 2006

This snippet works perfectly well with my 6.2 , unlike the rest!!!! :) Thanks...

 Respond  
tank59   -  Oct 19, 2005

Your Directory button doesn\'t work. You also set a ton of global variables I\'m not sure are necessary. Could make the dialog a little neater as well.

 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.