Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamically generating playlists?

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Source Clients
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Fri Sep 02, 2005 11:44 pm    Post subject: Dynamically generating playlists? Reply with quote

I'm using IceS2 and I was wondering if there is any way to dynamically generate the playlist to accept user requests?
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sat Sep 03, 2005 1:41 am    Post subject: Reply with quote

The script playlist option is something that can be used for this. All it requires is a filename to be sent back, how it is generated is up to you

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anonymous
Guest





PostPosted: Mon Sep 05, 2005 1:23 am    Post subject: Reply with quote

OK, so I would write a shell script to do this:
Code:
#!/bin/bash
echo "/path/to/music/file.mp3"

And my /usr/local/etc/ices.conf will contain this information:
Code:

<param name="type">script</param>
<param name="program">/path/to/program</param>

But how would I get the ices to play it? I don't think the docs explain this very well... http://www.icecast.org/docs/ices-2.0.0/inputs.html
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Mon Sep 05, 2005 2:57 pm    Post subject: Reply with quote

The basic process you have shown is correct, the part that you have got wrong is that ices 2 does not play mp3 files.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anonymous
Guest





PostPosted: Tue Sep 06, 2005 1:53 am    Post subject: Reply with quote

I'm sorry, I had my initial ices version wrong - I'm running Ices v0.4.
Is it possible in this version, or will I need to convert all my MP3's to OGG and use IceS2?
Back to top
Guest






PostPosted: Mon Sep 12, 2005 8:07 pm    Post subject: Reply with quote

yep its possible.... I use 0.4 (www.crackity.com for an example)

basically you need two parts... the request part and the ices module

the request part.... takes the request and stores it somewhere

the ices module retrieves the requests and plays it

2 examples

1
request song -> save the song to a file (this isnt the best way, but hey...)
ices module, on next song, looks at the file, sees the song, and returns that file

2
song is requested, filename gets added to a database request table
ices module - on next song, looks at the request table and returns the filename if it is there


I have done both options but the database method is far cooler and gives you alot of other cool options as well..... also make sure to handle the case when there is no request, just return a random file for example....
Back to top
Anonymous
Guest





PostPosted: Tue Sep 13, 2005 11:49 am    Post subject: Reply with quote

OK - I understand the gist of this, but would you mind elaborating on this a little?
IE: Is there anything I need to change in my ices config file?
I have tried pointing the ices config to a file called playlist.txt, then just changing that, but I think ices loads the file into RAM or something, because when I change the file while ices is running, it continues with the old version, not the one I changed...
Back to top
Guest






PostPosted: Tue Sep 13, 2005 2:59 pm    Post subject: Reply with quote

You have to change the following lines in yout conf file:
Code:

    <!-- One of builtin, script, perl, or python. -->
    <Type>script</Type>
    <!-- Module name to pass to the playlist handler if using a script,
         perl, or python. Ignored for builtin -->
    <Module>ices</Module>


this is assuming yout script file is in your modules directory and is named "ices.sh"

now what happens is the following:
When ices is just about to finish playing the current song, it will call your script looking for 1 or 2 lines back in response. The 1st being the new file to play, and the second being the title to display... ie the example ices.sh.dist:
Code:

#!/bin/sh
                                                                               
# The first line should be a path to an audio file
echo "/mp3s/arcadefire2.mp3"
                                                                               
# The next line is optional
echo "The Arcade Fire - Neighbourhood #2 (Laika)"


note this code will just play the same song over and over again, so you would need to make the script smarter.....

and yes you will have to restart ices for the changes to take effect. I also suggest running in non-daemen until you have everythign worked out as the outputted text may make it easier to see if your script is working correctly without having to open the log file.
Back to top
KursK
Guest





PostPosted: Thu Sep 15, 2005 10:36 pm    Post subject: Reply with quote

I really don't get it.
Where do I have to put the <input>-section?
Maybe I'm an idiot, but I was trying a long time and I can't figure it out. I also would like to send the playlist generated from a bash-script. Can' tsomebody post an example of a full config-file or at least the relevant sections so everybody understands where to place the stuff exactly?

thank you
Back to top
KursK
Guest





PostPosted: Thu Sep 15, 2005 10:44 pm    Post subject: Reply with quote

I also tried it with
<Type>script</Type>
<Module>testscript</Module>

and placing testscript in /usr/local/etc/modules

testscript looks like this:
#!/bin/bash
echo "/export/mp3/Rock/acdc/ACDC - Highway To Hell.mp3"

but well nothing happens, ices -v -c ices.conf gives "Could not find a valid playlist file."! What might be wrong here?

btw I use ices-0.4. Bash only possible with ices2?
Back to top
Guest






PostPosted: Thu Sep 15, 2005 10:53 pm    Post subject: Reply with quote

I have not played with shell stuff but I am guess you need to name it testscript.sh not just testscript (the actual filename only).
I think ices automatically appends the extension.... ie .pm , .sh etc
Back to top
Guest






PostPosted: Thu Sep 15, 2005 11:00 pm    Post subject: Reply with quote

umm I dont have any <input> tags in my ices.conf at all...... I am just using the default ices.conf and just changing the needed values..... are you sure you are not reading ices 2.0 literature and trying to make it work with ices 0.4?
Back to top
Anonymous
Guest





PostPosted: Thu Sep 15, 2005 11:07 pm    Post subject: Reply with quote

hmmm 3 posts so decided I might as well register..... let me know if you figure it out or I am sure I could quick get one going and let you know what I am doing
Back to top
KursK
Guest





PostPosted: Fri Sep 23, 2005 9:33 am    Post subject: Reply with quote

It seems that it's not possible to generate the playlist via bash script, I think it's essential to use python or perl. I will check that ou this weekend.
Back to top
Anonymous
Guest





PostPosted: Fri Sep 23, 2005 4:26 pm    Post subject: Reply with quote

OK I just made a working stream via scripts and ices 0.4

every step I did:
script file:
cp ices.sh.dist to ices.ch in the modules directory
made sure that the correct user was owner and chmod'ed iit to 755 (or else cant be run)
editted the file to be a mp3 I had

ices.conf:
set to "script"
set the module name to "ices.sh" (sorry I was wrong earlier about the extension thing)
et background to 0
set verbose to 1

run ices now......
If it works, then get rid ofverbose and put it into the background...... if it doesnt work, there shuold be a pretty easy to figure out error message, just copy and paste the output from ices and we can help you from there.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Source Clients All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber