PDA

View Full Version : [USEFUL] DJ On Air Script



James
03-14-2011, 12:23 PM
Heres a script i had developed for a local radio station. I thought i might as well share it with Broadcasting World too!

It requires you simply to enter your DJ Schedule Data (Img, Title & Sub) and for you to change your timezone. Here (http://php.net/manual/en/timezones.php) is a list of timezones supported for this web app!

nowon.php

<?php

putenv("TZ=Australia/Melbourne");
$h = date('G');
$d = date('w');

putenv("TZ=Australia/Melbourne");


// Sunday
if ($d == 0 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 0 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 0 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 0 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 0 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}


// Monday
if ($d == 1 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 1 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 1 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 1 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 1 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}


// Tuesday
if ($d == 2 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 2 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 2 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 2 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 2 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}


// Webnesday
if ($d == 3 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 3 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 3 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 3 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 3 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}


// Thursday
if ($d == 4 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 4 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 4 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 4 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 4 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}


// Friday
if ($d == 5 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 5 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 5 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 5 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 5 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}


// Saturday
if ($d == 6 && $h >= 0 && $h < 6) { // Show Runs From Midnight til 6am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 6 && $h >= 6 && $h < 10) { // Show Runs From 6am til 10am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 6 && $h >= 10 && $h < 11) { // Show Runs From 10am til 11am
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 6 && $h >= 11 && $h < 12) { // Show Runs From 11am til Midday
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}
elseif ($d == 6 && $h >= 12 && $h < 13) { // Show Runs From Midday til 1pm
$img = 'image.jpg'; //Image Source
$title = 'Tunes'; //Show Title
$sub = 'All Night'; // Short Description
}

echo'<div style="text-align: center;"><img src="' . $img . '"></div><br>
<div style="padding-left: 5px; padding-bottom: 5px; font-size: 12px;"><b>' . $title . '</b><br><i>' . $sub . '</i></div>';

?>

Let me know how you go :)

ANTiX
03-15-2011, 02:32 AM
Wow, this looks amazing.
Thank you for it! :D
+repped

-ANTiX

digitalhunter
03-15-2011, 06:59 AM
Thanks for that James! It works great as a module on Vbulletin. Certainly gonna have a play with it.
+Rep

Gem]n[
05-02-2011, 12:33 AM
James ... great script ...

i have all the DJs time slots entered ok ... and send out to 3 TXT files for flash to pick up ... it all works brilliantly until 10pm at night and for some unknown reason as soon as it hits the 9pm or 10pm slot, at night (UK time), i get nothin shown ... I don't know why ...

i have a PHP file called dj.php that has your script in and when it is processed it dumps the DJ info (DJ name) (DJ show) (DJ staus - Live, Recorded or Stream) to the 3 seperate TXT files ... flash then grabs the info from the TXT files and displays that on the website and in the chatroom ...

the flash SWF is only a few kb in size and works fine ... it's just the script that seems to cause a fault ...

i'm also new to PHP and lovin it ... especially as I'm more of a Flash designer ...

EDIT:
Ok here is exaclty what the script does ...

Works throughout the day perfectly then come 10pm at night (UK time) it displays nothing ... variables seem blank and display info displays nothing at all ... until when 12am in the morning come (2hrs later) then the display info goes back to displaying the correct info again ... then its fine throught the day again until 10pm again ...

So for the 2hrs (10pm -12am) it displays nothing ... I am stumped ...

cheers,
Gem
:)

garybaldy72uk
08-04-2011, 10:15 PM
Try this Topic a much simpler script is Posted on there all you have to do is change/add times in 24 hr format and the picture links!

http://forums.broadcastingworld.net/showthread.php?9521-Would-this-be-Possible

Hope that Helps

ATHR
12-28-2011, 05:44 PM
anything without PHP?

MarcAlle
12-28-2011, 07:43 PM
anything without PHP?

PHP is really the way to go. Almost anyone can learn it, or at least "poke" their way around it to get it to do what you want it to. What are you looking for? ASP? ColdFusion?

