-
Notifications
You must be signed in to change notification settings - Fork 106
/
plugin.py
58 lines (48 loc) · 2.01 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from __future__ import print_function
from __future__ import absolute_import
from enigma import getDesktop
from Plugins.Plugin import PluginDescriptor
#------------------------------------------------------------------------------------------
def Pic_Thumb(*args, **kwa):
from . import ui
return ui.Pic_Thumb(*args, **kwa)
def picshow(*args, **kwa):
from . import ui
return ui.picshow(*args, **kwa)
def main(session, **kwargs):
from .ui import picshow
session.open(picshow)
def filescan_open(list, session, **kwargs):
# Recreate List as expected by PicView
filelist = [((file.path, False), None) for file in list]
from .ui import Pic_Full_View
p = filelist[0][0][0]
session.open(Pic_Full_View, filelist, 0, p)
def filescan(**kwargs):
from Components.Scanner import Scanner, ScanPath
import os
# Overwrite checkFile to only detect local
class LocalScanner(Scanner):
def checkFile(self, file):
return os.path.exists(file.path)
return \
LocalScanner(mimetypes = ["image/jpeg", "image/png", "image/gif", "image/bmp"],
paths_to_scan =
[
ScanPath(path = "DCIM", with_subdirs = True),
ScanPath(path = "", with_subdirs = False),
],
name = "Pictures",
description = _("View photos..."),
openfnc = filescan_open,
)
def Plugins(**kwargs):
screenwidth = getDesktop(0).size().width()
if screenwidth and screenwidth == 1920:
return \
[PluginDescriptor(name=_("Picture player"), description=_("fileformats (BMP, PNG, JPG, GIF)"), icon="pictureplayerhd.png", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = False, fnc=main),
PluginDescriptor(name=_("Picture player"), where = PluginDescriptor.WHERE_FILESCAN, needsRestart = False, fnc = filescan)]
else:
return \
[PluginDescriptor(name=_("Picture player"), description=_("fileformats (BMP, PNG, JPG, GIF)"), icon="pictureplayer.png", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = False, fnc=main),
PluginDescriptor(name=_("Picture player"), where = PluginDescriptor.WHERE_FILESCAN, needsRestart = False, fnc = filescan)]