Old 22nd April 2002, 23:53   #1
jackspace
Junior Member
 
Join Date: Apr 2002
Location: San Francisco
Posts: 8
Display ONLY Song Title via pure HTML???

OK, I would like to give out a block of HTML to some folks who link to my site http://www.mindspace.org/ which would allow them to display the links to my streams, as well as the currently playing song's title.

I realize there are several scripts out there in PHP and ASP, but I do not wish to give these other sites my server password.

My guess is I would give them something which is a mixture of HTML/Javascript which would simply parse the 7.html file on the server.

ANy hints?

Thanks!!! You all rock!!!!

peace,
Jack
jackspace is offline   Reply With Quote
Old 23rd April 2002, 04:35   #2
Jay
Moderator Alumni
 
Jay's Avatar
 
Join Date: May 2000
Location: Next Door
Posts: 8,941
have you even looked in the shoutcast toolbox yet? not all the solutions for this problem require a server side language.
Jay is offline   Reply With Quote
Old 23rd April 2002, 18:46   #3
jackspace
Junior Member
 
Join Date: Apr 2002
Location: San Francisco
Posts: 8
server side versus Winamp side

Howdy!
Although I am currently running a Winamp+LinuxShoutcast combo from two boxes, I ultimately want this to be a purely Linux solution. So although I've seen multitudes of great Winamp tools that would allow me to easily drop an HTML file up on the server with whatever is currently playing, I think this would be the more convoluted route.

jackspace is offline   Reply With Quote
Old 23rd April 2002, 20:24   #4
FesterHead
Alumni
 
FesterHead's Avatar
 
Join Date: Sep 2001
Location: Maui, Hawaii
Posts: 14,103
One idea that may not be the best solution is to use Streaming Audio Manager (SAM) in addition to WinAmp.

Why? SAM has the ability to generate a 'Now Playing / Played' page. If the SAM box is running a webserver, you can output the page to a visible directory. Otherwise, SAM can ftp the page to a webserver.

Since the page generated is html, it may be possible for others to include it.

I found this:
How do I include another file inside a HTML file?

Disclaimer:
I don't know if you can include an html file from source A into an html file on source B.

Again, this might not be what you are looking for... Just offering a possible suggestion.

FesterHead is offline   Reply With Quote
Old 23rd April 2002, 21:59   #5
Jay
Moderator Alumni
 
Jay's Avatar
 
Join Date: May 2000
Location: Next Door
Posts: 8,941
I think SAM is a Windows only solution as of version 1, it looks as though he is looking for a nix solution
Jay is offline   Reply With Quote
Old 24th April 2002, 00:25   #6
Tom
Moderator
 
Join Date: Apr 2000
Posts: 4,491
I tried this locally and it worked so it might be worth a shot. I don't know javascipt so there is probably a better way to do this since this relies on php (only on the main server though).

First on your main server create a new directory and add an .htaccess file with the following line:
AddType application/x-httpd-php .js
Then create a file called: title.js
PHP Code:
<?
$fp
=fsockopen("127.0.0.1"8000$errnum$errstr1);
    
if(
$fp){
    
fwrite($fp"GET /title HTTP/1.0\r\nUser-Agent:Mozilla\r\n\r\n");
    while(!
feof($fp)){
        
$title=fgets($fp1024);
    }
    
$title=eregi_replace("<HTML><meta http-equiv=\"Pragma\" content=\"no-cache\"></head><body>(.*)</body></html>"'\\1'$title);
    if(
$title==''){
        
$title="Unknown";
    }
    
fclose($fp);
}
else{
    
$title="Server not online.";
}
$title=addslashes($title);
?>

document.write('<? echo $title?>');
[edit]There should only be one \ before the 1 in the eregi_replace. I had to add two to get it to show up right for me but incase there is something weird going on it should be \1.[/edit]

Replace the IP and port above.

Then give people the following HTML:
code:

<a href="http://127.0.0.1:8000/listen.pls"><script language="JavaScript" src="http://127.0.0.1/test_stuff/title.js"></script></a>



Once again replace the IP and port with that of the DNAS for the first part, and the second part should point to the file above.

You don't have to use the PHP from above (might be slow since it will open a connection each time there is a request), basically just get a file that has: document.write('SONG TITLE');
and that link should work.

Oh yeah, this will only work with 1.8.9 of the DNAS since earlier versions do not have the title page I used.

Tom

Tom 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