From 789622f9c279f7f512c458f05ac210900055d2e0 Mon Sep 17 00:00:00 2001 From: daTa Date: Sun, 19 Apr 2015 12:44:42 +0200 Subject: [PATCH] [EMCPlayList] add Playlist-Menu/-Setup [MovieSelectionMenu] change the Menu-List for Playlist --- po/EnhancedMovieCenter.pot | 4 +++ po/de.po | 7 ++++ src/EMCPlayList.py | 72 ++++++++++++++++++++++++++++++++++++-- src/MovieSelection.py | 9 +++++ src/MovieSelectionMenu.py | 18 +++++++--- 5 files changed, 103 insertions(+), 7 deletions(-) diff --git a/po/EnhancedMovieCenter.pot b/po/EnhancedMovieCenter.pot index 5a7c2518..179d6278 100644 --- a/po/EnhancedMovieCenter.pot +++ b/po/EnhancedMovieCenter.pot @@ -13,6 +13,10 @@ msgstr "" "X-Poedit-Basepath: ../\n" "X-Poedit-SearchPath-0: src\n" +#: src/MovieSelectionMenu.py:91 src/MovieSelectionMenu.py:196 +msgid "Playlist Options" +msgstr "" + #: src/EMCPlayList.py:119 msgid "Change the filename to save current Playlist:" msgstr "" diff --git a/po/de.po b/po/de.po index c08de504..b06f6cc3 100644 --- a/po/de.po +++ b/po/de.po @@ -16,6 +16,10 @@ msgstr "" "X-Poedit-Basepath: ../\n" "X-Poedit-SearchPath-0: src\n" +#: src/MovieSelectionMenu.py:91 src/MovieSelectionMenu.py:196 +msgid "Playlist Options" +msgstr "Playlist Optionen" + #: src/EMCPlayList.py:119 msgid "Change the filename to save current Playlist:" msgstr "Ändern sie den Dateinamen zum speichern der aktuellen Playlist:" @@ -2539,6 +2543,9 @@ msgid "" "If you have selected a directory, all cut files within the folder and its " "subfolders will be deleted!" msgstr "" +"Sollen wirklich alle Cut-Files gelöscht werden?\n" +"Bei Ordnerauswahl werden auch alle Cut-Files in den " +"Unterordnern gelöscht!" #: src/RogueFileCheck.py:45 msgid " files\n" diff --git a/src/EMCPlayList.py b/src/EMCPlayList.py index 5b42e446..667268f5 100644 --- a/src/EMCPlayList.py +++ b/src/EMCPlayList.py @@ -7,11 +7,13 @@ from enigma import eListboxPythonMultiContent, RT_VALIGN_CENTER, RT_HALIGN_RIGHT, gFont, eListbox from Screens.Screen import Screen +from Screens.ChoiceBox import ChoiceBox from Screens.InputBox import InputBox from Components.ActionMap import ActionMap from Components.Button import Button -from Components.config import config +from Components.config import * +from Components.ConfigList import * from Components.GUIComponent import GUIComponent from skin import parseColor, parseFont @@ -22,6 +24,9 @@ global plyDVB +config.EMC.playlist = ConfigSubsection() +config.EMC.playlist.save_default_list = ConfigYesNo(default = False) + class EMCPlaylist(): def __init__(self): @@ -94,6 +99,7 @@ def __init__(self, session): { "ok": self.keyOk, "cancel": self.keyRed, + "menu": self.keySetup, "red": self.keyRed, "green": self.keyGreen, "yellow": self.keyYellow, @@ -112,6 +118,22 @@ def __layoutFinished(self): def keyOk(self): self.close() + def keySetup(self): + menu = [] + text = _("EMC Playlist Menu") + menu.append((_("Playlist open"), self.openPlaylist)) + menu.append((_("Setup open"), self.showSetup)) + def boxAction(choice): + if choice: + choice[1]() + self.session.openWithCallback(boxAction, ChoiceBox, title=text, list=menu) + + def openPlaylist(self): + self.close() + + def showSetup(self): + self.session.open(EMCPlaylistSetup) + def keyRed(self): self.close() @@ -130,7 +152,7 @@ def save(self, filename): file = open(filename + ".e2pls", "w") for x in tmplist: file.write(str(x[2].toString()).replace(":%s" % x[1], "") + "\n") - file.close() + file.close() def keyYellow(self): @@ -272,3 +294,49 @@ def refreshList(self): def setItemHeight(self): self.l.setItemHeight(self.itemHeight) + + +def image(): + if imgVti: + return 30, 18 + else: + return 28, 20 + +class EMCPlaylistSetup(Screen, ConfigListScreen): + skin = """ + + + + + + + """ % image() + + def __init__(self, session): + Screen.__init__(self, session) + #self.session = session + self.list = [] + self.list.append(getConfigListEntry(_("Save default Playlist"), config.EMC.playlist.save_default_list)) + + ConfigListScreen.__init__(self, self.list, session) + self["actions"] = ActionMap(["SetupActions", "ColorActions"], + { + "ok": self.ok, + "cancel": self.exit, + "green": self.save, + }, -2) + self["cancel"] = Button(_("Cancel")) + self["save"] = Button(_("Save")) + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setTitle(_("EMC Playlist Setup")) + + def ok(self): + self.close() + + def exit(self): + self.close() + + def save(self): + self.close() diff --git a/src/MovieSelection.py b/src/MovieSelection.py index 91768827..b530d911 100644 --- a/src/MovieSelection.py +++ b/src/MovieSelection.py @@ -918,6 +918,7 @@ def openBookmarksCB(self, path=None): def menuCallback(self, selection=None, parameter=None): if selection is not None: if selection == "Play last": self.playLast() + elif selection == "emcPlaylist": self.openPlaylistOptions() elif selection == "addPlaylist": self.addPlaylist() elif selection == "playPlaylist": self.playPlaylist() elif selection == "playPlaylistRandom": self.playPlaylist(True) @@ -952,6 +953,14 @@ def menuCallback(self, selection=None, parameter=None): elif selection == "emptytrash": purgeExpired(emptyTrash=True) elif selection == "reloadwithoutcache": self.reloadListWithoutCache() + def openPlaylistOptions(self): + # first we check if playlist exists + playlist = False + if not emcplaylist.isCurrentPlaylistEmpty(): + playlist = True + current = self.getCurrent() + self.session.openWithCallback(self.menuCallback, MovieMenu, "emcPlaylist", self, self["list"], current, self["list"].makeSelectionList(), self.currentPath, playlist) + def openMenu(self): # first we check if playlist exists playlist = False diff --git a/src/MovieSelectionMenu.py b/src/MovieSelectionMenu.py index 8fa2cfe1..2a5055b6 100644 --- a/src/MovieSelectionMenu.py +++ b/src/MovieSelectionMenu.py @@ -88,15 +88,11 @@ def __init__(self, session, menumode, mselection, mlist, service, selections, cu self.menu.append((_("Reload current directory"), boundFunction(self.close, "reloadwithoutcache"))) + self.menu.append((_("Playlist Options"), boundFunction(self.close, "emcPlaylist"))) if service is not None: ext = os.path.splitext(service.getPath())[1].lower() if ext in extMedia: self.menu.append((_("Add to current Playlist"), boundFunction(self.close, "addPlaylist"))) - if self.plist: - self.menu.append((_("Play current Playlist"), boundFunction(self.close, "playPlaylist"))) - self.menu.append((_("Play random current Playlist"), boundFunction(self.close, "playPlaylistRandom"))) - self.menu.append((_("Show current Playlist"), boundFunction(self.close, "showPlaylist"))) - self.menu.append((_("Delete current Playlist"), boundFunction(self.close, "delPlaylist"))) self.menu.append((_("Play last"), boundFunction(self.close, "Play last"))) @@ -196,6 +192,18 @@ def __init__(self, session, menumode, mselection, mlist, service, selections, cu for line in bm: self.menu.append((line, boundFunction(self.close, line))) + elif menumode == "emcPlaylist": + self["title"] = StaticText(_("Playlist Options")) + self.menu.append((_("Show current Playlist"), boundFunction(self.close, "showPlaylist"))) + if service is not None: + ext = os.path.splitext(service.getPath())[1].lower() + if ext in extMedia: + self.menu.append((_("Add to current Playlist"), boundFunction(self.close, "addPlaylist"))) + if self.plist: + self.menu.append((_("Play current Playlist"), boundFunction(self.close, "playPlaylist"))) + self.menu.append((_("Play random current Playlist"), boundFunction(self.close, "playPlaylistRandom"))) + self.menu.append((_("Delete current Playlist"), boundFunction(self.close, "delPlaylist"))) + self["menu"] = List(self.menu) self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {