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):
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]
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)
doRequest(URL.epgservice+servicereference,incomingEPGrequest, false);
}
-//function extdescriptionSmall(txt,num) {
-//if(txt.length > 410) {
-//var shortTxt = txt.substr(0,410);
-//txt = txt.replace(/\'\'/g, '"');
-//txt = txt.replace(/\\/g, '\\\\');
-//txt = txt.replace(/\'/g, '\\\'');
-//txt = txt.replace(/\"/g, '"');
-//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);
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()+" "+ movie.getTimeStartString(),
-// 'cssclass' : cssclass
-// };
-// }
+
var data = { movies : movieList };
processTpl('tplMovieList', data, 'contentMain');
}