HI all,
the 1.7.3 version of the webserver only provides support for the use of fxd
by showing the content of the fxd (like year, description, etc).
However when a fxd contains <file> entries, the data is not used AND the movie
does not play since the fxd does not match the parts to be played.
I have modified the fileinfo.rpy (first python trial so errors and clumsyness
included) so that whe the fxd shows MULTIPLE file entries (i.e. multipart
movie) it will generate a link to an m3u playlist file with the same basename
as the fxd. That m3u should contain the URL to the files to be played.
When playing the movie in this way vlc will automatically skip to the next
part once the previous is finished.
Modifications and inclusion in 1.7.x hoped for
Patch attached
--- /tmp/fileinfo-orig.rpy 2007-08-12 12:44:28.000000000 +0200
+++ /usr/share/freevo/htdocs/fileinfo.rpy 2007-08-12 14:44:26.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#! /usr/bin/python
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------
# proginfo.rpy - Dynamically update program info popup box.
@@ -56,6 +56,7 @@
medium = metadata.parse(file)
#print medium
title = ""
+ allfiles=[]
info = "<table>"
(basedir, item) = os.path.split(file)
@@ -64,8 +65,10 @@
fxd_info = self.get_fxd_info(fxd_file)
i = 0
for z in fxd_info:
- if z and z != "cover-img":
+ if z and z != "cover-img" and z != "files":
info += "<tr><td><b>" + fxd_info.keys()[i] + ": </b></td><td>"+fxd_info.values()[i]+"</td></tr>"
+ if z and z == "files":
+ allfiles= fxd_info.values()[i]
i +=1
title=fxd_info['title']
if not title:
@@ -97,36 +100,72 @@
info+='<tr><td><b>Size: </b></td><td>'+str((os.stat(file)[6]/1024)/1024)+' MB</td></tr>'
info+= "</table>"
+ # count no of items
+ allfiles_count = 0
+ for a in allfiles:
+ allfiles_count = allfiles_count + 1
+
file_link = self.convert_dir(file)
- fv.res += (
- u"<script>\n" \
- u"var doc = parent.top.document;\n" \
- u"doc.getElementById('file-head').innerHTML = '%s';\n"\
- u"doc.getElementById('file-info').innerHTML = '%s';\n"\
- u"doc.getElementById('file-play-button').onclick = %s;\n"\
- u"doc.getElementById('file-play-using-vlc').onclick = %s;\n"\
- u"doc.getElementById('program-waiting').style.display = 'none';\n" \
- u"doc.getElementById('program-info').style.visibility = 'visible';\n" \
- u"</script>\n"
- ) % ( Unicode(title.replace("'", "\\'")),
- Unicode(info.replace("'", "\\'")),
- "function() { window.open(\"%s\"); }" % (urllib.quote(file_link)),
- '\
- function() { \
+ if allfiles_count < 2 :
+ # single file
+ AP='location.hostname + ":" + location.port + "/' + urllib.quote(file_link) + '"'
+ else:
+ m3u_file = file_link[:file_link.rindex('.')] + ".m3u"
+ AP='location.hostname + ":" + location.port + "/' + urllib.quote(m3u_file) + '"'
+ #AP=''
+ #for x in allfiles:
+ #AP+='video.add_item( "http://" + location.hostname + ":" + location.port + "' + urllib.quote(x) + '" );'
+
+ fv.res += u"<script>\n"
+ fv.res += u"var doc = parent.top.document;\n"
+ fv.res += u"doc.getElementById('file-head').innerHTML = '%s';\n" % Unicode(title.replace("'", "\\'"))
+ fv.res += u"doc.getElementById('file-info').innerHTML = '%s';\n" % Unicode(info.replace("'", "\\'"))
+
+ if allfiles_count < 2 :
+ fv.res += u"doc.getElementById('file-play-button').onclick = %s;\n" % \
+ "function() { window.open(\"%s\"); }" % (urllib.quote(file_link))
+ else:
+ fv.res += u"doc.getElementById('file-play-button').innerHTML = ' ';\n"
+
+ fv.res += u'doc.getElementById("file-play-using-vlc").onclick = function() { \
vlc_window = window.open(""); \
vlc_window.document.write(\'<html><head><title>VLC Player</title></head><body>\'); \
- vlc_window.document.write(\'<embed type="application/x-vlc-plugin" name="video" autoplay="yes" \'); \
+ vlc_window.document.write(\'<embed type="application/x-vlc-plugin" name="video" id="video" autoplay="yes" \'); \
vlc_window.document.write(\'width="640" height="480" target="http://\'); \
- vlc_window.document.write(location.hostname + \':\' + location.port + \'/' + urllib.quote(file_link) + '"/><br/>\'); \
- vlc_window.document.write(\'<a href="javascript:;" onclick="document.video.play()">Play</a> \'); \
- vlc_window.document.write(\'<a href="javascript:;" onclick="document.video.pause()">Pause</a> \'); \
- vlc_window.document.write(\'<a href="javascript:;" onclick="document.video.stop()">Stop</a> \'); \
- vlc_window.document.write(\'<a href="javascript:;" onclick="document.video.fullscreen()">Fullscreen</a>\'); \
+ vlc_window.document.write(%s); \
+ vlc_window.document.write(\'"/><br/>\'); \
+ vlc_window.document.write(\'<span id="videotime"></span> \'); \
+ vlc_window.document.write(\'<a href="javascript:;" onclick="video.play()">Play</a> \'); \
+ vlc_window.document.write(\'<a href="javascript:;" onclick="video.pause()">Pause</a> \'); \
+ vlc_window.document.write(\'<a href="javascript:;" onclick="video.stop()">Stop</a> \'); \
+ vlc_window.document.write(\'<a href="javascript:;" onclick="video.fullscreen()">Fullscreen</a> \'); \
+ vlc_window.document.write(\'<script type="text/javascript">\'); \
+ vlc_window.document.write(\'var video=document.getElementById("video");\'); \
+ vlc_window.document.write(\'var videotime=document.getElementById("videotime");\'); \
+ vlc_window.document.write(\'top.setInterval( "setVideoTime()", 1000 );\'); \
+ vlc_window.document.write(\'function setVideoTime() { \'); \
+ vlc_window.document.write(\' var Prc = video.get_position();\'); \
+ vlc_window.document.write(\' var tis = video.get_time();\'); \
+ vlc_window.document.write(\' var tim = Math.round( tis/60 - 0.5 );\'); \
+ vlc_window.document.write(\' var tih = Math.round( tim/60 - 0.5 );\'); \
+ vlc_window.document.write(\' tim = tim-(tih*60);\'); \
+ vlc_window.document.write(\' tis = tis-(((tih*60)+tim)*60);\'); \
+ vlc_window.document.write(\' if( tim < 10 ) {\'); \
+ vlc_window.document.write(\' tim = "0"+tim;\'); \
+ vlc_window.document.write(\' }\'); \
+ vlc_window.document.write(\' if( tis < 10 ) {\'); \
+ vlc_window.document.write(\' tis = "0"+tis;\'); \
+ vlc_window.document.write(\' }\'); \
+ vlc_window.document.write(\' videotime.innerHTML = "Playtime " + tih+":"+tim+":"+tis+" ("+Prc+"%%) ";\'); \
+ vlc_window.document.write(\'}\'); \
+ vlc_window.document.write(\'<\/script>\'); \
vlc_window.document.write(\'</body></html>\'); \
- }\
- '
- )
+ }; ' % AP
+
+ fv.res += u"doc.getElementById('program-waiting').style.display = 'none';\n"
+ fv.res += u"doc.getElementById('program-info').style.visibility = 'visible';\n"
+ fv.res += u"</script>\n"
elif img:
_img = img.split("_")#
@@ -163,6 +202,12 @@
if first_cdata == '' or first_cdata == 'None':
continue
fxd_info.update({str(name):str(first_cdata)})
+ if b.name == 'video':
+ afile = []
+ for c in b.children:
+ afile.append( c.textof() )
+ fxd_info.update({'files':afile})
+
return fxd_info
def convert_dir(self, dir_str):
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users