php - TXT

Ask questions, request features, or just complement us about our software and services.
Post Reply
DJgawd
Posts: 9
Joined: Sat Jul 16, 2005 9:46 pm

php - TXT

Post by DJgawd »

First off Id like to thank you for creating such an excellent utility to work with shoutcast... works perfect..

Now.. Would it possible to make it Update a .txt file with song info and radio station info in this way? at the same time the PHP file is updated.

Code: Select all

&songvar=song name&
Doing this will make it very easy to stream Station/song data right into a flash file, thus making things easier and can customize the way it looks with endless posibilities
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

if the txt file will be on the server you can use the FTP feature to do this. Just would have to parse out the copyright notices in your flash object.
- Jay
DJgawd
Posts: 9
Joined: Sat Jul 16, 2005 9:46 pm

Post by DJgawd »

with help from a friend I have actually figured out a solution,

My web radio is up and the example is here http://69.47.6.217/php/statustest.html

this is a private radio server, for testing purposes right now

As you can see it displays the current song, soon it will display other stuff, like Last songs played and so fourth.

When im finished i can put a little tutorial for those wanting to do somthing like this if you'd like
User avatar
Jay
Will work for food (Administrator)
Posts: 3020
Joined: Mon Jan 14, 2002 12:48 am
Location: Next Door
Contact:

Post by Jay »

sounds good. Thanks
- Jay
DJgawd
Posts: 9
Joined: Sat Jul 16, 2005 9:46 pm

Post by DJgawd »

Im posting this because I havnt seen any Tut\'s about this issue. My first Tutorial, bare with me

TUTORIAL: How to stream SHOUTcast Web radio information into a Swish, flash movie.

REQUIREMENTS: Swishmax, SHOUTcast, RadioToolbox, and a Web host that supports PHP

This Is assuming you already know how to use Radio Toolbox with Shoutcast , basic knowledge of PHP. and how to create a Dynamic Text or Input Box

Here we Go:

STEP ONE: Create another .php doc in the same directory as includes.php (where Radiotoolbox stores its PHP files), Lets name the .php file \"extras.php\"

STEP TWO: in the PHP file you just created put the following:

Code: Select all

<?php
include (\"includes.php\");
$current_song = $current_song;
echo \"¤t_song=\".$current_song;

$lastsong[1] = $lastsong[1];
echo \"&last_song=\".$lastsong[1];

$server[0][\'listeners\'] = $server[0][\'listeners\'];
echo \"¤t_listen=\".$server[0][\'listeners\'];
?>
The contents of this file will be Explained Later.

STEP THREE: Now Open SwishMAX and create a new blank movie.
STEP FOUR: Make 3 Static Text Boxes in the first one Put \"Current Song\" in the second one put \"Listeners\" and in the third put \"Last Song\". Line them up one on top of the other. Like this
Current song
Listeners
Last Song
STEP FIVE: Create 3 \"dynamic\" text Boxes, all with a differant name. In the First text box Set the Variable text to say \"current_song\" (MUST be differant than the NAME of the Dynamic Text Box) in the second dynamic text box put \"current_listen\" and the third put \"current_listen\"
STEP SIX: in the script for the \"Scene\" put the following:

Code: Select all

onFrame (1) {
   _root.loadVariables(\"extras.php\",\'GET\');
}
This will load the Variables from the PHP file and place the results in the Dynamic Text Boxes. All PHP and .swf files MUST be in the same directory for this to work. You can now test to see if it is loading correctly by uploading your .swf file and PHP files (includes.php, extras.php) onto your host.

OK... Now that thats done lets look at Refreshing the .swf so that it will update the song, listeners, and last song every so so seconds.

STEP SEVEN: Create a new .html doc, wither with notepad or your favorite HTML editor (i use dreamweaver) and name it \"status.html\"
STEP EIGHT: Put the folloing code in the HEAD of the document:

Code: Select all

<meta http-equiv=refresh content=\"30; http://yourdomain.com/status.swf\">
EDIT the path to your .swf file... The \"30\" tells the web page how many seconds befor it should refresh.


Now place the following code in the BODY of the HTML doc, anywhere you want the SWF to show.

Code: Select all

<iframe src=\"http://yourdomain.com/status.swf\" height=\"105\" width=\"369\" scrolling=\"no\" frameborder=\"0\"></iframe></embed>
      Again, edit the path to your .swf file... Also edit the Proportions of the iframe with the same propotions of the .swf file. (width, Height)
Now upload your .html doc and test it out. Make sure your SHOUTcast server is on at the time, along with RadioToolbox, so you can test if the content in the SWF is updating correcty.

Im sure you can use this same type of method for other flash programs such as Flash MX

SOrry im not too good with words I hope I explained everything I should have and clearly.
DJgawd
Posts: 9
Joined: Sat Jul 16, 2005 9:46 pm

Post by DJgawd »

hmm, the forum changed a few unwanted things automatically, I also posted this at www.swish-db.com, if you are confused

http://www.swish-db.com/forum/index.php?showtopic=18353

Heres another Example, Result of this method of putting into Flash
http://69.47.6.217/CDstats.html - a project im doing for CD Radio

Also, the refresh method I used here doesnt quite work right for people useing FireFox Web Browser. Ill have a fix for that soon
Post Reply