Platform: Fedora (Linux) 14 KDE 4.6.0
I'm trying to save a playlist in VLC, but as soon as I click Media -> "Save Playlist to File...," VLC completely freezes and has to be force-quit.
I didn't post this in the Linux sub-forum because I'm not really looking to get the bug fixed. I doubt that it's a problem with VLC; it's much more likely to be a problem with my system. I don't need to be able to save playlists. I just need to use one as an example.
I usually just have VLC playing a video on my secondary monitor most of the time, like most people do with music. And I just want a random selection of my TV shows. I've written a Python script that will choose 20 random random TV episodes, and I want it to play them in VLC. The problem is that I can't get VLC to read my playlist. I found only one format that seems to apply (http://en.wikipedia.org/wiki/XML_Sharea ... ist_Format), and it says that VLC implements it; however, VLC won't load it. I just need to see a valid, preferably Linux, playlist from VLC.
Would anyone mind creating a playlist with four or five videos and post it here? I can't finish my script until I see what the VLC playlist schema is.
Thanks,
Code:
Code: Select all
#!/bin/env python
import os, random
media_dir = '/var/media/television'
plist_name = '/tmp/vlc-playlist'
# Specify the number of each show that you want to see.
# The show name is the top-level directory for that show.
shows = {'Aqua Teen Hunger Force' : 5, 'The Wire' : 1, 'Family Guy' : 3, 'King of The Hill' : 6, 'The Big Bang Theory' : 2, 'Parks and Recreation' : 1}
total = 0
for i in shows.values():
total += i
# Don't use on Windows, maybe not on OS X.
random.seed(open('/dev/urandom', 'r').read(4))
episodes = []
accepted = []
for root, dirs, files in os.walk(media_dir):
for i in files:
if i[-4:] in ('.m4v', '.avi', '.mkv', '.mov') and os.path.isfile(root + '/' + i):
episodes.append(root + '/' + i)
while total > 0:
r = random.randint(0, len(episodes) -1)
a = episodes[r]
for i in a.split('/'):
if i in shows.keys():
if shows[i] > 0:
shows[i] -= 1
accepted.append(episodes[r])
episodes.pop(r)
total -= 1
plist_st = '''<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>'''
plist_en = '''</trackList>
</playlist>'''
item_st = '''<track>
<title>'''
item_md = '''</title>
<location>'''
item_en = '''</location>
</track>'''
playlist = plist_st + '\n '
for i in accepted:
print(i)
playlist = playlist + item_st + i.split('/')[-1] + item_md + i + item_en + '\n '
playlist = playlist + plist_en
fb = open(plist_name, 'w')
fb.write(playlist)
fb.flush()
fb.close()
This playlist works in Totem, which is the default Gnome media player.<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<title>03 - Spies Reminiscent of Us.m4v</title>
<location>/var/media/television/Family Guy/Season 8/03 - Spies Reminiscent of Us.m4v</location>
</track>
<track>
<title>18 - The Work Song Nanocluster.m4v</title>
<location>/var/media/television/The Big Bang Theory/Season 2/18 - The Work Song Nanocluster.m4v</location>
</track>
<track>
<title>17 - It's Not Easy Being Green.m4v</title>
<location>/var/media/television/King of The Hill/Season 5/17 - It's Not Easy Being Green.m4v</location>
</track>
<track>
<title>Aqua Teen Hunger Force - S04E06 - Party All the Time.avi</title>
<location>/var/media/television/Aqua Teen Hunger Force/Season 4/06 - Party All the Time.avi</location>
</track>
<track>
<title>4-6.m4v</title>
<location>/var/media/television/Family Guy/4-6.m4v</location>
</track>
<track>
<title>Aqua Teen Hunger Force - S04E07 - Global Grilling.avi</title>
<location>/var/media/television/Aqua Teen Hunger Force/Season 4/07 - Global Grilling.avi</location>
</track>
<track>
<title>07 - 2-And-a-Half-Star Wars out of Five.avi</title>
<location>/var/media/television/Aqua Teen Hunger Force/Season 6/07 - 2-And-a-Half-Star Wars out of Five.avi</location>
</track>
<track>
<title>20 - The Spaghetti Catalyst.m4v</title>
<location>/var/media/television/The Big Bang Theory/Season 3/20 - The Spaghetti Catalyst.m4v</location>
</track>
<track>
<title>10 - Hillennium.m4v</title>
<location>/var/media/television/King of The Hill/Season 4/10 - Hillennium.m4v</location>
</track>
<track>
<title>16 - Peter's Progress.m4v</title>
<location>/var/media/television/Family Guy/Season 7/16 - Peter's Progress.m4v</location>
</track>
<track>
<title>12 - Mission Accomplished.m4v</title>
<location>/var/media/television/The Wire/Season 3/12 - Mission Accomplished.m4v</location>
</track>
<track>
<title>09 - Pretty, Pretty Dresses.m4v</title>
<location>/var/media/television/King of The Hill/Season 3/09 - Pretty, Pretty Dresses.m4v</location>
</track>
<track>
<title>11 - Unfortunate Son.m4v</title>
<location>/var/media/television/King of The Hill/Season 6/11 - Unfortunate Son.m4v</location>
</track>
<track>
<title>12 - Meet the Manger Babies.m4v</title>
<location>/var/media/television/King of The Hill/Season 2/12 - Meet the Manger Babies.m4v</location>
</track>
<track>
<title>07 - Happy Hank's Giving.m4v</title>
<location>/var/media/television/King of The Hill/Season 4/07 - Happy Hank's Giving.m4v</location>
</track>
<track>
<title>05 - The Banquet.m4v</title>
<location>/var/media/television/Parks and Recreation/Season 1/05 - The Banquet.m4v</location>
</track>
</trackList>
</playlist>