This fixed the PicturePlayer to check if a file is local rather than accepting files...
[enigma2.git] / lib / python / Plugins / Extensions / PicturePlayer / plugin.py
index 8a5910903e035aff654c438fb685915c9a611c07..b305b653b4b5193863a3b2d6041b0ccf3c82e7cf 100644 (file)
@@ -8,8 +8,8 @@ from Components.Label import Label
 from Components.ConfigList import ConfigList
 from Components.config import *
 
-from Tools.Directories import resolveFilename, pathExists, createDir, SCOPE_MEDIA
-from Components.FileList import FileEntryComponent, FileList
+from Tools.Directories import resolveFilename, fileExists, pathExists, createDir, SCOPE_MEDIA
+from Components.FileList import FileList
 from Components.AVSwitch import AVSwitch
 
 from Plugins.Plugin import PluginDescriptor
@@ -531,14 +531,20 @@ def main(session, **kwargs):
        session.open(picmain)
 
 def filescan_open(list, session, **kwargs):
-       session.open(picmain) # list
+       # Recreate List as expected by PicView
+       filelist = [((file.path, False), None) for file in list]
+       session.open(PicView, filelist, "", "")
+
+def filescan(**kwargs):
+       from Components.Scanner import Scanner, ScanPath
+
+       # Overwrite checkFile to only detect local
+       class LocalScanner(Scanner):
+               def checkFile(self, file):
+                       return fileExists(file.path)
 
-def filescan():
-       # we expect not to be called if the MediaScanner plugin is not available,
-       # thus we don't catch an ImportError exception here
-       from Plugins.Extensions.MediaScanner.plugin import Scanner, ScanPath
        return \
-               Scanner(extensions = ["jpg", "jpe", "jpeg"], 
+               LocalScanner(mimetypes = ["image/jpeg", "image/png", "image/gif", "image/bmp"],
                        paths_to_scan = 
                                [
                                        ScanPath(path = "DCIM", with_subdirs = True),