trial-site: update
authorP2P-Next <p2p-next@koala.cs.pub.ro>
Fri, 15 Apr 2011 15:18:50 +0000 (18:18 +0300)
committerP2P-Next <p2p-next@koala.cs.pub.ro>
Fri, 15 Apr 2011 15:18:59 +0000 (18:18 +0300)
trial-site/NextSharePC-interface.js
trial-site/living-lab-admin/publish_videos.py

index 5c6f777..9db050b 100644 (file)
@@ -4,6 +4,18 @@
 \r
 updateInterval = 500;\r
 \r
+function getURLParam( name )\r
+{\r
+       name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");\r
+       var regexS = "[\\?&]"+name+"=([^&#]*)";\r
+       var regex = new RegExp( regexS );\r
+       var results = regex.exec( window.location.href );\r
+       if( results == null )\r
+               return "";\r
+       else\r
+               return results[1];\r
+}\r
+\r
 function getPluginWidth()\r
 {\r
        return 800;\r
@@ -36,6 +48,11 @@ function updateTime(afterSlider)
        var tot_s = Math.floor(len / 1000 % 60);\r
        var tot_min = Math.floor((len / 1000) / 60);\r
 \r
+       if(isNaN(crt_s)) crt_s = 0;\r
+       if(isNaN(crt_min)) crt_min = 0;\r
+       if(isNaN(tot_s)) tot_s = 0;\r
+       if(isNaN(tot_min)) tot_min = 0;\r
+\r
        $("#nsTime").html("" + pad(crt_min, 2) + ":" + pad(crt_s, 2)\r
                + " / " + pad(tot_min, 2) + ":" + pad(tot_s, 2));\r
 }\r
@@ -51,8 +68,19 @@ function update()
        timerHandle = setTimeout("update()", updateInterval);\r
 }\r
 \r
-function displayNextSharePC(torrent)\r
+function displayNextSharePC(torrent, html5)\r
 {\r
+       if(html5 == true)\r
+       {\r
+               document.write('<video src="'+torrent+'" controls="controls" width="800" height="600">');\r
+               document.write('    Error: Your browser does not support HTML5!');\r
+               document.write('</video>');\r
+               document.write('<br /><br /><p><a href="' + window.location.href.replace('&html5=1', '') + '">');\r
+               document.write('Play video using VLC with NextSharePC</a></p>');\r
+\r
+               return true;\r
+       }\r
+\r
        if (navigator.appName == "Netscape")\r
        {\r
                document.write('<embed type="application/x-ns-stream"');\r
@@ -97,6 +125,11 @@ function displayNextSharePC(torrent)
                + '</table>');\r
                \r
        $("nsTable").css("width", getPluginWidth());\r
+\r
+       document.write('<br /><p><a href="' + window.location.href + '&html5=1">');\r
+       document.write('Play video using HTML5 with SwarmPlayer</a></p>');\r
+\r
+       return true;\r
 }\r
 \r
 function onSliderStop(event, ui)\r
index 8a35dfd..a5ed9d6 100644 (file)
@@ -200,7 +200,6 @@ def main():
                title = file.readline().strip()
                
                if not Content.encodeAlias(title) in content_aliases:
-                       print '*'
                        # Database operations:
                        contentId = Content.getContentId(dbCur, category)
                        # Add entry in cms_content table
@@ -216,7 +215,7 @@ def main():
                        if thumbsDir != None:
                                # Configure thumbnail images
                                alias = content.content_alias
-                               basename = thumbsDir + "/" + torrent.rpartition('/')[2].rpartition('_')[0]
+                               basename = thumbsDir + torrent.rpartition('/')[2].rpartition('_')[0]
                                ##print 'basename: ' + basename + '; alias: ' + alias
                                os.system("./config_thumbnails.sh " + basename + " " + alias)