View Full Version : [ubuntu] Creating video playlist in shell

July 31st, 2008, 10:43 AM
I have about 20 .flv video files on my server. I would like to create playlist in shell environment, so that it would create new playlist(from the same directory) once a week.

Is there a program or a script to do this? I'm using JW Player for Flash to play these files on my server.

July 31st, 2008, 11:35 AM
well, what kind of playlists can jw player read?

July 31st, 2008, 11:38 AM
well, what kind of playlists can jw player read?

For example ASX,SMIL,XSPF (http://code.jeroenwijering.com/trac/wiki/FlashFormats)

Vishal Agarwal
July 31st, 2008, 11:41 AM
can u attach the play list with your post. And what is the .ext is required for play list ?

July 31st, 2008, 11:47 AM
can u attach the play list with your post. And what is the .ext is required for play list ?

You can find examples here:
ASX: http://www.jeroenwijering.com/upload/asx.xml
SMIL: http://www.jeroenwijering.com/upload/smil.xml
XSPF: http://www.jeroenwijering.com/upload/xspf.xml

For more information look at: http://code.jeroenwijering.com/trac/wiki/FlashFormats

July 31st, 2008, 01:57 PM
so really you need a script that will
1: create the top of the xml document (asx in this example)

- <asx version="3.0">
<title>ASX playlist title</title>
<moreinfo href="your website" />

2: iterate over the contents of your video folder and write the entry stuff. i imagine a lot of the fields can be left blank, and perhaps can be missed out all together. for the sake of avoiding errors you probably should include them to begin with but just have them empty or something.
in pseudocode:

for $file in directory:
append to playlist.xml "
- <entry>
<moreinfo href="" />
<ref href="http://website.com/videos/$file" />
<param name="captions" value="" />
<param name="type" value="video/x-flv" />

3: create the closing tag


i dont mess around with bash, perl or php scripts much so i havent actually put any real syntax in there. i guess you'd either want to trigger this playlist formation either every time you upload a new video, at certain times in the day/week, or every time someone views a certain page. its probably best just to run it when you've finished uploading videos. im sure you can encorporate it into an upload script or something.

edit: i see you said once a week. in that case just set it as a cron job. but writing the script in a language a computer understands instead of my rough overview of what you need to do will be the first step :p

August 1st, 2008, 08:56 AM
Thank you! I just made my own script:

cd /var/www/temp/
echo '<ASX version = "3.0">' > test.xml
for X in *.flv
let Y=$Y+1
echo -n "<Entry>" >> test.xml
echo -n "<title>Video $Y</title>" >> test.xml
echo -n '<Ref href = "' >> test.xml
echo -n "http://xx.xx.xx.xx/temp/videos/$X" >> test.xml
echo -n '"/></Entry>' >> test.xml
echo "" >> test.xml
echo "</ASX>" >> test.xml

So this case is now solved.

August 21st, 2012, 09:11 AM
Can VLC make use of this shell, or another like it?

August 21st, 2012, 10:58 AM
From the Ubuntu Forums Code of Conduct (http://ubuntuforums.org/index.php?page=policy).

If a post is older than a year or so and hasn't had a new reply in that time, instead of replying to it, create a new thread. In the software world, a lot can change in a very short time, and doing things this way makes it more likely that you will find the best information. You may link to the original discussion in the new thread if you think it may be helpful.
Thread closed.