Old 24th March 2003, 22:02   #1
lsuperguy
Junior Member
 
Join Date: Aug 2002
Posts: 21
Send a message via ICQ to lsuperguy Send a message via AIM to lsuperguy
Festerhead's Signature

How do you do that with your signature Festerhead? I would like to do that with my station as well.

Thanks,
Mike
lsuperguy is offline   Reply With Quote
Old 24th March 2003, 22:30   #2
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
I no longer grab the XML statistics from a DNAS.

Instead, I query my SAM2 (Streaming Audio Manager) which keeps the station data in a MySQL database.

My home page at http://www.festerhead.com is comprised of various SQL statements and the corresponding output.

Likewise, my signature (inspiration from Jay (KXRM)) is some PHP code that queries the database and outputs an image.

code:

<?php

header("Content-Type: image/png");

require("database-configuration-file");

$SAMdb->open("SELECT songlist.artist,
songlist.album,
songlist.title
FROM songlist,
historylist
WHERE historylist.songID = songlist.ID
ORDER BY historylist.date_played DESC
LIMIT 1");

$song = $SAMdb->row();

$im = imagecreate (300, 27);
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);

imagestring ($im, 1, 1, 0, "Artist: ".$song['artist'], $tc);
imagestring ($im, 1, 6, 9, "Album: ".$song['album'], $tc);
imagestring ($im, 1, 11, 18, "Song: ".$song['title'], $tc);

ImagePNG($im);

?>


You can do the same thing.
Grab your DNAS XML statistics and place the current playing artist/album/title in place of $song['artist'], $song['album'], and $song['title'] respectively.
Of course, you'll need to remove the database code.

For reference on the PHP functions above, please see http://www.php.net

FesterHead is offline   Reply With Quote
Old 25th March 2003, 23:15   #3
AlbanyGreatDane
Junior Member
 
Join Date: Mar 2003
Location: Long Island, NY
Posts: 26
XML? PHP? SQL?

I consider myself slightly computer savy and I'm kinda new to this Shoutcasting thing but the reply festerhead gave above seems VERY over my head comprehension wise to me and probably to a bunch of other people too. I'd like to have a signature like he does but I don't at all understand the above responce by festerhead. Can someone post links where I can read up on this 'coding' stuff? Do I need to be an HTML expert to understand this kind of stuff?
AlbanyGreatDane is offline   Reply With Quote
Old 26th March 2003, 01:33   #4
jesseg
Senior Member
 
jesseg's Avatar
 
Join Date: Mar 2002
Location: Minneapolis
Posts: 234
http://www.viralsound.com/

Free easy to make, integrates with winamp 2 and 3, and windows media player. Its where my sig comes from.

Last edited by jesseg; 26th March 2003 at 02:24.
jesseg is offline   Reply With Quote
Old 26th March 2003, 02:18   #5
Jay
Moderator Alumni
 
Jay's Avatar
 
Join Date: May 2000
Location: Next Door
Posts: 8,942
nah just use php, it's easier, the method of getting data from the shoutcast server to the webserver you serve the image from is up to you, I use my application Radio Toolbox. Btw jesseg is that breasts in your image? I believe that will get your sig removed if it is.
Jay is offline   Reply With Quote
Old 26th March 2003, 02:24   #6
jesseg
Senior Member
 
jesseg's Avatar
 
Join Date: Mar 2002
Location: Minneapolis
Posts: 234
hehehe, i know... (and i removed it) just making an example. that's why i dont usually have my sig turned on
jesseg is offline   Reply With Quote
Old 26th March 2003, 17:14   #7
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
My answer may seem over the top, but with a little reading, exploring, investigating, and trial-and-error, you'll soon understand every word

The FAQ has everything you need to know on how to grab and manipulate the XML from the DNAS.

http://www.php.net has everything you need to know about PHP.

FesterHead is offline   Reply With Quote
Old 26th March 2003, 21:52   #8
DJRampage
Junior Member
 
Join Date: Jun 2002
Location: Netherlands
Posts: 17
You can also use the script I use.
I put it up here: www.lunchbreak.net/rampageradio/black.txt

Copy it all in your php-file and then just change the things I point out in the script, play around with colours and positioning, etc...

Might save you some time searching around...
DJRampage is offline   Reply With Quote
Old 26th March 2003, 22:00   #9
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Excellent!

FesterHead is offline   Reply With Quote
Old 26th March 2003, 22:04   #10
DJRampage
Junior Member
 
Join Date: Jun 2002
Location: Netherlands
Posts: 17
No problem
I just finished it this evening using the php-manual and all, when I stumbled upon this post.
DJRampage is offline   Reply With Quote
Old 27th March 2003, 00:25   #11
Jay
Moderator Alumni
 
