This is the Jukebox I made, many have requested the script, so I decided to release it to the public. Very simple, very easy to modify. If you use it, please if anyone asks give them the script. If you modify it (besides adding music), you can just give them the link to this, rather than the modified version.
Could probably be modded to play internet radio stations.
PHP Code:
//#CLIENTSIDE
function onCreated()
{
showJukebox();
}
function onKeyPressed( code, key )
{
if ( key == "r" )
{
setTimer( 0.05 );
Jukebox_Window.visible = Jukebox_Window.visible - 1;
GraalControl.makeFirstResponder( true );
}
}
function onWeaponFired()
{
say2( "Press 'r' to toggle jukebox!" );
}
function showJukebox()
{
playing = this.playing;
Jukebox_Window.destroy();
new GuiWindowCtrl( "Jukebox_Window" )
{
profile = "GuiBlueWindowProfile";
width = 280;
height = 120;
x = screenwidth - width;
y = screenheight - height;
canClose = canMinimize = true;
canMaximize = canResize = false;
visible = false;
text = "Jukebox for" SPC servername;
useownprofile = true;
profile.transparency = .9;
new GuiMLTextCtrl( "Jukebox_Text" )
{
profile = "GuiBlueTextProfile";
x = 10;
y = 30;
width = 270;
height = 20;
useownprofile = true;
profile.align = "center";
text = "<center>Now playing:" SPC playing;
}
new GuiPopUpMenuCtrl( "Jukebox_List" )
{
profile = "GuiBluePopUpMenuProfile";
width = 260;
height = 20;
x = 10;
y = 50;
textprofile = "GuiBlueTextListProfile";
scrollprofile = "GuiBlueScrollProfile";
clearRows();
temp.music = {
{ "SONG_NAME", "SONG_URL" },
{ "SONG2_NAME", "SONG2_URL" } ;
for ( temp.i = 0; temp.i < temp.music.size(); temp.i ++ )
{
with( addRow( 0, temp.music[temp.i][0] ) )
{
this.var = temp.music[temp.i][1];
}
}
setSelectedRow( 0 );
sort();
}
new GuiButtonCtrl( "Jukebox_Stop" )
{
profile = "GuiBlueButtonProfile";
width = 75;
height = 30;
x = Jukebox_Window.width / 2 - ( width / 2 );
y = Jukebox_Window.height - 40;
text = "Stop Music";
}
}
stopmidi();
this.playing = "[None]";
Jukebox_Text = "Now playing: [None]";
}
function onTimeOut()
{
this.time += .05;;
setTimer( 0.05 );
}
function Jukebox_Stop.onAction()
{
stopmidi();
this.playing = "[None]";
Jukebox_Text = "Now playing: [None]";
}
function Jukebox_List.onSelect()
{
if ( this.time > 0 )
{
this.playing = params[1];
Jukebox_Text.text = "Now playing:" SPC params[1];
play( Jukebox_List.rows[params[2]].var );
}
}
function onPlay( title, song )
{
this.playing = title;
Jukebox_Text.text = "Now playing:" SPC title;
play( song );
}
Please leave feedback, my first released script.