ATHR
12-29-2011, 07:59 AM
my website doesn't support PHP so I'm stuck with HTML and Javascript

MarcAlle
12-29-2011, 01:25 PM
my website doesn't support PHP so I'm stuck with HTML and Javascript

You're not going to find anything like what you want that is not in PHP or a similar language. HTML is purely visible and Javascript will bog your site down if something is written in that. Maybe you could have a Java applet developed. My suggestion is to find a host that has cPanel as it is, in my opinion, the best control panel for beginners. If you have a cPanel host, you'll be able to support PHP!

shoutcaststreaming
12-29-2011, 03:56 PM
If you have a cPanel host, you'll be able to support PHP!
Any server can support PHP. No need for cPanel. Find another host to get your server from.

MarcAlle
12-29-2011, 10:51 PM
Any server can support PHP. No need for cPanel. Find another host to get your server from.

I know that, I was simply stating that I recommend cPanel, especially for beginners!

Elvisn
08-31-2012, 05:01 PM
Thanks for that!

Regards,
Elvis

djultra89
12-18-2012, 02:38 PM
hi there does anyone have a script for a dj center were
you can put an image in the script for dj center,
then login to the center using name and pass for example
epicfm.co.uk:80 then you put a username and pass in there

then once logged in each DJ can upload there banner or image to
a media player on through an on air php script so
say if i were to go on air i would login to the dj center upload
my image/banner then it would be on there?

please check out www.106themix.com and look at there players
they have a banner/image ontop there media players but i would like to do it through
a php on air script of possible but if not through what i have just said

djultra89
12-22-2012, 12:23 AM
hi there im wondering if you're on air script would work
with this script

<center>
<table cellspacing="3" cellpadding="3" bordercolor="#000000" border="3" bordercolorlight="#DBEDFF" bordercolordark="#5B7997">
<tbody>
<tr>
<td>
<table cellspacing="3" cellpadding="3" bordercolor="#000000" border="3" bordercolordark="#5B7997" bordercolorlight="#DBEDFF">
<tbody> <div align="center"><a href="http://www.106themix.com/onairinfo/playlist.php" target="_blank"> <img style="border: 0pt none;" src="http://img.photobucket.com/albums/v717/imapeach21465/req1.png" onmouseover="this.src='http://img.photobucket.com/albums/v717/imapeach21465/req2.png'" onmouseout="this.src='http://img.photobucket.com/albums/v717/imapeach21465/req1.png'" alt=""></a>


<a href="http://www.106themix.com/djs.html" target="_blank"> <img style="border: 0pt none;" src="http://img.photobucket.com/albums/v717/imapeach21465/dj1.png" onmouseover="this.src='http://img.photobucket.com/albums/v717/imapeach21465/req2.png'" onmouseout="this.src='http://img.photobucket.com/albums/v717/imapeach21465/dj1.png'" alt=""></a> </div>
<tr>
<td> <IMG src="http://www.106themix.com/onairinfo/images/logo.gif" width="350" height="155" border="1" name="refresh">
<script language="JavaScript" type="text/javascript">
<!--
var t = 120 // interval in seconds
image = "http://www.106themix.com/onairinfo/images/logo.gif" //name of the image
function Start() {
tmp = new Date();
tmp = "?"+tmp.getTime()
document.images["refresh"].src = image+tmp
}
Start();
// -->
</SCRIPT> <br />
<embed volume="-1100" showstatusbar="1" autostart="true" src="http://www.106themix.com/listen.m3u" name="MediaPlayer" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" type="application/x-mplayer2" width="350" height="63"></td>
</tr>
</tbody>
</table>
</center> </td>
</tr>
</tbody>
</table>

please help

Zerothe
12-22-2012, 01:30 AM
Thanks for that!

djultra89
12-23-2012, 07:35 PM
not a problem Zerothe and um do u know how i can get hold of a dj center

DannyCreggan
01-06-2013, 07:17 PM
Hello, great script! is there anyway that i can display the show name at the side of the image and not under it?

