Skip to content

Commit

Permalink
Merge pull request #74 from daTa-deVil/master
Browse files Browse the repository at this point in the history
[EMCPlayList] add Playlist-Menu/-Setup [MovieSelectionMenu] change the M...
  • Loading branch information
Captain committed Apr 19, 2015
2 parents 8c1d4f5 + 789622f commit 5057d8c
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 7 deletions.
4 changes: 4 additions & 0 deletions po/EnhancedMovieCenter.pot
Expand Up @@ -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 ""
Expand Down
7 changes: 7 additions & 0 deletions po/de.po
Expand Up @@ -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:"
Expand Down Expand Up @@ -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"
Expand Down
72 changes: 70 additions & 2 deletions src/EMCPlayList.py
Expand Up @@ -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
Expand All @@ -22,6 +24,9 @@

global plyDVB

config.EMC.playlist = ConfigSubsection()
config.EMC.playlist.save_default_list = ConfigYesNo(default = False)


class EMCPlaylist():
def __init__(self):
Expand Down Expand Up @@ -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,
Expand All @@ -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()

Expand All @@ -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):
Expand Down Expand Up @@ -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 = """
<screen position="center,center" size="600,435" title="EMC Playlist Setup">
<widget name="config" position="5,10" size="590,350" itemHeight="%s" font="Regular;%s" scrollbarMode="showOnDemand" />
<widget name="cancel" position="105,390" size="140,30" valign="center" halign="center" zPosition="1" font="Regular;19" transparent="1" backgroundColor="red" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/key-red_line.png" position="100,417" size="150,2" zPosition="0" alphatest="on" />
<widget name="save" position="355,390" size="140,30" valign="center" halign="center" zPosition="1" font="Regular;19" transparent="1" backgroundColor="green" />
<ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EnhancedMovieCenter/img/key-green_line.png" position="350,417" size="150,2" zPosition="0" alphatest="on" />
</screen>""" % 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()
9 changes: 9 additions & 0 deletions src/MovieSelection.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions src/MovieSelectionMenu.py
Expand Up @@ -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")))

Expand Down Expand Up @@ -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"],
{
Expand Down

0 comments on commit 5057d8c

Please sign in to comment.