Jay's Avatar
 
Join Date: May 2000
Location: Next Door
Posts: 8,942
one thing you might do to that script is have it do some caching the more and more you use this image on the net and the more people who view it, the more your server is going to hammered with requests.
Jay is offline   Reply With Quote
Old 27th March 2003, 07:57   #12
DJRampage
Junior Member
 
Join Date: Jun 2002
Location: Netherlands
Posts: 17
You're right, I added the comments to the script.
(and changed it for myself as well, so now the picture
only updates if someone visits my homepage... )
Thanks.
DJRampage is offline   Reply With Quote
Old 27th March 2003, 21:19   #13
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
FYI: I used portions of your script to modify mine for dynamic width

Now, the image is only as wide as necessary.

code:

// Build the artist, album, song strings
$artistString = "Artist: ".$song['artist'];
$albumString = " Album: ".$song['album'];
$songString = " Song: ".$song['title'];

// Initialize the length
$maxStringSize = 0;

// Bubble the longest string length to maxStringSize
if (strlen($artistString) > $maxStringSize)
$maxStringSize = strlen($artistString);
if (strlen($albumString) > $maxStringSize)
$maxStringSize = strlen($albumString);
if (strlen($songString) > $maxStringSize)
$maxStringSize = strlen($songString);

// Build the image length at 5 pixels per character in the longest string
$imageWidth = 5 * $maxStringSize;

// Create the image
$im = imagecreate ($imageWidth, 27);



Thanks for the inspiration

FesterHead is offline   Reply With Quote
Old 29th March 2003, 06:01   #14
MStar
Major Dude
 
MStar's Avatar
 
Join Date: Mar 2003
Location: Hardcore Heaven
Posts: 1,491
Send a message via ICQ to MStar Send a message via AIM to MStar Send a message via Yahoo to MStar
gak!

When I Try To Run It I Get
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in song.php on line 12

I attached the PHP File. (in txt form)
Can Someone Tell Me what i did Wrong?
Attached Files
File Type: txt song.txt (3.1 KB, 578 views)

MStar is offline   Reply With Quote
Old 29th March 2003, 07:31   #15
trib
Junior Member
 
Join Date: Aug 2002
Location: Netherlands
Posts: 5
Quick glance at the code

I see your code looks like this ...
code:
$fp = fsockopen("$host", $port, &amp;amp;$errno, &amp;amp;$errstr, 30);
---------------------------------^^^- whoops - ^^^
and also ...
$page = ereg_replace(".*&lt;body&gt;", "", $page);
------------------------ ^ again ^
ald several other places too.



that's the HTML from a page. Try substituting every occurrence of
&amp;amp; with &amp;
&lt; with <
&gt; with >

... then run it again and see what happens.
trib is offline   Reply With Quote
Old 29th March 2003, 19:12   #16
MStar
Major Dude
 
MStar's Avatar
 
Join Date: Mar 2003
Location: Hardcore Heaven
Posts: 1,491
Send a message via ICQ to MStar Send a message via AIM to MStar Send a message via Yahoo to MStar
Whoops!
I Thought I Got All Of Those...
DJRampage... You Should Make Your Code On A Txt File, Not A Webpage
Or It Gets HTML Formatting And Doesnt Work

MStar is offline   Reply With Quote
Old 29th March 2003, 19:20   #17
MStar
Major Dude
 
MStar's Avatar
 
Join Date: Mar 2003
Location: Hardcore Heaven
Posts: 1,491
Send a message via ICQ to MStar Send a message via AIM to MStar Send a message via Yahoo to MStar
Now /me Gets Parse Error On Line 87!
Attached Files
File Type: txt vu.txt (3.1 KB, 401 views)

MStar is offline   Reply With Quote
Old 29th March 2003, 20:07   #18
trib
Junior Member
 
Join Date: Aug 2002
Location: Netherlands
Posts: 5
Should be ?> not >
trib is offline   Reply With Quote
Old 29th March 2003, 22:24   #19
MStar
Major Dude
 
MStar's Avatar
 
Join Date: Mar 2003
Location: Hardcore Heaven
Posts: 1,491
Send a message via ICQ to MStar Send a message via AIM to MStar Send a message via Yahoo to MStar
Well, i get no errors, but it doesnt load either!
http://members.lycos.co.uk/fscomm/vu.php

MStar is offline   Reply With Quote
Old 30th March 2003, 06:32   #20
trib
Junior Member
 
Join Date: Aug 2002
Location: Netherlands
Posts: 5
does Lycos permit (or even support) PHP ?
trib is offline   Reply With Quote
Old 30th March 2003, 19:26   #21
MStar
Major Dude
 