cloudm
01-31-2013, 09:26 PM
Thanks, James, it's a very useful script. Could you or anyone else add minutes to the script? I mean, we have some shows that ends 7:30, or 9:25, and I can't figure it out by myself. Help would be very appreciated, thanks!

Simon

dazle
10-15-2013, 12:08 PM
Great script thanks!!!

Realmmaster
11-15-2013, 03:07 PM
Thanks for that James!

djultra89
11-28-2013, 02:14 PM
hi there the top bit of you're script is set for a different country, and im in the UK GMT Time
what shall i put in this part <?php

putenv("TZ=Australia/Melbourne");
$h = date('G');
$d = date('w');


putenv("TZ=Australia/Melbourne"); as like i say im in england GMT Time



and also i wanna go live on the air from 4pm till 6pm GTM

how does that work.........

elseif ($d == 3 && $h >= 14 && $h < 16) { // Show Runs From Midday til 6pm

djultra89
01-29-2014, 04:31 PM
Anyone know were I can a script for a dj schedule were I can add the times that the djs are on. And there images, also I would like it to change automatically everytime a dj goes on the air and when they go off the air and changes back to the autodj image? Any help

rewindingtheyears
02-27-2014, 08:13 PM
hi,


i can get this script to work until i change the time zone i am in the uk and need the timezone to change can anyone help please

rty

MarcAlle
02-28-2014, 12:14 PM
Just change the timezone. Where it says:
Australia/Melbourne

Change that to your timezone based on the PHP Timezone List.

garybaldy72uk
02-28-2014, 01:27 PM
For the UK you need to change the timezone set to.


Europe/London

djaubs89
07-16-2017, 04:20 PM
i'm getting stuck with this part echo'<div style="text-align: center;"><img src="' . $img . '"></div><br><div style="padding-left: 5px; padding-bottom: 5px; font-size: 12px;"><b>' . $title . '</b><br><i>' . $sub . '</i></div>';

please help

James
07-16-2017, 10:59 PM
i'm getting stuck with this part echo'<div style="text-align: center;"><img src="' . $img . '"></div><br><div style="padding-left: 5px; padding-bottom: 5px; font-size: 12px;"><b>' . $title . '</b><br><i>' . $sub . '</i></div>';

please help

Please provide some more detail. What bit are you stuck on specifically? What are you trying to achieve vs what is it doing? That line of code looks fine to me.

Also, please use the CODE tags when embedding code in posts for easier reading.

djaubs89
07-22-2017, 05:12 PM
ok so i'm meant to be on air friday saturday and sunday? but my picture is not showing up, please help

// FRIDAY SCHEDULE
if ($d == 5 && $h >= 0 && $h < 4) $img = '/images/jukebox.gif';
else if ($d == 0 && $h >= 19 && $h < 24) $img = '/images/jukebox.gif';
else if ($d == 1 && $h >= 14 && $h < 16) $img = '/images/jukebox.gif';
else if ($d == 2 && $h >= 16 && $h < 18) $img = '/images/jukebox.gif';
else if ($d == 3 && $h >= 18 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 4 && $h >= 20 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 5 && $h >= 18 && $h < 20) $img = '/images/strawbs.jpg';
else if ($d == 6 && $h >= 0 && $h < 2) $img = '/images/jukebox.gif';








// SATURDAY SCHEDULE
else if ($d == 0 && $h >= 0 && $h < 4) $img = '/images/jukebox.gif';
else if ($d == 1 && $h >= 19 && $h < 24) $img = '/images/jukebox.gif';
else if ($d == 2 && $h >= 18 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 3 && $h >= 18 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 4 && $h >= 18 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 5 && $h >= 18 && $h < 20) $img = '/images/strawbs.jpg';
else if ($d == 6 && $h < 0) $img = '/images/jukebox.gif';








// SUNDAY SCHEDULE
else if ($d == 0 && $h >= 0 && $h < 4) $img = '/images/jukebox.gif';
else if ($d == 1 && $h >= 23 && $h < 24) $img = '/images/jukebox.gif';
else if ($d == 2 && $h >= 10 && $h < 14) $img = '/images/jukebox.gif';
else if ($d == 3 && $h >= 14 && $h < 16) $img = '/images/jukebox.gif';
else if ($d == 4 && $h >= 16 && $h < 18) $img = '/images/jukebox.gif';
else if ($d == 5 && $h >= 18 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 6 && $h >= 23 && $h < 24) $img = '/images/jukebox.gif';
else if ($d == 0 && $h >= 18 && $h < 20) $img = '/images/strawbs.jpg';
else if ($d == 0 && $h < 0) $img = '/images/jukebox.gif';



see were it says strawbs

PapaBearPW
07-22-2017, 08:54 PM
For each day, you keep checking for different days...For example your Friday block:



// FRIDAY SCHEDULE
if ($d == 5 && $h >= 0 && $h < 4) $img = '/images/jukebox.gif';
else if ($d == 0 && $h >= 19 && $h < 24) $img = '/images/jukebox.gif';
else if ($d == 1 && $h >= 14 && $h < 16) $img = '/images/jukebox.gif';
else if ($d == 2 && $h >= 16 && $h < 18) $img = '/images/jukebox.gif';
else if ($d == 3 && $h >= 18 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 4 && $h >= 20 && $h < 20) $img = '/images/jukebox.gif';
else if ($d == 5 && $h >= 18 && $h < 20) $img = '/images/strawbs.jpg';
else if ($d == 6 && $h >= 0 && $h < 2) $img = '/images/jukebox.gif';


You should only be checking the day ($d) once for each daily schedule. Plus your hours are all over the place and you should not have a / before the images urls. So it should look more like:



// FRIDAY SCHEDULE
if ($d == 5){
if($h >= 0 && $h < 4) $img = 'images/jukebox.gif'; // Covers Friday from 00:00 until 04:00
else if ($h >= 4 && $h < 5) $img = 'images/jukebox.gif';// Covers Friday from 04:00 until 05:00
else if ($h >= 5 && $h < 6) $img = 'images/jukebox.gif';// Covers Friday from 05:00 until 06:00
else if ($h >= 6 && $h < 7) $img = 'images/jukebox.gif';// Covers Friday from 06:00 until 07:00
else if ($h >= 7 && $h < 8) $img = 'images/jukebox.gif';// Covers Friday from 07:00 until 08:00
else if ($h >= 8 && $h < 9) $img = 'images/jukebox.gif';// Covers Friday from 08:00 until 09:00
else if ($h >= 9 && $h < 10) $img = 'images/strawbs.jpg';// Covers Friday from 09:00 until 10:00
else if ($h >= 10 && $h < 11) $img = 'images/jukebox.gif';// Covers Friday from 10:00 until 11:00
else if ($h >= 11 && $h < 12) $img = 'images/jukebox.gif';// And so on down
else if ($h >= 12 && $h < 13) $img = 'images/jukebox.gif';
else if ($h >= 13 && $h < 14) $img = 'images/jukebox.gif';
else if ($h >= 14 && $h < 15) $img = 'images/jukebox.gif';
else if ($h >= 15 && $h < 16) $img = 'images/jukebox.gif';
else if ($h >= 16 && $h < 17) $img = 'images/jukebox.gif';
else if ($h >= 17 && $h < 18) $img = 'images/jukebox.gif';
else if ($h >= 18 && $h < 19) $img = 'images/jukebox.gif';
else if ($h >= 19 && $h < 20) $img = 'images/jukebox.gif';
else if ($h >= 20 && $h < 21) $img = 'images/jukebox.gif';
else if ($h >= 21 && $h < 22) $img = 'images/jukebox.gif';
else if ($h >= 22 && $h < 23) $img = 'images/jukebox.gif';
else if ($h >= 23 && $h < 24) $img = 'images/jukebox.gif';
}


Check your PMs. I'll send you something to try.

djaubs89
08-28-2017, 09:11 PM
i do 6pm till 8pm could you put that in the script for me please