From f4606e9c1ef4be049468c22f02a0965d083d80c8 Mon Sep 17 00:00:00 2001 From: tony whalley Date: Mon, 5 Apr 2021 15:05:56 +0200 Subject: [PATCH] Plugins/Extensions/MediaScanner py3 --- .../Extensions/PicturePlayer/plugin.py | 16 ++++++++----- .../Plugins/Extensions/PicturePlayer/ui.py | 24 ++++++++++--------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index c31c7d9efc6..086428769f9 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -1,25 +1,29 @@ -from Plugins.Plugin import PluginDescriptor +from __future__ import print_function +from __future__ import absolute_import + from enigma import getDesktop +from Plugins.Plugin import PluginDescriptor #------------------------------------------------------------------------------------------ def Pic_Thumb(*args, **kwa): - import ui + from . import ui return ui.Pic_Thumb(*args, **kwa) def picshow(*args, **kwa): - import ui + from . import ui return ui.picshow(*args, **kwa) def main(session, **kwargs): - from ui import picshow + 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 - session.open(Pic_Full_View, filelist, 0, file.path) + 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 diff --git a/lib/python/Plugins/Extensions/PicturePlayer/ui.py b/lib/python/Plugins/Extensions/PicturePlayer/ui.py index bdbef2c707a..b1f89147953 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/ui.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/ui.py @@ -1,3 +1,5 @@ +from __future__ import print_function + from boxbranding import getMachineBrand from enigma import ePicLoad, eTimer, getDesktop, gMainDC, eSize @@ -87,7 +89,7 @@ def showPic(self, picInfo=""): self["thn"].instance.setPixmap(ptr.__deref__()) self["thn"].show() - text = picInfo.split('\n',1) + text = picInfo.split('\n', 1) self["label"].setText(text[1]) self["key_yellow"].setText(_("Exif")) @@ -239,7 +241,7 @@ def __init__(self, session, exiflist): exifdesc = [_("filename")+':', "EXIF-Version:", "Make:", "Camera:", "Date/Time:", "Width / Height:", "Flash used:", "Orientation:", "User Comments:", "Metering Mode:", "Exposure Program:", "Light Source:", "CompressedBitsPerPixel:", "ISO Speed Rating:", "X-Resolution:", "Y-Resolution:", "Resolution Unit:", "Brightness:", "Exposure Time:", "Exposure Bias:", "Distance:", "CCD-Width:", "ApertureFNumber:"] list = [] - for x in range(len(exiflist)): + for x in list(range(len(exiflist))): if x>0: list.append((exifdesc[x], exiflist[x])) else: @@ -264,7 +266,7 @@ def __init__(self, session, piclist, lastindex, path): self.textcolor = config.pic.textcolor.value self.color = config.pic.bgcolor.value - self.spaceX, self.picX, self.spaceY, self.picY, textsize, thumtxt = skin.parameters.get("PicturePlayerThumb",(35, 190, 30, 200, 20, 14)) + self.spaceX, self.picX, self.spaceY, self.picY, textsize, thumtxt = skin.parameters.get("PicturePlayerThumb", (35, 190, 30, 200, 20, 14)) pic_frame = resolveFilename(SCOPE_ACTIVE_SKIN, "icons/pic_frame.png") @@ -278,7 +280,7 @@ def __init__(self, session, piclist, lastindex, path): skincontent = "" posX = -1 - for x in range(self.thumbsC): + for x in list(range(self.thumbsC)): posY = x / self.thumbsX posX += 1 if posX >= self.thumbsX: @@ -311,7 +313,7 @@ def __init__(self, session, piclist, lastindex, path): }, -1) self["frame"] = MovingPixmap() - for x in range(self.thumbsC): + for x in list(range(self.thumbsC)): self["label"+str(x)] = StaticText() self["thumb"+str(x)] = Pixmap() @@ -369,7 +371,7 @@ def paintFrame(self): def newPage(self): self.Thumbnaillist = [] #clear Labels and Thumbnail - for x in range(self.thumbsC): + for x in list(range(self.thumbsC)): self["label"+str(x)].setText("") self["thumb"+str(x)].hide() #paint Labels and fill Thumbnail-List @@ -382,7 +384,7 @@ def newPage(self): self.showPic() def showPic(self, picInfo=""): - for x in range(len(self.Thumbnaillist)): + for x in list(range(len(self.Thumbnaillist))): if self.Thumbnaillist[x][0] == 0: if self.picload.getThumbnail(self.Thumbnaillist[x][2]) == 1: #zu tun probier noch mal self.ThumbTimer.start(500, True) @@ -554,7 +556,7 @@ def finish_decode(self, picInfo=""): if ptr is not None: text = "" try: - text = picInfo.split('\n',1) + text = picInfo.split('\n', 1) text = "(" + str(self.index+1) + "/" + str(self.maxentry+1) + ") " + text[0].split('/')[-1] except: pass @@ -568,7 +570,7 @@ def start_decode(self): self.picload.startDecode(self.filelist[self.index]) self["point"].show() - def next(self): + def __next__(self): self.index += 1 if self.index > self.maxentry: self.index = 0 @@ -579,8 +581,8 @@ def prev(self): self.index = self.maxentry def slidePic(self): - print "slide to next Picture index=" + str(self.lastindex) - if config.pic.loop.value==False and self.lastindex == self.maxentry: + print("slide to next Picture index=" + str(self.lastindex)) + if config.pic.loop.value == False and self.lastindex == self.maxentry: self.PlayPause() self.shownow = True self.ShowPicture()