MStar's Avatar
 
Join Date: Mar 2003
Location: Hardcore Heaven
Posts: 1,491
Send a message via ICQ to MStar Send a message via AIM to MStar Send a message via Yahoo to MStar
Lycos FR/UK Does. I Host My PhpBB2 Forums On There, Phpnuke Too.

MStar is offline   Reply With Quote
Old 30th March 2003, 21:40   #22
DJRampage
Junior Member
 
Join Date: Jun 2002
Location: Netherlands
Posts: 17
Quote:
Originally posted by MStar
Whoops!
I Thought I Got All Of Those...
DJRampage... You Should Make Your Code On A Txt File, Not A Webpage
Or It Gets HTML Formatting And Doesnt Work
I believe it is a text-file...
Even when I watch the file in my browser and save it from there (or look at the source) it doesn't convert the '<' to '&lt;'-s. So I don't know exactly what caused this to you. It may be different with other browsers.
DJRampage is offline   Reply With Quote
Old 18th April 2003, 14:18   #23
Soul Manager
Junior Member
 
Join Date: Jul 2002
Posts: 7
Send a message via ICQ to Soul Manager
I'm trying to get this thing to work, but when I load the html file that calls the php file I get a broken image icon. When I try loading the php file itself, I get this error:

Fatal error: Call to undefined function: imagecreate() in /var/www/foros.edicion-limitada.com/status.php on line 36

Do I need a special library to get php to generate images?

Thank you for your support!

Regards,

Soul Manager
Soul Manager is offline   Reply With Quote
Old 18th April 2003, 16:59   #24
Tom
Moderator
 
Join Date: Apr 2000
Posts: 4,491
Quote:
Originally posted by Soul Manager

Do I need a special library to get php to generate images?
Yes, you need GD.

Tom
Tom is offline   Reply With Quote
Old 18th April 2003, 17:35   #25
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
I use Apache/PHP for Windows. Your mileage may vary.

Check out your php.ini file. Look for the section titled "Windows Extensions" and uncomment the following line:
extension=php_gd.dll

FesterHead is offline   Reply With Quote
Old 19th April 2003, 06:42   #26
Soul Manager
Junior Member
 
Join Date: Jul 2002
Posts: 7
Send a message via ICQ to Soul Manager
Thanks for your help guys, I already installed the GD libraries for PHP and this thing is working as a charm, now I am trying to be more ambitious...

I am pretty aware that this isn't a PHP forum, and that if you guys decide to help me, your help may be a bit far from the scope of this forum, so I really appreciate if you can just show me the light with this question.

I want the image generated to be a one line image, not displaying the information on different lines but the information I want in a single line, like a ticker. I am interested only in showing the "Now Playing:" thing plus "name of the song" and "by Artist". As this information changes from song to song, how can I make the width of the image dynamic, I mean, as long as it needs to be to allocate the information. I've tried all that I could, but it didn't worked.

Here's a display of how my image is looking now:



Your help will be, as usual, much appreciated!

Regards,

Soul Manager
Soul Manager is offline   Reply With Quote
Old 19th April 2003, 06:50   #27
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Scroll up for dynamic image sizing.

For one line output, instead of
code:
imagestring ($im, 1, 1, 0, "Artist: ".$song['artist'], $tc);
imagestring ($im, 1, 6, 9, "Album: ".$song['album'], $tc);
imagestring ($im, 1, 11, 18, "Song: ".$song['title'], $tc);

you would use
code:
imagestring ($im, 1, 1, 0, "Artist: ".$song['artist']."Song: ".$song['title'], $tc);


FYI:
In place of
code:
$imageWidth = 5 * $maxStringSize;
I now use
code:
$imageWidth = 5 * $maxStringSize + 2;
Seems strings ending with 'm' get clipped

FesterHead is offline   Reply With Quote
Old 19th April 2003, 07:42   #28
Soul Manager
Junior Member
 
Join Date: Jul 2002
Posts: 7
Send a message via ICQ to Soul Manager
Festerhead

Thanks a lot for your help, as you can see, I still can't get the dynamic width thing to work on my image output, even if I use the variables as you said lines above, nothing appears.

According to the example I am using, based on DJ Rampage script, I should be using this:

$string1= "Transmitiendo en Edición Limitada:";
$string2= $song[1];
$string3= $song[0];
}
else {
$string1= "Nuestra transmision actualmente esta";
$string2= "OFFLINE.";
$string3= "Por favor intentalo luego nuevamente.";
}

$imageWidth = 5 * ($string1 + $string2 + $string3) + 6;

