From: ghost Date: Tue, 22 Dec 2009 15:08:21 +0000 (+0100) Subject: Merge branch 'bug_236_recordpath' X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=4e8904ef73e3ce5e275a1f5fbf369c4f9dab648e;hp=-c Merge branch 'bug_236_recordpath' --- 4e8904ef73e3ce5e275a1f5fbf369c4f9dab648e diff --combined data/menu.xml index a96912a,403e0b8..59195f1 --- a/data/menu.xml +++ b/data/menu.xml @@@ -70,7 -70,7 +70,7 @@@ --> - + @@@ -104,7 -104,6 +104,7 @@@ self.session.openWithCallback(msgClosed 2 3 - 1 + 1 + 1 diff --combined lib/python/Components/FileList.py index 38b0854,a0f66bd..b187ee3 --- a/lib/python/Components/FileList.py +++ b/lib/python/Components/FileList.py @@@ -3,7 -3,7 +3,7 @@@ from os import path as os_path, listdi from MenuList import MenuList from Components.Harddisk import harddiskmanager - from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename + from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename, fileExists from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \ eServiceReference, eServiceCenter, gFont @@@ -23,7 -23,6 +23,7 @@@ EXTENSIONS = "ts": "movie", "avi": "movie", "divx": "movie", + "m4v": "movie", "mpg": "movie", "mpeg": "movie", "mkv": "movie", @@@ -160,8 -159,11 +160,11 @@@ class FileList(MenuList) directories.sort() files.sort() else: - if os_path.exists(directory): - files = listdir(directory) + if fileExists(directory): + try: + files = listdir(directory) + except: + files = [] files.sort() tmpfiles = files[:] for x in tmpfiles: @@@ -374,8 -376,11 +377,11 @@@ class MultiFileSelectList(FileList) directories.sort() files.sort() else: - if os_path.exists(directory): - files = listdir(directory) + if fileExists(directory): + try: + files = listdir(directory) + except: + files = [] files.sort() tmpfiles = files[:] for x in tmpfiles: diff --combined lib/python/Components/config.py index 1f8709b,450c302..a6007b1 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@@ -1,6 -1,6 +1,6 @@@ from enigma import getPrevAsciiCode from Tools.NumericalTextInput import NumericalTextInput - from Tools.Directories import resolveFilename, SCOPE_CONFIG + from Tools.Directories import resolveFilename, SCOPE_CONFIG, fileExists from Components.Harddisk import harddiskmanager from copy import copy as copy_copy from os import path as os_path @@@ -1017,40 -1017,6 +1017,40 @@@ class ConfigPassword(ConfigText) ConfigText.onDeselect(self, session) self.hidden = True +# lets the user select between [min, min+stepwidth, min+(stepwidth*2)..., maxval] with maxval <= max depending +# on the stepwidth +# min, max, stepwidth, default are int values +# wraparound: pressing RIGHT key at max value brings you to min value and vice versa if set to True +class ConfigSelectionNumber(ConfigSelection): + def __init__(self, min, max, stepwidth, default = None, wraparound = False): + self.wraparound = wraparound + if default is None: + default = min + default = str(default) + choices = [] + step = min + while step <= max: + choices.append(str(step)) + step += stepwidth + + ConfigSelection.__init__(self, choices, default) + + def getValue(self): + return int(ConfigSelection.getValue(self)) + + def setValue(self, val): + ConfigSelection.setValue(self, str(val)) + + def handleKey(self, key): + if not self.wraparound: + if key == KEY_RIGHT: + if len(self.choices) == (self.choices.index(self.value) + 1): + return + if key == KEY_LEFT: + if self.choices.index(self.value) == 0: + return + ConfigSelection.handleKey(self, key) + class ConfigNumber(ConfigText): def __init__(self, default = 0): ConfigText.__init__(self, str(default), fixed_size = False) @@@ -1283,7 -1249,6 +1283,6 @@@ class ConfigLocations(ConfigElement) self.default = default self.locations = [] self.mountpoints = [] - harddiskmanager.on_partition_list_change.append(self.mountpointsChanged) self.value = default[:] def setValue(self, value): @@@ -1320,7 -1285,7 +1319,7 @@@ locations = [[x, None, False, False] for x in tmp] self.refreshMountpoints() for x in locations: - if os_path.exists(x[0]): + if fileExists(x[0]): x[1] = self.getMountpoint(x[0]) x[2] = True self.locations = locations @@@ -1339,20 -1304,11 +1338,11 @@@ return False return self.tostring([x[0] for x in locations]) != sv - def mountpointsChanged(self, action, dev): - print "Mounts changed: ", action, dev - mp = dev.mountpoint+"/" - if action == "add": - self.addedMount(mp) - elif action == "remove": - self.removedMount(mp) - self.refreshMountpoints() - def addedMount(self, mp): for x in self.locations: if x[1] == mp: x[2] = True - elif x[1] == None and os_path.exists(x[0]): + elif x[1] == None and fileExists(x[0]): x[1] = self.getMountpoint(x[0]) x[2] = True @@@ -1362,7 -1318,7 +1352,7 @@@ x[2] = False def refreshMountpoints(self): - self.mountpoints = [p.mountpoint + "/" for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] + self.mountpoints = [p.mountpoint for p in harddiskmanager.getMountedPartitions() if p.mountpoint != "/"] self.mountpoints.sort(key = lambda x: -len(x)) def checkChangedMountpoints(self): diff --combined lib/python/Screens/InfoBarGenerics.py index 8f9b670,ed41bb2..a3e56a4 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@@ -10,6 -10,7 +10,7 @@@ from Components.ServiceEventTracker imp from Components.Sources.Boolean import Boolean from Components.config import config, ConfigBoolean, ConfigClock from Components.SystemInfo import SystemInfo + from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath from EpgSelection import EPGSelection from Plugins.Plugin import PluginDescriptor @@@ -28,7 -29,7 +29,7 @@@ from Screens.TimeDateInput import TimeD from ServiceReference import ServiceReference from Tools import Notifications - from Tools.Directories import SCOPE_HDD, resolveFilename, fileExists + from Tools.Directories import fileExists from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \ iPlayableService, eServiceReference, eEPGCache @@@ -691,6 -692,8 +692,6 @@@ class InfoBarSeek iPlayableService.evSOF: self.__evSOF, }) - self.minSpeedBackward = useSeekBackHack and 16 or 0 - class InfoBarSeekActionMap(HelpableActionMap): def __init__(self, screen, *args, **kwargs): HelpableActionMap.__init__(self, screen, *args, **kwargs) @@@ -737,19 -740,24 +738,19 @@@ self.__seekableStatusChanged() def makeStateForward(self, n): - minspeed = config.seek.stepwise_minspeed.value - repeat = int(config.seek.stepwise_repeat.value) - if minspeed != "Never" and n >= int(minspeed) and repeat > 1: - return (0, n * repeat, repeat, ">> %dx" % n) - else: +# minspeed = config.seek.stepwise_minspeed.value +# repeat = int(config.seek.stepwise_repeat.value) +# if minspeed != "Never" and n >= int(minspeed) and repeat > 1: +# return (0, n * repeat, repeat, ">> %dx" % n) +# else: return (0, n, 0, ">> %dx" % n) def makeStateBackward(self, n): - minspeed = config.seek.stepwise_minspeed.value - repeat = int(config.seek.stepwise_repeat.value) - if self.minSpeedBackward and n < self.minSpeedBackward: - r = (self.minSpeedBackward - 1)/ n + 1 - if minspeed != "Never" and n >= int(minspeed) and repeat > 1: - r = max(r, repeat) - return (0, -n * r, r, "<< %dx" % n) - elif minspeed != "Never" and n >= int(minspeed) and repeat > 1: - return (0, -n * repeat, repeat, "<< %dx" % n) - else: +# minspeed = config.seek.stepwise_minspeed.value +# repeat = int(config.seek.stepwise_repeat.value) +# if minspeed != "Never" and n >= int(minspeed) and repeat > 1: +# return (0, -n * repeat, repeat, "<< %dx" % n) +# else: return (0, -n, 0, "<< %dx" % n) def makeStateSlowMotion(self, n): @@@ -869,7 -877,7 +870,7 @@@ if config.seek.on_pause.value == "play": self.unPauseService() elif config.seek.on_pause.value == "step": - self.doSeekRelative(0) + self.doSeekRelative(1) elif config.seek.on_pause.value == "last": self.setSeekState(self.lastseekstate) self.lastseekstate = self.SEEK_STATE_PLAY @@@ -942,7 -950,7 +943,7 @@@ self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) self.doSeekRelative(-6) elif seekstate == self.SEEK_STATE_PAUSE: - self.doSeekRelative(-3) + self.doSeekRelative(-1) elif self.isStateForward(seekstate): speed = seekstate[1] if seekstate[2]: @@@ -1205,7 -1213,10 +1206,7 @@@ class InfoBarTimeshift self.setSeekState(self.SEEK_STATE_PAUSE) if back: - self.doSeek(-5) # seek some gops before end self.ts_rewind_timer.start(200, 1) - else: - self.doSeek(-1) # seek 1 gop before end def rewindService(self): self.setSeekState(self.makeStateBackward(int(config.seek.enter_backward.value))) @@@ -1474,7 -1485,7 +1475,7 @@@ class InfoBarInstantRecord if isinstance(serviceref, eServiceReference): serviceref = ServiceReference(serviceref) - recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = config.movielist.last_videodir.value) + recording = RecordTimerEntry(serviceref, begin, end, name, description, eventid, dirname = preferredInstantRecordPath()) recording.dontSave = True if event is None or limitEvent == False: @@@ -1575,9 -1586,9 +1576,9 @@@ self.session.nav.RecordTimer.timeChanged(entry) def instantRecord(self): - dir = config.movielist.last_videodir.value - if not fileExists(dir, 'w'): - dir = resolveFilename(SCOPE_HDD) + dir = preferredInstantRecordPath() + if not dir or not fileExists(dir, 'w'): + dir = defaultMoviePath() try: stat = os_stat(dir) except: @@@ -1659,46 -1670,17 +1660,46 @@@ class InfoBarAudioSelection else: break + availableKeys = [] + usedKeys = [] + if SystemInfo["CanDownmixAC3"]: - tlist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), - ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), - ("--", "")] + tlist - keys = [ "red", "green", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n - selection += 3 - else: - tlist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode"), ("--", "")] + tlist - keys = [ "red", "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] + [""]*n + flist = [(_("AC3 downmix") + " - " +(_("Off"), _("On"))[config.av.downmix_ac3.value and 1 or 0], "CALLFUNC", self.changeAC3Downmix), + ((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] + usedKeys.extend(["red", "green"]) + availableKeys.extend(["yellow", "blue"]) selection += 2 - self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") + else: + flist = [((_("Left"), _("Stereo"), _("Right"))[self.audioChannel.getCurrentChannel()], "mode")] + usedKeys.extend(["red"]) + availableKeys.extend(["green", "yellow", "blue"]) + selection += 1 + + if hasattr(self, "runPlugin"): + class PluginCaller: + def __init__(self, fnc, *args): + self.fnc = fnc + self.args = args + def __call__(self, *args, **kwargs): + self.fnc(*self.args) + + Plugins = [ (p.name, PluginCaller(self.runPlugin, p)) for p in plugins.getPlugins(where = PluginDescriptor.WHERE_AUDIOMENU) ] + + for p in Plugins: + selection += 1 + flist.append((p[0], "CALLFUNC", p[1])) + if availableKeys: + usedKeys.append(availableKeys[0]) + del availableKeys[0] + else: + usedKeys.append("") + + flist.append(("--", "")) + usedKeys.append("") + selection += 1 + + keys = usedKeys + [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ] + [""] * n + self.session.openWithCallback(self.audioSelected, ChoiceBox, title=_("Select audio track"), list = flist + tlist, selection = selection, keys = keys, skin_name = "AudioTrackSelection") else: del self.audioTracks diff --combined lib/python/Screens/TimerEntry.py index c6b0db8,5813bac..b231b56 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@@ -8,12 -8,11 +8,12 @@@ from Components.MenuList import MenuLis from Components.Button import Button from Components.Label import Label from Components.Pixmap import Pixmap +from Components.SystemInfo import SystemInfo + from Components.UsageConfig import defaultMoviePath from Screens.MovieSelection import getPreferredTagEditor from Screens.LocationBox import MovieLocationBox from Screens.ChoiceBox import ChoiceBox from RecordTimer import AFTEREVENT - from Tools.Directories import resolveFilename, SCOPE_HDD from enigma import eEPGCache from time import localtime, mktime, time, strftime from datetime import datetime @@@ -94,11 -93,7 +94,11 @@@ class TimerEntry(Screen, ConfigListScre day[weekday] = 1 self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay]) - self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent) + if SystemInfo["DeepstandbySupport"]: + shutdownString = _("go to deep standby") + else: + shutdownString = _("shut down") + self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto"))], default = afterevent) self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type) self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False) self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False) @@@ -111,7 -106,7 +111,7 @@@ self.timerentry_starttime = ConfigClock(default = self.timer.begin) self.timerentry_endtime = ConfigClock(default = self.timer.end) - default = self.timer.dirname or resolveFilename(SCOPE_HDD) + default = self.timer.dirname or defaultMoviePath() tmp = config.movielist.videodirs.value if default not in tmp: tmp.append(default) @@@ -278,9 -273,10 +278,10 @@@ self.timer.service_ref = self.timerentry_service_ref self.timer.tags = self.timerentry_tags - self.timer.dirname = self.timerentry_dirname.value - config.movielist.last_timer_videodir.value = self.timer.dirname - config.movielist.last_timer_videodir.save() + if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath(): + self.timer.dirname = self.timerentry_dirname.value + config.movielist.last_timer_videodir.value = self.timer.dirname + config.movielist.last_timer_videodir.save() if self.timerentry_type.value == "once": self.timer.begin, self.timer.end = self.getBeginEnd()