TIP : OnAir DJ

Want to show which DJ is on-air (either in Automation or LiveAssist) ?

Here’s a script to run (or schedule) that’ll create a PHP file which can then be auto FTP’d to your website. I use AutoFTP for this - it monitors my “nowplaying” folder for modified files and uploads the contents each time it detects a change.

[code]var sl: TStringList;
begin
sl := TStringList.Create;
sl.Add(’’);
sl.SaveToFile(‘S:\nowplaying\imagename.php’);
sl.Free;

sl := TStringList.Create;
sl.Add(‘Drivetime with Charlie’);
sl.SaveToFile(‘S:\nowplaying\showname.php’);
sl.Free;

SystemLog(‘OnAir - Charlie… done!’);

end.[/code]

Then, using a PHP Include, you can display those 2 files anywhere on your website:
<?php include("imagename.php"); ?>

Quite simple, but very powerful if you don’t want the hassle of notifying your web team each time a DJ covers a show 8) Your presenters can either drag and drop the script from the Browser, or it can be scheduled to run via your Music Scheduler.

I freely admit I have no clue about PHP, so my apologies in advance if this is a Really Dumb Question:

I run a Web site hosted on a Windows Server, so that I can use server-side ASP scripting. Is that kind of (Windows) Web host likely/unlikely to also support and allow me to use this ‘PHP’ malarkey?

PS: It’s a Fasthosts-hosted site if that helps; the site is also nothing to do with radio!

BFN
CAD

No, I don’t think you’ll be able to. I have some basic webspace courtesy of my ISP and it’s not a PHP server - If you attempt to view the PHP file on that server, it simply presents the file’s contents (just like a text file would appear). However, I DO use it to store my PHP files during testing, simply because the FTP transfer is instant and my main webhost seems to have a really large FTP delay which throws my FTP software.

Just upload a file named “phpinfo.php” with the following content:

<? phpinfo(); ?>

As Charlie explained, if your server is PHP enabled, this will be executed, and you’ll see a nice status report about the PHP version and the installed modules. If the server does not support PHP, you will only see the source code.

As far as I know, PHP is available for IIS, so there’s a good chance that your server might support it.

btw, I found this page: http://www.fasthosts.co.uk/productKB/default.asp?article=Fasthosts/PHP

Torben

All of the products listed here http://www.fasthosts.co.uk/hosting/ are said to support PHP.

Thanks for the tip, Torben: I just added that file and the answer is ‘yes.’

HOWEVER

I’ve since looked at a PHP site to learn a little about PHP, and I have to say I’ve formed an instant loathing of it because it looks WAY too much like L—x for me, with the typical unnecessarily tortuous syntax those guys seem to like. Presumably PHP was conceived by the EMACS authors, or the bloke who devised so-called ‘regular’ expressions?!! :wink:

In general, I’ll definitely stick to ASP and VBScript: MUCH easier to write and MUCH easier to understand! But at least I now know that I can use Charlie’s simple bit of PHP if I ever want or need to.

BFN
CAD

The syntax is very much like Perl, and also a little like C. I personally prefer PHP over ASP, because it’s platform independent. And open source. And …

And I love regular expressions. At least I love writing and using them, not debugging them when a problem pops up a year later :wink: I did just a quick grep. There are 43 regular expressions used in the current source code of mAirList - what would mAirList be without them? :wink:

(WAY off topic now, but … !)

Didn’t we agree some months ago that you are one of those guys who prefers C, Pascal, grep (shudder!), PHP, L—x, etc.; and I am one of those guys who loathes all those things passionately, and prefers Visual Basic, Windows, ASP, COBOL, and so forth? ;D

Regular expressions are actually ‘middle ground,’ because VERY occasionally I am forced to use them. :’( This usually results in about an hour of reading how regexps work (AGAIN) and trying lots and lots of regexp strings until I eventually hit upon the one that does what I require. The very basic parts of the regexp ‘standard’ make sense, but most of it is utterly counter-intuitive.

PS: Like all right-minded individuals, I DO detest Windows Vista (nearly as much as I loathe L—x!).

BFN
CAD

Hi,

Can you just explain to me how this script works, I’m a bit confused (not hard, but it still is annoying :-\ )?

Thanks

Earl

It simply creates two PHP files with the name of the show and a link the picture of the guy doing it :wink:

The most simple way to create text files from within a script is to create a TStringList object, add lines with the Add() method, and finally save it to disk with the SaveToFile() method. Don’t forget to call Free at the end, or the object remains in memory.

The last line writes a status message to the log at the bottom of the mAirList main window.

It creates a file featuring HTML code that displays text and/or an image which can then be displayed on your station’s website. You then display each PHP file using a PHP Include statement - Your current song can also be written to a PHP in a similar way (see my previous posts for examples)… For example:

Welcome to my radio station - You are listening to <?php include("showname.php"); ?>, and we’re currently
playing <?php include("nowplaying.php"); ?>.

When that’s served-up by a user’s web-browser, they’ll see:

Welcome to my radio station - You are listening to Drivetime with Charlie, and we’re currently playing Duffy - Mercy.

The OnAir DJ script at the top of this thread is saved as “your chosen script name.mls” and then activated by either: Adding it to the Actions menu, Open-Run Script, or dropping it into a Playlist from the Browser (you’ll need to add MLS as an additional extension in the mAirList Config program).

Earl: If it’s the syntax within the script that you’re wondering about, the mAirList scripting language is a subset of Delphi (i.e. Pascal), and is provided by a component whose name escapes me. If you’re familiar with either of those, or Java, you should have no problems figuring out how mAirList script language works.

I do recall that despite a search, I couldn’t find a full reference document for the scripting component Torben uses, so I usually start at http://www.delphibasics.co.uk and try out what it suggests. If something documented there ‘does nothing’ or more likely causes an error when included in a mAirList script (like the ShowMessage or With statement, for example), I simply presume it’s not supported by the component and code around that.

Sorry in advance if that’s not what you meant!

BFN
CAD

Hi Guys,

Thanks for that, I understand a bit better about what it’s doing, does it have the ability to know what DJ is playing automatically, or does the script need to be edited to hold the correct name and such?

Sorry if I’m being a pain, tell me to shut up if you want ::slight_smile: !

Earl

Earl,
You need this script in order to manage the “now playing” part. Simply load that script as a Notification Script (under mAirListConfig) and it’ll create a file called nowplaying.php each time a track is started in a Playlist. Using the AutoFTP program (link at the top of this thread), that file is then copied to your website.

Hi Charlie!

Thanks for that! I’ve now gotten round the concept!! Whoo hoo!!

Earl T

(shouldn’t there be another e in Morcambe?!!)

Earl: all radio stations use similar methods to the notification script and auto-upload featured here, invariably feeding a WWW page with either PHP or ASP content in it; which will dynamically generate/update the page using the information uploaded ‘automagically’ by the playout software. :slight_smile:

BFN
CAD