And now, all that I am getting is a 3 pixel width image... what am I doing wrong?



Thank you for your help!
Soul Manager is offline   Reply With Quote
Old 19th April 2003, 09:21   #29
rgATL
Major Dude
 
Join Date: Feb 2003
Location: ATL, of course.
Posts: 724
hmm, i wish i knew what even a little of this means....maybe some time soon i will.....

lol,
rg.
rgATL is offline   Reply With Quote
Old 19th April 2003, 19:50   #30
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
You need to use the strlen function to return a string length.

Look at the example above closely

FesterHead is offline   Reply With Quote
Old 20th April 2003, 15:41   #31
Soul Manager
Junior Member
 
Join Date: Jul 2002
Posts: 7
Send a message via ICQ to Soul Manager
Festerhead

Thanks again for your support, but there's definitely something wrong in the lenght of the strings that the strlen function is getting from my strings. I can only get a short image that doesn't change when a new song is being played. Seems to me like the strlen is getting wrong values from the strings.

Maybe if you take a look to my code you can tell me what might be wrong. The script I am using is here: http://foros.edicion-limitada.com/status.txt

Thank you for your support!

Regards,

Soul Manager
Soul Manager is offline   Reply With Quote
Old 20th April 2003, 16:23   #32
Soul Manager
Junior Member
 
Join Date: Jul 2002
Posts: 7
Send a message via ICQ to Soul Manager
Providing more information on my problem, I generated an echo of the values of the string lenghts of my strings and all seem fine until I get the string lenght of a variable that I wanted to use to add all the string lenghts in a single value. I created the variable $imageWidth and this is getting the value "1". As a matter of fact, each variable that I try to create gets always the value "1".
Something is wrong here. Please take a look to: http://foros.edicion-limitada.com/status3.php

Thanks!

Last edited by Soul Manager; 20th April 2003 at 16:44.
Soul Manager is offline   Reply With Quote
Old 21st April 2003, 05:18   #33
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Your setting the value of $imageWidth before you set the $string variables. Therefore, your image will always have length 8 pixels. 0 + 0 + 0 + 8 = 8

Move lines 32 through 36 to line 62

FesterHead is offline   Reply With Quote
Old 21st April 2003, 07:18   #34
Soul Manager
Junior Member
 
Join Date: Jul 2002
Posts: 7
Send a message via ICQ to Soul Manager
Festerhead You DA MAN!
Thanks a lot!

Now that I have what I always wanted I think that it would be good to share the results with the community, should anyone may find my adaptation of your scripts useful. It would've never been possible without your valuable support! Thank you very much!

This is how my image output finally looks:

You can find the code to this script here: http://foros.edicion-limitada.com/status.txt

Enjoy and thank you very much for your help!

Regards,

Soul Manager
Soul Manager is offline   Reply With Quote
Old 22nd April 2003, 18:45   #35
DJ_Dred
Junior Member
 
Join Date: Apr 2003
Posts: 5
where can i get the code KXRM uses in his signature ? that one is real cool...

thanks
DJ_Dred is offline   Reply With Quote
Old 22nd April 2003, 19:25   #36
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
http://www.radiotoolbox.com/docs/faq/index.php?p_id=1#6

FesterHead is offline   Reply With Quote
Old 16th May 2003, 16:06   #37
soabcradio
Senior Member
 
soabcradio's Avatar
 
Join Date: Sep 2002
Location: Woodbridge, Ontario, Canada
Posts: 138
Can anybody tell me how to implement a "currently playing" graphic onto an HTML file? I believe PHP isn't my type, but, at the same time, everyone wants to know what i'm playing!
soabcradio is offline   Reply With Quote
Old 16th May 2003, 16:12   #38
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
Check out the Sticky post titled...
SHOUTcast: Important Info & Answers to FAQs. READ ME!

Scroll down a bit and look for the section titled...
General SHOUTcast Information -> SHOUTcast ToolBox (All sorts of nifty add-ons for SHOUTcast)

1. The PHP based XML parser is a complete solution and comes ready for you to customize.

2. The Javascript parser (actually ASP) is another complete solution and comes ready for you to customize.

Also, for an html implementation, check out:
KXRM's RadioToolbox
Oddsock's Do Something DSP plugin

FesterHead is offline   Reply With Quote
Old 16th May 2003, 18:32   #39
peppert
UID 0
 
peppert's Avatar
 
Join Date: May 2000
Location: a tent outside forums.winamp.com
Posts: 231
Does this mean I'm cool now?
peppert is offline   Reply With Quote
Old 16th May 2003, 18:42   #40
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,108
You're cool for "empowering jackasses with broadcastability".

FesterHead is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Discussions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump