]> git.sesse.net Git - vlc/blob - python/vlrs/playlist.py
* first update of the German translation
[vlc] / python / vlrs / playlist.py
1 #!/usr/bin/python -O
2 #
3 # VideoLAN RTSP Server
4 #
5 # Author: Cyril Deguet <asmax@via.ecp.fr>
6
7
8 import cfg, string, threading
9
10
11 class PlayList:
12     "Contains the media playlist"
13
14     def __init__(self):
15         self.lock = threading.Lock()
16
17     def readConfig(self, filename):
18         "Read the playlist file"
19         f = open(filename)
20         newList = {}
21         while 1:
22             line = string.strip(f.readline())
23             if line == "":
24                 break
25             items = string.split(line, '\t')
26             newList[items[0]] = {'file':items[1], 'name':items[2], 'addr':items[3]}
27         self.lock.acquire()
28         self.list = newList
29         self.lock.release()
30             
31     def getMedia(self, uri):
32         "Return the description of an item in the playlist"
33         self.lock.acquire()
34         if self.list.has_key(uri):
35             media = self.list[uri]
36         else:
37             media = None
38         self.lock.release()
39         return media
40