From 1e7e7416e006186251a8798f61740398973718dc Mon Sep 17 00:00:00 2001 From: Moritz Venn Date: Tue, 13 Oct 2009 18:57:08 +0000 Subject: [PATCH] some further fixes --- webinterface/src/WebComponents/Sources/MP.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/webinterface/src/WebComponents/Sources/MP.py b/webinterface/src/WebComponents/Sources/MP.py index f76c1fa..a0100d4 100644 --- a/webinterface/src/WebComponents/Sources/MP.py +++ b/webinterface/src/WebComponents/Sources/MP.py @@ -1,4 +1,4 @@ -from enigma import eServiceReference, iServiceInformation, eServiceCenter +from enigma import eServiceReference from Components.Sources.Source import Source from Components.FileList import FileList from os import path as os_path @@ -82,12 +82,19 @@ class MP(Source): else: matchingPattern = param["types"] - filelist = FileList(param["path"], showDirectories=True, showFiles=True, matchingPattern=matchingPattern, useServiceRef=useServiceRef, isTop=False) + path = param["path"] + if path == "undefined": + path = None + elif path is not None and not os_path.exists(path): + # TODO: returning something is better than just dying but is this return sane? + return ((None, True, path),) + + filelist = FileList(path, showDirectories=True, showFiles=True, matchingPattern=matchingPattern, useServiceRef=useServiceRef, isTop=False) list = filelist.getFileList() if useServiceRef is True: - returnList = [ (x[0][0].toString(), x[0][1], param["path"]) if x[0][1] is False else (x[0][0], x[0][1], param["path"]) for x in list ] + returnList = [ (x[0][0].toString(), x[0][1], path) if x[0][1] is False else (x[0][0], x[0][1], path) for x in list ] else: - returnList = [ (param["path"] + x[0][0], x[0][1], param["path"]) if x[0][1] is False else (x[0][0], x[0][1], param["path"]) for x in list ] + returnList = [ (param["path"] + x[0][0], x[0][1], path) if x[0][1] is False else (x[0][0], x[0][1], path) for x in list ] return returnList @@ -105,7 +112,9 @@ class MP(Source): return mp = self.session.mediaplayer - ref = eServiceReference(4097, 0, file) + ref = eServiceReference(file) + if not ref.valid(): + ref = eServiceReference(4097, 0, file) mp.playlist.addFile(ref) mp.playServiceRefEntry(ref) -- 2.7.4