Fix errror when trying to play a file with a + in the filename. Minor cleanup
authorStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Mon, 2 Nov 2009 11:09:44 +0000 (11:09 +0000)
committerStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Mon, 2 Nov 2009 11:09:44 +0000 (11:09 +0000)
webinterface/src/WebChilds/FileStreamer.py
webinterface/src/web-data/statics.js
webinterface/src/web-data/tools.js
webinterface/src/webif.py

index af71c84..751bc72 100644 (file)
@@ -1,5 +1,5 @@
 from twisted.web import resource, http, server, static
-from urllib import unquote_plus
+from urllib import unquote
 from os import path as os_path
 
 class FileStreamer(resource.Resource):
@@ -7,22 +7,25 @@ class FileStreamer(resource.Resource):
 
        def render(self, request):
                if 'dir' in request.args:
-                       dir = unquote_plus(request.args['dir'][0])
+                       dir = unquote(request.args['dir'][0])
                elif 'root' in request.args:
-                       dir = unquote_plus(request.args['root'][0])
+                       dir = unquote(request.args['root'][0])
                else:
                        dir = ''
 
-               if 'file' in request.args:
-                       filename = unquote_plus(request.args["file"][0])
+               if 'file' in request.args:                      
+                       filename = unquote(request.args["file"][0])
                        path = dir + filename
 
                        #dirty backwards compatibility hack
                        if not os_path.exists(path):
                                path = "/hdd/movie/%s" % (filename)
-
+                       
+                       print "[WebChilds.FileStreamer] path is %s" %path
+                       
                        if os_path.exists(path):
                                basename = filename.decode('utf-8', 'ignore').encode('ascii', 'ignore')
+                               
                                if '/' in basename:
                                        basename = basename.split('/')[-1]
 
@@ -32,7 +35,7 @@ class FileStreamer(resource.Resource):
 
                        else:
                                request.setResponseCode(http.OK)
-                               request.write("file '%s' was not found"% (dir + filename))
+                               request.write("file '%s' was not found" %(dir + filename) )
                                request.finish()
                else:
                        request.setResponseCode(http.OK)
index 56ab3f5..ccde33b 100644 (file)
@@ -5,7 +5,7 @@ function url() {
        
        this.getcurrent = '/web/getcurrent';
        
-       this.getvolume = '/web/vol?set=state'; 
+       this.getvolume = '/web/vol'; 
        this.setvolume = '/web/vol?set=set'; // plus new value eg: set=set15
        this.volumeup = '/web/vol?set=up';
        this.volumedown = '/web/vol?set=down';
index adc2926..8477dc3 100644 (file)
@@ -628,20 +628,6 @@ function loadEPGByServiceReference(servicereference){
        doRequest(URL.epgservice+servicereference,incomingEPGrequest, false);
 }
 
-//function extdescriptionSmall(txt,num) {
-//if(txt.length > 410) {
-//var shortTxt = txt.substr(0,410);
-//txt = txt.replace(/\'\'/g, '&quot;');
-//txt = txt.replace(/\\/g, '\\\\');
-//txt = txt.replace(/\'/g, '\\\'');
-//txt = txt.replace(/\"/g, '&quot;');
-//var smallNamespace = { 'txt':txt,'number':num, 'shortTxt':shortTxt};
-//return RND(tplEPGListItemExtend, smallNamespace);
-//} else {
-//return txt;
-//}
-//}
-
 function buildServiceListEPGItem(epgevent, type){
        var data = {epg : epgevent};
        // e.innerHTML = RND(tplServiceListEPGItem, namespace);
@@ -907,29 +893,7 @@ function incomingMovieList(request){
 
                var movieList = new MovieList(getXML(request)).getArray();
                debug("[incomingMovieList] Got "+movieList.length+" movies");
-//             namespace = []; 
-
-//             var cssclass = "even";
-//
-//             for ( var i = 0; i < movies.length; i++){
-//                     cssclass = cssclass == 'even' ? 'odd' : 'even';
-//
-//                     var movie = movies[i];
-//                     namespace[i] = {        
-//                                     'servicereference': escape(movie.getServiceReference()),
-//                                     'servicename': movie.getServiceName(),
-//                                     'title': movie.getTitle(),
-//                                     'escapedTitle': escape(movie.getTitle()),
-//                                     'description': movie.getDescription(), 
-//                                     'descriptionextended': movie.getDescriptionExtended(),
-//                                     'filename': String(movie.getFilename()),
-//                                     'filesize': movie.getFilesizeMB(),
-//                                     'tags': movie.getTags().join(', ') ,
-//                                     'length': movie.getLength() ,
-//                                     'time': movie.getTimeDay()+"&nbsp;"+ movie.getTimeStartString(),
-//                                     'cssclass' : cssclass
-//                     };
-//             }
+
                var data = { movies : movieList };
                processTpl('tplMovieList', data, 'contentMain');
        }               
index 5e84f8d..2b15ad8 100644 (file)
@@ -162,7 +162,7 @@ class TextToURL(Converter):
                Converter.__init__(self, arg)
 
        def getHTML(self, id):
-               return self.source.text.replace(" ", "%20")
+               return self.source.text.replace(" ", "%20").replace("+", "%2b")
 
 #===============================================================================
 # ReturnEmptyXML