diff --git a/scripts/python/DIRPlaylist/DIRPlaylist.py b/scripts/python/DIRPlaylist/DIRPlaylist.py index f28254fa..c47b73da 100644 --- a/scripts/python/DIRPlaylist/DIRPlaylist.py +++ b/scripts/python/DIRPlaylist/DIRPlaylist.py @@ -50,13 +50,18 @@ class DIRPlaylist(object): if( string.find(f,"mp4")>0): videos.append(f) print("+ " + f) + if( string.find(f,"avi")>0): + videos.append(f) + print("+ " + f) if(len(videos)<1): print("error: no videos found in dir " + dir) exit() self.cx = freej.Context() - self.cx.init(self.width, self.height, 0, 0) + self.scr = freej.SdlScreen( self.width, self.height ) + self.cx.add_screen(self.scr) + self.cx.plugger.refresh(self.cx) self.ctx_thread = threading.Thread(target = self.cx.start, name = "freej") @@ -64,33 +69,33 @@ class DIRPlaylist(object): current = 0 - callback = NextVideoCB() + self.callback = NextVideoCB() while (not self.cx.quit): if(current >= len(videos)): current = 0 - video = freej.VideoLayer() - video.init(self.cx) + self.video = freej.VideoLayer() + self.video.init(self.cx) - video.open(dir + "/" + videos[current]) - video.add_eos_call(callback) - video.fit() - video.active = True - self.cx.add_layer(video) - video.start() + self.video.open(dir + "/" + videos[current]) + self.video.add_eos_call(self.callback) +# self.video.fit() + self.video.start() + + self.cx.add_layer(self.video) while(not end_of_video): time.sleep(5) print "end of video" - video.quit = True + self.video.quit = True time.sleep(1) - self.cx.rem_layer(video) + self.cx.rem_layer(self.video) current += 1 ############### main() if len(sys.argv) > 1: - dirplaylist = DIRPlaylist(320,240,sys.argv[1]) + dirplaylist = DIRPlaylist(400,300,sys.argv[1]) else: dirplaylist = DIRPlaylist() diff --git a/scripts/python/RSSPlaylist/RSS.pyc b/scripts/python/RSSPlaylist/RSS.pyc deleted file mode 100644 index 2ea5daee..00000000 Binary files a/scripts/python/RSSPlaylist/RSS.pyc and /dev/null differ diff --git a/scripts/python/RSSPlaylist/RSSPlaylist.py b/scripts/python/RSSPlaylist/RSSPlaylist.py index d672ec3f..05e67453 100644 --- a/scripts/python/RSSPlaylist/RSSPlaylist.py +++ b/scripts/python/RSSPlaylist/RSSPlaylist.py @@ -1,4 +1,6 @@ #!/usr/bin/python +# by Lluis Gomez y Bigorda +# GNU GPL v3 """ Classes to make a continuous video stream playlist from an RSS feed. @@ -26,6 +28,16 @@ import inspect import urllib from RSS import ns, CollectionChannel, TrackingChannel +end_of_video = False; + +class NextVideoCB(freej.DumbCall): + def __init__(self, *args): + super(NextVideoCB, self).__init__(*args) + + def callback(self): + global end_of_video + end_of_video = True; + class RSSsucker(object): """A RSSsucker is a RSS parser wich returns a video URL list of a RSS1.0 feed.""" @@ -64,24 +76,36 @@ class RSSPlaylist(object): self.ctx_thread = None if len(self.rsssucker.list): - self.cx = freej.Context() - self.cx.init(self.width, self.height, 0, 0) - self.cx.plugger.refresh(self.cx) - self.ctx_thread = threading.Thread(target = self.cx.start, - name = "freej") - self.ctx_thread.start() + self.cx = freej.Context() + self.scr = freej.SdlScreen( self.width, self.height ) + self.cx.add_screen(self.scr) + + self.cx.plugger.refresh(self.cx) + self.ctx_thread = threading.Thread(target = self.cx.start, + name = "freej") + self.ctx_thread.start() + + self.callback = NextVideoCB() + + while (not self.cx.quit): + + for file in self.rsssucker.list: + print file + self.lay = freej.VideoLayer() + self.lay.init(self.cx) + + self.lay.open(urllib.pathname2url(file).replace("%3A",":")) + self.lay.add_eos_call(self.callback) + self.lay.start() + + self.cx.add_layer(self.lay) + while(not end_of_video): time.sleep(5) + print "end of video" + self.lay.quit = True + self.cx.rem_layer(self.lay) - while (True): - for file in self.rsssucker.list: - print file - self.lay = self.cx.open(urllib.pathname2url(file).replace("%3A",":")) - self.lay.fit() - self.lay.active = True - self.cx.add_layer(self.lay) - time.sleep(5) - self.cx.rem_layer(self.lay) else: - print "Cannot start a show without playlist!" + print "Cannot start a show without playlist!" @@ -90,7 +114,7 @@ class RSSPlaylist(object): if len(sys.argv) > 1: - rssplaylist = RSSPlaylist(320,240,sys.argv[1]) + rssplaylist = RSSPlaylist(400,300,sys.argv[1]) else: rssplaylist = RSSPlaylist()