Mp3 broadcasting

By Kyousoukyoku on Oct 20, 2007

In code documentation.

/*
Documentation;
Snippet;Mp3 advertising
Author;Kyou./XN.
Release;10;20;07
******************************
Dialog that allows you to message to all channels the active mp3 status. You can check off which status options you'd like to display, giving you an easy to use and vast interface. Once you have viewed and selected your choice. Click Go! and it will broadcast the current mp3's status based on your selection. Type: /broad.open to open the dialog. 
NOTE -- The mp3 player broadcasting dialog won't open unless you are in an active mp3 already. Also, the dialog will close when the mp3 ends. ;) --
Product of Kyousoukyoku/XteNsion. Ripping is fobidden, don't try it.
*/

dialog mp3advertising {
  title "Mp3 adv."
  size -1 -1 245 83
  option pixels
  check "Title", 1, 4 7 51 17
  check "Artist", 2, 63 6 51 17
  check "Length", 3, 122 6 51 17
  check "Track", 4, 4 30 51 17
  check "Album", 5, 62 30 51 17
  check "Mode", 6, 123 30 51 17
  check "Size", 7, 181 6 51 17
  check "Freq.", 8, 181 30 51 17
  edit "", 9, 4 55 179 20, read autohs
  button "Go!", 10, 184 53 44 21, ok
}

on *:dialog:mp3advertising:sclick:*:{
  if ($did = 1) { 
    if ($did($dname, 1).state = 1) { 
      set %mp3status $addtok(%mp3status, - Title: $sound($insong.fname).title, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 1).state = 0) { 
      set %mp3status $remove(%mp3status, - Title: $sound($insong.fname).title)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 2) { 
    if ($did($dname, 2).state = 1) { 
      set %mp3status $addtok(%mp3status, - Artist: $sound($insong.fname).artist, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 2).state = 0) { 
      set %mp3status $remove(%mp3status, - Artist: $sound($insong.fname).artist)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 3) { 
    if ($did($dname, 3).state = 1) { 
      set %mp3status $addtok(%mp3status, - Length: $gmt($calc($insong.length / 1000),nn:ss), 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 3).state = 0) { 
      set %mp3status $remove(%mp3status, - Length: $gmt($calc($insong.length / 1000),nn:ss))
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 4) { 
    if ($did($dname, 4).state = 1) { 
      set %mp3status $addtok(%mp3status, - Track: $sound($insong.fname).track, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 4).state = 0) { 
      set %mp3status $remove(%mp3status, - Track: $sound($insong.fname).track)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 5) { 
    if ($did($dname, 5).state = 1) { 
      set %mp3status $addtok(%mp3status, - Album: $sound($insong.fname).album, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 5).state = 0) { 
      set %mp3status $remove(%mp3status, - Album: $sound($insong.fname).album)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 6) { 
    if ($did($dname, 6).state = 1) { 
      set %mp3status $addtok(%mp3status, - Mode: $sound($insong.fname).mode, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 6).state = 0) { 
      set %mp3status $remove(%mp3status, - Mode: $sound($insong.fname).mode)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 8) { 
    if ($did($dname, 8).state = 1) { 
      set %mp3status $addtok(%mp3status, - Frequency: $sound($insong.fname).bitrate $+ kbps, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 8).state = 0) { 
      set %mp3status $remove(%mp3status, - Frequency: $sound($insong.fname).bitrate $+ kbps)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 7) { 
    if ($did($dname, 7).state = 1) { 
      set %mp3status $addtok(%mp3status, - Size: $bytes($file($insong.fname).size).suf, 32)
      did -ra $dname 9 %mp3status
    }
    elseif ($did($dname, 7).state = 0) { 
      set %mp3status $remove(%mp3status, - Size: $bytes($file($insong.fname).size).suf)
      did -ra $dname 9 %mp3status
    }
  }
  if ($did = 10) { amsg Active mp3 %mp3status }
}
on *:MP3END:{ if ($dialog(mp3advertising)) { dialog -x mp3advertising mp3advertising } }
alias broad.open { if ($inmp3) { dialog $iif($dialog(mp3advertising),-v mp3advertising mp3advertising, -m mp3advertising mp3advertising) } } 
on *:dialog:mp3advertising:close:0:{ unset %mp3status }

Comments

Sign in to comment.
Kyousoukyoku   -  Oct 21, 2007

Interesting idea. I\'ll think about that. Anyway, thanks for your feedback.

 Respond  
Saeed   -  Oct 21, 2007

you did a pretty through hob with this. nice job on this snippet will be useful for my mp3 player. I do wish there was an option to message it or describe it to the active channel; instead of amsging it.

 Respond  
Kyousoukyoku   -  Oct 21, 2007

Comments?

 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.