diff options
Diffstat (limited to 'lib/python/Plugins/Extensions')
14 files changed, 196 insertions, 139 deletions
diff --git a/lib/python/Plugins/Extensions/CutListEditor/keymap.xml b/lib/python/Plugins/Extensions/CutListEditor/keymap.xml index 741d9eb6..ae4fbb4b 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/keymap.xml +++ b/lib/python/Plugins/Extensions/CutListEditor/keymap.xml @@ -33,7 +33,7 @@ <map context="CutListEditorActions"> <!-- <key id="KEY_NEXT" mapto="setIn" flags="m" /> <key id="KEY_PREVIOUS" mapto="setOut" flags="m" /> --> - <key id="KEY_0" mapto="setMark" flags="m" /> +<!-- <key id="KEY_0" mapto="setMark" flags="m" /> --> <!-- <key id="KEY_CHANNELUP" mapto="addMark" flags="m" /> <key id="KEY_CHANNELDOWN" mapto="removeMark" flags="m" /> --> <key id="KEY_EXIT" mapto="leave" flags="m" /> diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py index 1ef15a53..ed7cfb70 100644 --- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py +++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py @@ -317,7 +317,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_ENDCUT: # remove in/out marks between the new cut for (where, what) in self.cut_list[:]: - if self.cut_start <= where <= self.context_position and what in [0,1]: + if self.cut_start <= where <= self.context_position and what in (0,1): self.cut_list.remove((where, what)) bisect.insort(self.cut_list, (self.cut_start, 1)) @@ -350,7 +350,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_REMOVEBEFORE: # remove in/out marks before current position for (where, what) in self.cut_list[:]: - if where <= self.context_position and what in [0,1]: + if where <= self.context_position and what in (0,1): self.cut_list.remove((where, what)) # add 'in' point bisect.insort(self.cut_list, (self.context_position, 0)) @@ -358,7 +358,7 @@ class CutListEditor(Screen, InfoBarBase, InfoBarSeek, InfoBarCueSheetSupport, He elif result == CutListContextMenu.RET_REMOVEAFTER: # remove in/out marks after current position for (where, what) in self.cut_list[:]: - if where >= self.context_position and what in [0,1]: + if where >= self.context_position and what in (0,1): self.cut_list.remove((where, what)) # add 'out' point bisect.insort(self.cut_list, (self.context_position, 1)) diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py index d0c9d3c6..6d9a4491 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/Process.py +++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py @@ -372,11 +372,11 @@ class CheckDiskspaceTask(Task): self.finish(aborted = True) def run(self, callback): + self.callback = callback failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if len(failed_preconditions): callback(self, failed_preconditions) return - self.callback = callback Task.processFinished(self, 0) class PreviewTask(Task): diff --git a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py index 7407263d..a8888da3 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py +++ b/lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py @@ -18,11 +18,12 @@ class FileBrowser(Screen, HelpableScreen): <screen name="FileBrowser" position="100,100" size="520,376" title="DVD File Browser" > <widget name="filelist" position="0,0" size="520,376" scrollbarMode="showOnDemand" /> </screen>""" - def __init__(self, session, scope, settings): + def __init__(self, session, scope, configRef): Screen.__init__(self, session) HelpableScreen.__init__(self) self.scope = scope pattern = "" + self.configRef = configRef currDir = "/" if self.scope == "project": currDir = self.getDir() @@ -31,19 +32,19 @@ class FileBrowser(Screen, HelpableScreen): currDir = self.getDir() pattern = "(?i)^.*\.(ddvdm\.xml)" if self.scope == "menubg": - currDir = self.getDir(settings.menubg) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(jpeg|jpg|jpe|png|bmp)" elif self.scope == "menuaudio": - currDir = self.getDir(settings.menuaudio) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(mp2|m2a|ac3)" elif self.scope == "vmgm": - currDir = self.getDir(settings.vmgm) + currDir = self.getDir(configRef.getValue()) pattern = "(?i)^.*\.(mpg|mpeg)" elif self.scope == "font_face": - currDir = self.getDir(settings.font_face, resolveFilename(SCOPE_FONTS)) + currDir = self.getDir(configRef.getValue(), resolveFilename(SCOPE_FONTS)) pattern = "(?i)^.*\.(ttf)" elif self.scope == "isopath": - currDir = settings.isopath.getValue() + currDir = configRef.getValue() elif self.scope == "image": currDir = resolveFilename(SCOPE_HDD) pattern = "(?i)^.*\.(iso)" @@ -57,11 +58,9 @@ class FileBrowser(Screen, HelpableScreen): "cancel": self.exit }) - def getDir(self, key=None, defaultDir=None): - if key: - settingDir = key.getValue() - if len(settingDir) > 1: - return (settingDir.rstrip("/").rsplit("/",1))[0] + def getDir(self, currentVal=None, defaultDir=None): + if currentVal: + return (currentVal.rstrip("/").rsplit("/",1))[0] return defaultDir or (resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") def ok(self): @@ -70,15 +69,15 @@ class FileBrowser(Screen, HelpableScreen): if self.scope == "image": path = self["filelist"].getCurrentDirectory() or "" if fileExists(path+"VIDEO_TS"): - self.close(path,self.scope) + self.close(path,self.scope,self.configRef) else: ret = self["filelist"].getCurrentDirectory() + '/' + self["filelist"].getFilename() - self.close(ret,self.scope) + self.close(ret,self.scope,self.configRef) def exit(self): if self.scope == "isopath": - self.close(self["filelist"].getCurrentDirectory(),self.scope) - self.close(None,False) + self.close(self["filelist"].getCurrentDirectory(),self.scope,self.configRef) + self.close(None,False,None) class ProjectSettings(Screen,ConfigListScreen): skin = """ @@ -102,18 +101,21 @@ class ProjectSettings(Screen,ConfigListScreen): self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText(_("Load")) - self["key_blue"] = StaticText(_("Save")) + if config.usage.setup_level.index >= 2: # expert+ + self["key_blue"] = StaticText(_("Save")) + else: + self["key_blue"] = StaticText() - infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("Year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename") + if config.usage.setup_level.index >= 2: # expert+ + infotext = _("Available format variables") + ":\n$i=" + _("Track") + ", $t=" + _("Title") + ", $d=" + _("Description") + ", $l=" + _("length") + ", $c=" + _("chapters") + ",\n" + _("Record") + " $T=" + _("Begin time") + ", $Y=" + _("Year") + ", $M=" + _("month") + ", $D=" + _("day") + ",\n$A=" + _("audio tracks") + ", $C=" + _("Channel") + ", $f=" + _("filename") + else: + infotext = "" self["info"] = StaticText(infotext) + self.keydict = {} self.settings = project.settings ConfigListScreen.__init__(self, []) self.initConfigList() - - self.keydict = {} - for key, val in self.settings.dict().iteritems(): - self.keydict[val] = key self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], { @@ -141,9 +143,10 @@ class ProjectSettings(Screen,ConfigListScreen): self.list.append(getConfigListEntry(_("ISO path"), self.settings.isopath)) if authormode.startswith("menu"): self.list.append(getConfigListEntry(_("Menu")+' '+_("template file"), self.settings.menutemplate)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("Title"), self.project.menutemplate.settings.titleformat)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("Subtitles"), self.project.menutemplate.settings.subtitleformat)) - self.list.append(getConfigListEntry(_("Menu")+' '+_("background image"), self.project.menutemplate.settings.menubg)) + if config.usage.setup_level.index >= 2: # expert+ + self.list.append(getConfigListEntry(_("Menu")+' '+_("Title"), self.project.menutemplate.settings.titleformat)) + self.list.append(getConfigListEntry(_("Menu")+' '+_("Subtitles"), self.project.menutemplate.settings.subtitleformat)) + self.list.append(getConfigListEntry(_("Menu")+' '+_("background image"), self.project.menutemplate.settings.menubg)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("headline")+' '+_("color"), self.settings.color_headline)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("text")+' '+_("color"), self.settings.color_button)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("highlighted button")+' '+_("color"), self.settings.color_highlight)) @@ -151,14 +154,20 @@ class ProjectSettings(Screen,ConfigListScreen): #self.list.append(getConfigListEntry(_("Font size")+' ('+_("headline")+', '+_("Title")+', '+_("Subtitles")+')', self.settings.font_size)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("spaces (top, between rows, left)"), self.settings.space)) #self.list.append(getConfigListEntry(_("Menu")+' '+_("Audio"), self.settings.menuaudio)) - if authormode != "data_ts": - self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode)) - if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked": - self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) - else: - self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat)) + if config.usage.setup_level.index >= 2: # expert+ + if authormode != "data_ts": + self.list.append(getConfigListEntry(_("Titleset mode"), self.settings.titlesetmode)) + if self.settings.titlesetmode.getValue() == "single" or authormode == "just_linked": + self.list.append(getConfigListEntry(_("VMGM (intro trailer)"), self.settings.vmgm)) + else: + self.list.append(getConfigListEntry(("DVD data format"), self.settings.dataformat)) self["config"].setList(self.list) + self.keydict = {} + for key, val in self.settings.dict().iteritems(): + self.keydict[val] = key + for key, val in self.project.menutemplate.settings.dict().iteritems(): + self.keydict[val] = key def keyLeft(self): ConfigListScreen.keyLeft(self) @@ -182,8 +191,9 @@ class ProjectSettings(Screen,ConfigListScreen): def ok(self): key = self.keydict[self["config"].getCurrent()[1]] - if key in self.project.filekeys: - self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self.settings) + from DVDProject import ConfigFilename + if type(self["config"].getCurrent()[1]) == ConfigFilename: + self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, key, self["config"].getCurrent()[1]) def cancel(self): self.close(False) @@ -192,26 +202,30 @@ class ProjectSettings(Screen,ConfigListScreen): self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, "project", self.settings) def saveProject(self): - self.applySettings() - ret = self.project.saveProject(resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") - if ret.startswith: - text = _("Save")+' '+_('OK')+':\n'+ret - self.session.open(MessageBox,text,type = MessageBox.TYPE_INFO) - else: - text = _("Save")+' '+_('Error') - self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) + if config.usage.setup_level.index >= 2: # expert+ + self.applySettings() + ret = self.project.saveProject(resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/") + if ret.startswith: + text = _("Save")+' '+_('OK')+':\n'+ret + self.session.open(MessageBox,text,type = MessageBox.TYPE_INFO) + else: + text = _("Save")+' '+_('Error') + self.session.open(MessageBox,text,type = MessageBox.TYPE_ERROR) - def FileBrowserClosed(self, path, scope): + def FileBrowserClosed(self, path, scope, configRef): if scope == "menutemplate": - if not self.project.menutemplate.loadTemplate(path): - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) - else: + if self.project.menutemplate.loadTemplate(path): print "[ProjectSettings] menu template loaded" - - if scope in self.project.filekeys: - self.settings.dict()[scope].setValue(path) - elif scope == "project": - if not self.project.loadProject(path): - self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + configRef.setValue(path) + self.initConfigList() else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + elif scope == "project": + if self.project.loadProject(path): + configRef.setValue(path) self.initConfigList() + else: + self.session.open(MessageBox,self.project.error,MessageBox.TYPE_ERROR) + elif scope: + configRef.setValue(path) + self.initConfigList() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py index 749f80eb..fd4c7134 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleList.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleList.py @@ -44,7 +44,7 @@ class TitleList(Screen, HelpableScreen): "titleProperties": (self.titleProperties, _("Properties of current title"), _("Title properties")), "removeCurrentTitle": (self.removeCurrentTitle, _("Remove currently selected title"), _("Remove title")), "settings": (self.settings, _("Collection settings"), _("Settings")), - "burnProject": (self.burnProject, _("Burn DVD"), _("Burn DVD")), + "burnProject": (self.askBurnProject, _("Burn DVD"), _("Burn DVD")), }) self["MovieSelectionActions"] = HelpableActionMap(self, "MovieSelectionActions", @@ -57,9 +57,9 @@ class TitleList(Screen, HelpableScreen): "cancel": self.leave }) - self["key_red"] = StaticText(_("Remove title")) + self["key_red"] = StaticText() self["key_green"] = StaticText(_("Add title")) - self["key_yellow"] = StaticText(_("Title properties")) + self["key_yellow"] = StaticText() self["key_blue"] = StaticText(_("Settings")) self["title_label"] = StaticText() @@ -74,6 +74,7 @@ class TitleList(Screen, HelpableScreen): self["titles"] = List(list = [ ], enableWrapAround = True, item_height=30, fonts = [gFont("Regular", 20)]) self.updateTitleList() + self.previous_size = 0 def checkBackgroundJobs(self): for job in job_manager.getPendingJobs(): @@ -90,19 +91,16 @@ class TitleList(Screen, HelpableScreen): if self.backgroundJob: j = self.backgroundJob menu.append(("%s: %s (%d%%)" % (j.getStatustext(), j.name, int(100*j.progress/float(j.end))), self.showBackgroundJob)) + menu.append((_("DVD media toolbox"), self.toolbox)) + menu.append((_("Preview menu"), self.previewMenu)) if self.project.settings.output.getValue() == "dvd": - menu.append((_("Burn DVD"), self.burnProject)) + if len(self["titles"].list): + menu.append((_("Burn DVD"), self.burnProject)) elif self.project.settings.output.getValue() == "iso": menu.append((_("Create DVD-ISO"), self.burnProject)) menu.append((_("Burn existing image to DVD"), self.selectImage)) - menu.append((_("DVD media toolbox"), self.toolbox)) - menu.append((_("Preview menu"), self.previewMenu)) - menu.append((_("Collection settings"), self.settings)) - menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Edit chapters of current title"), self.editTitle)) - menu.append((_("Properties of current title"), self.titleProperties)) - menu.append((_("Add a new title"), self.addTitle)) - menu.append((_("Remove title"), self.removeCurrentTitle)) + menu.append((_("Reset and renumerate title names"), self.resetTitles)) menu.append((_("Exit"), self.leave)) self.session.openWithCallback(self.menuCallback, ChoiceBox, title="", list=menu) @@ -199,7 +197,13 @@ class TitleList(Screen, HelpableScreen): self["error_label"].show() return False - def burnProject(self): + def askBurnProject(self): + if len(self["titles"].list): + self.session.openWithCallback(self.burnProject,MessageBox,text = _("Do you want to burn this collection to DVD medium?"), type = MessageBox.TYPE_YESNO) + + def burnProject(self, answer=True): + if not answer: + return if self.project.settings.authormode.getValue() == "data_ts": job = Process.DVDdataJob(self.project) job_manager.AddJob(job) @@ -211,7 +215,7 @@ class TitleList(Screen, HelpableScreen): job_manager.in_background = False self.session.openWithCallback(self.JobViewCB, JobView, job) - def burnISO(self, path, scope): + def burnISO(self, path, scope, configRef): if path: job = Process.DVDisoJob(self.project, path) job_manager.AddJob(job) @@ -235,6 +239,12 @@ class TitleList(Screen, HelpableScreen): totalsize += title.estimatedDiskspace self["titles"].list = res self.updateSize(totalsize) + if len(res): + self["key_red"].text = _("Remove title") + self["key_yellow"].text = _("Title properties") + else: + self["key_red"].text = "" + self["key_yellow"].text = "" def updateSize(self, totalsize): size = int((totalsize/1024)/1024) @@ -244,14 +254,19 @@ class TitleList(Screen, HelpableScreen): percent = 100 * size / float(max_DL) self["space_label"].text = "%d MB - " % size + _("exceeds dual layer medium!") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) + if self.previous_size < max_DL: + self.session.open(MessageBox,text = _("exceeds dual layer medium!"), type = MessageBox.TYPE_ERROR) elif size > max_SL: percent = 100 * size / float(max_DL) self["space_label"].text = "%d MB " % size + _("of a DUAL layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) + if self.previous_size < max_SL: + self.session.open(MessageBox,text = _("Your collection exceeds the size of a single layer medium, you will need a blank dual layer DVD!"), type = MessageBox.TYPE_INFO) elif size < max_SL: percent = 100 * size / float(max_SL) self["space_label"].text = "%d MB " % size + _("of a SINGLE layer medium used.") + " (%.2f%% " % (100-percent) + _("free") + ")" self["space_bar"].value = int(percent) + self.previous_size = size def getCurrentTitle(self): t = self["titles"].getCurrent() diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py index 63ae6c1f..1c2099fb 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py +++ b/lib/python/Plugins/Extensions/DVDBurn/TitleProperties.py @@ -72,19 +72,19 @@ class TitleProperties(Screen,ConfigListScreen): self.list.append(getConfigListEntry("DVD " + _("Track"), self.properties.position)) self.list.append(getConfigListEntry("DVD " + _("Title"), self.properties.menutitle)) self.list.append(getConfigListEntry("DVD " + _("Description"), self.properties.menusubtitle)) - for audiotrack in self.properties.audiotracks: - DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() - self.list.append(getConfigListEntry(_("burn audio track (%s)") % DVB_aud, audiotrack.active)) - if audiotrack.active.getValue(): - self.list.append(getConfigListEntry(_("audio track (%s) format") % DVB_aud, audiotrack.format)) - self.list.append(getConfigListEntry(_("audio track (%s) language") % DVB_aud, audiotrack.language)) - - self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) - if self.properties.aspect.getValue() == "16:9": - self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.widescreen)) - else: - self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop)) - + if config.usage.setup_level.index >= 2: # expert+ + for audiotrack in self.properties.audiotracks: + DVB_aud = audiotrack.DVB_lang.getValue() or audiotrack.pid.getValue() + self.list.append(getConfigListEntry(_("burn audio track (%s)") % DVB_aud, audiotrack.active)) + if audiotrack.active.getValue(): + self.list.append(getConfigListEntry(_("audio track (%s) format") % DVB_aud, audiotrack.format)) + self.list.append(getConfigListEntry(_("audio track (%s) language") % DVB_aud, audiotrack.language)) + + self.list.append(getConfigListEntry("DVD " + _("Aspect Ratio"), self.properties.aspect)) + if self.properties.aspect.getValue() == "16:9": + self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.widescreen)) + else: + self.list.append(getConfigListEntry("DVD " + "widescreen", self.properties.crop)) if len(title.chaptermarks) == 0: self.list.append(getConfigListEntry(_("Auto chapter split every ? minutes (0=never)"), self.properties.autochapter)) infotext = "DVB " + _("Title") + ': ' + title.DVBname + "\n" + _("Description") + ': ' + title.DVBdescr + "\n" + _("Channel") + ': ' + title.DVBchannel + '\n' + _("Begin time") + title.formatDVDmenuText(": $D.$M.$Y, $T\n", self.title_idx+1) @@ -154,7 +154,7 @@ class LanguageChoices(): if len(key) == 2: self.langdict[key] = val[0] for key, val in self.langdict.iteritems(): - if key not in [syslang, 'en']: + if key not in (syslang, 'en'): self.langdict[key] = val self.choices.append((key, val)) self.choices.sort() @@ -164,8 +164,7 @@ class LanguageChoices(): def getLanguage(self, DVB_lang): DVB_lang = DVB_lang.lower() - stripwords = ["stereo", "audio", "description", "2ch", "dolby digital"] - for word in stripwords: + for word in ("stereo", "audio", "description", "2ch", "dolby digital"): DVB_lang = DVB_lang.replace(word,"").strip() for key, val in LanguageCodes.iteritems(): if DVB_lang.find(key.lower()) == 0: @@ -183,4 +182,4 @@ class LanguageChoices(): return key return "nolang" -languageChoices = LanguageChoices()
\ No newline at end of file +languageChoices = LanguageChoices() diff --git a/lib/python/Plugins/Extensions/DVDBurn/plugin.py b/lib/python/Plugins/Extensions/DVDBurn/plugin.py index 29076cea..45f438da 100644 --- a/lib/python/Plugins/Extensions/DVDBurn/plugin.py +++ b/lib/python/Plugins/Extensions/DVDBurn/plugin.py @@ -12,5 +12,6 @@ def main_add(session, service, **kwargs): dvdburn.selectedSource(service) def Plugins(**kwargs): - return [PluginDescriptor(name="DVD Burn", description=_("Burn to DVD..."), where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), - PluginDescriptor(name="DVD Burn", description=_("Burn to DVD..."), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] + descr = _("Burn to DVD...") + return [PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_MOVIELIST, fnc=main_add, icon="dvdburn.png"), + PluginDescriptor(name="DVD Burn", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main, icon="dvdburn.png") ] diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 8e2a9f3a..ebcf4f81 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -14,6 +14,7 @@ from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase from Components.config import config from Tools.Directories import pathExists, fileExists from Components.Harddisk import harddiskmanager +from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier import servicedvd # load c++ part of dvd player plugin @@ -345,28 +346,15 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP }) self.onClose.append(self.__onClose) - self.physicalDVD = False - self.dvd_device = None + hotplugNotifier.append(self.hotplugCB) + if dvd_device: - self.dvd_device = dvd_device - self.physicalDVD = True + self.physicalDVD = True else: - devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) - if pathExists(devicepath): - from Components.Scanner import scanDevice - res = scanDevice(devicepath) - list = [ (r.description, r, res[r], self.session) for r in res ] - if list: - (desc, scanner, files, session) = list[0] - for file in files: - print file - if file.mimetype == "video/x-dvd": - self.dvd_device = devicepath - print "physical dvd found:", self.dvd_device - self.physicalDVD = True + self.scanHotplug() self.dvd_filelist = dvd_filelist - self.onFirstExecBegin.append(self.showFileBrowser) + self.onFirstExecBegin.append(self.opened) self.service = None self.in_menu = False @@ -511,8 +499,10 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def askLeavePlayer(self): choices = [(_("Exit"), "exit"), (_("Continue playing"), "play")] - if not self.physicalDVD: + if True or not self.physicalDVD: choices.insert(1,(_("Return to file browser"), "browser")) + if self.physicalDVD and not self.session.nav.getCurrentlyPlayingServiceReference().toString().endswith(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())): + choices.insert(0,(_("Play DVD"), "playPhysical" )) self.session.openWithCallback(self.exitCB, ChoiceBox, title=_("Leave DVD Player?"), list = choices) def sendKey(self, key): @@ -581,23 +571,22 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def keyCancel(self): self.askLeavePlayer() - def showFileBrowser(self): - if self.physicalDVD and len(self.dvd_filelist) == 0: - if self.dvd_device == harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()): - self.session.openWithCallback(self.DVDdriveCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) - else: - self.DVDdriveCB(True) - elif len(self.dvd_filelist) == 1: + def opened(self): + if len(self.dvd_filelist) == 1: + # opened via autoplay self.FileBrowserClosed(self.dvd_filelist[0]) + elif self.physicalDVD: + # opened from menu with dvd in drive + self.session.openWithCallback(self.playPhysicalCB, MessageBox, text=_("Do you want to play DVD in drive?"), timeout=5 ) else: + # opened from menu without dvd in drive self.session.openWithCallback(self.FileBrowserClosed, FileBrowser, self.dvd_filelist) - - def DVDdriveCB(self, answer): + + def playPhysicalCB(self, answer): if answer == True: - self.FileBrowserClosed(self.dvd_device) + self.FileBrowserClosed(harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD())) else: self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) - self.physicalDVD = False def FileBrowserClosed(self, val): curref = self.session.nav.getCurrentlyPlayingServiceReference() @@ -627,13 +616,18 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP #else if self.service: self.service = None - self.showFileBrowser() + self.session.openWithCallback(self.FileBrowserClosed, FileBrowser) + if answer[1] == "playPhysical": + if self.service: + self.service = None + self.playPhysicalCB(True) else: pass def __onClose(self): self.restore_infobar_seek_config() self.session.nav.playService(self.oldService) + hotplugNotifier.remove(self.hotplugCB) def playLastCB(self, answer): # overwrite infobar cuesheet function print "playLastCB", answer, self.resume_point @@ -660,6 +654,30 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def calcRemainingTime(self): return 0 + def hotplugCB(self, dev, media_state): + print "[hotplugCB]", dev, media_state + if dev == harddiskmanager.getCD(): + if media_state == "1": + self.scanHotplug() + else: + self.physicalDVD = False + + def scanHotplug(self): + devicepath = harddiskmanager.getAutofsMountpoint(harddiskmanager.getCD()) + if pathExists(devicepath): + from Components.Scanner import scanDevice + res = scanDevice(devicepath) + list = [ (r.description, r, res[r], self.session) for r in res ] + if list: + (desc, scanner, files, session) = list[0] + for file in files: + print file + if file.mimetype == "video/x-dvd": + print "physical dvd found:", devicepath + self.physicalDVD = True + return + self.physicalDVD = False + def main(session, **kwargs): session.open(DVDPlayer) @@ -705,7 +723,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "DVD", - description = "Play DVD", + description = _("Play DVD"), openfnc = filescan_open, )] diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index c2590af5..e35f2807 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -103,7 +103,10 @@ eServiceDVD::eServiceDVD(const char *filename): // create handle ddvd_set_dvd_path(m_ddvdconfig, filename); ddvd_set_ac3thru(m_ddvdconfig, 0); - ddvd_set_language(m_ddvdconfig, "de"); + + std::string ddvd_language; + if (!ePythonConfigQuery::getConfigValue("config.osd.language", ddvd_language)) + ddvd_set_language(m_ddvdconfig, (ddvd_language.substr(0,2)).c_str()); int fd = open("/proc/stb/video/aspect", O_RDONLY); if (fd > -1) diff --git a/lib/python/Plugins/Extensions/FileManager/plugin.py b/lib/python/Plugins/Extensions/FileManager/plugin.py index 12389813..62c9e7b2 100644 --- a/lib/python/Plugins/Extensions/FileManager/plugin.py +++ b/lib/python/Plugins/Extensions/FileManager/plugin.py @@ -59,5 +59,6 @@ def main(session, **kwargs): session.open(FileManager) def Plugins(**kwargs): - return [PluginDescriptor(name="File-Manager", description="Lets you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), - PluginDescriptor(name="File-Manager", description="Lets you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)] + descr = _("Lets you view/edit files in your Dreambox") + return [PluginDescriptor(name="File-Manager", description=descr, where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), + PluginDescriptor(name="File-Manager", description=descr, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)] diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py index 3e023841..e8504ff0 100644 --- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py @@ -148,7 +148,6 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.player.show() return NumberActionMap.action(self, contexts, action) - self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions", { "ok": (self.ok, _("add file to playlist")), @@ -224,7 +223,8 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.__event_tracker = ServiceEventTracker(screen=self, eventmap= { iPlayableService.evUpdatedInfo: self.__evUpdatedInfo, - iPlayableService.evUser+11: self.__evDecodeError, + iPlayableService.evUser+10: self.__evAudioDecodeError, + iPlayableService.evUser+11: self.__evVideoDecodeError, iPlayableService.evUser+12: self.__evPluginError, iPlayableService.evUser+13: self["coverArt"].embeddedCoverArt }) @@ -268,11 +268,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB print "[__evUpdatedInfo] title %d of %d (%s)" % (currenttitle, totaltitles, sTitle) self.readTitleInformation() - def __evDecodeError(self): + def __evAudioDecodeError(self): + currPlay = self.session.nav.getCurrentService() + sAudioType = currPlay.info().getInfoString(iServiceInformation.sUser+10) + print "[__evAudioDecodeError] audio-codec %s can't be decoded by hardware" % (sAudioType) + self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sAudioType, type = MessageBox.TYPE_INFO,timeout = 20 ) + + def __evVideoDecodeError(self): currPlay = self.session.nav.getCurrentService() sVideoType = currPlay.info().getInfoString(iServiceInformation.sVideoType) - print "[__evDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType) - self.session.open(MessageBox, _("This Dreambox can't decode %s video streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 ) + print "[__evVideoDecodeError] video-codec %s can't be decoded by hardware" % (sVideoType) + self.session.open(MessageBox, _("This Dreambox can't decode %s streams!") % sVideoType, type = MessageBox.TYPE_INFO,timeout = 20 ) def __evPluginError(self): currPlay = self.session.nav.getCurrentService() @@ -379,7 +385,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB self.updateCurrentInfo() def showAfterSeek(self): - self.show() + pass def showAfterCuesheetOperation(self): self.show() @@ -984,7 +990,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Movie", - description = "View Movies...", + description = _("View Movies..."), openfnc = filescan_open, ), Scanner(mimetypes = ["video/x-vcd"], @@ -994,7 +1000,7 @@ def filescan(**kwargs): ScanPath(path = "MPEGAV", with_subdirs = False), ], name = "Video CD", - description = "View Video CD...", + description = _("View Video CD..."), openfnc = filescan_open, ), Scanner(mimetypes = ["audio/mpeg", "audio/x-wav", "application/ogg", "audio/x-flac"], @@ -1003,7 +1009,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Music", - description = "Play Music...", + description = _("Play Music..."), openfnc = filescan_open, )] try: @@ -1015,7 +1021,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Audio-CD", - description = "Play Audio-CD...", + description = _("Play Audio-CD..."), openfnc = audioCD_open, )) return mediatypes diff --git a/lib/python/Plugins/Extensions/MediaScanner/plugin.py b/lib/python/Plugins/Extensions/MediaScanner/plugin.py index 2c31197d..0cefa353 100755 --- a/lib/python/Plugins/Extensions/MediaScanner/plugin.py +++ b/lib/python/Plugins/Extensions/MediaScanner/plugin.py @@ -23,16 +23,16 @@ def mountpoint_choosen(option): list = [ (r.description, r, res[r], session) for r in res ] - if list == [ ]: + if not list: from Screens.MessageBox import MessageBox if access(mountpoint, F_OK|R_OK): - session.open(MessageBox, "No displayable files on this medium found!", MessageBox.TYPE_ERROR) + session.open(MessageBox, _("No displayable files on this medium found!"), MessageBox.TYPE_ERROR) else: print "ignore", mountpoint, "because its not accessible" return session.openWithCallback(execute, ChoiceBox, - title = "The following files were found...", + title = _("The following files were found..."), list = list) def scan(session): @@ -41,7 +41,7 @@ def scan(session): from Components.Harddisk import harddiskmanager parts = [ (r.description, r.mountpoint, session) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)] - if len(parts): + if parts: for x in parts: if not access(x[1], F_OK|R_OK): parts.remove(x) @@ -91,7 +91,7 @@ def autostart(reason, **kwargs): def Plugins(**kwargs): return [ - PluginDescriptor(name="MediaScanner", description="Scan Files...", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), + PluginDescriptor(name="MediaScanner", description=_("Scan Files..."), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main), # PluginDescriptor(where = PluginDescriptor.WHERE_MENU, fnc=menuHook), PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) diff --git a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py index 05adb633..10e4e514 100644 --- a/lib/python/Plugins/Extensions/PicturePlayer/plugin.py +++ b/lib/python/Plugins/Extensions/PicturePlayer/plugin.py @@ -586,7 +586,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Pictures", - description = "View Photos...", + description = _("View Photos..."), openfnc = filescan_open, ) diff --git a/lib/python/Plugins/Extensions/SocketMMI/plugin.py b/lib/python/Plugins/Extensions/SocketMMI/plugin.py index 4eadf2ea..387c8306 100644 --- a/lib/python/Plugins/Extensions/SocketMMI/plugin.py +++ b/lib/python/Plugins/Extensions/SocketMMI/plugin.py @@ -22,6 +22,6 @@ def autostart(reason, **kwargs): socketHandler = SocketMMIMessageHandler() def Plugins(**kwargs): - return [ PluginDescriptor(name = "SocketMMI", description = "Python frontend for /tmp/mmi.socket", where = PluginDescriptor.WHERE_MENU, fnc = menu), + return [ PluginDescriptor(name = "SocketMMI", description = _("Python frontend for /tmp/mmi.socket"), where = PluginDescriptor.WHERE_MENU, fnc = menu), PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart), PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) ] |
