Index: lib/python/Screens/InfoBarGenerics.py =================================================================== --- lib/python/Screens/InfoBarGenerics.py (revision 23912) +++ lib/python/Screens/InfoBarGenerics.py (working copy) @@ -10,6 +10,7 @@ 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 @@ -29,7 +30,7 @@ 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 @@ -1455,7 +1456,7 @@ 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: @@ -1556,9 +1557,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: Index: lib/python/Screens/TimerEntry.py =================================================================== --- lib/python/Screens/TimerEntry.py (revision 23912) +++ lib/python/Screens/TimerEntry.py (working copy) @@ -8,11 +8,11 @@ from Components.Button import Button from Components.Label import Label from Components.Pixmap import Pixmap +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 @@ -106,7 +106,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) @@ -273,9 +273,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() Index: lib/python/Screens/RecordPaths.py =================================================================== --- lib/python/Screens/RecordPaths.py (revision 0) +++ lib/python/Screens/RecordPaths.py (revision 0) @@ -0,0 +1,194 @@ +from Screens.Screen import Screen +from Screens.LocationBox import MovieLocationBox, TimeshiftLocationBox +from Screens.MessageBox import MessageBox +from Components.Label import Label +from Components.config import config, ConfigSelection, getConfigListEntry, configfile +from Components.ConfigList import ConfigListScreen +from Components.ActionMap import ActionMap +from Tools.Directories import fileExists + + +class RecordPathsSettings(Screen,ConfigListScreen): + skin = """ + + + + + + + """ + + def __init__(self, session): + from Components.Sources.StaticText import StaticText + Screen.__init__(self, session) + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + ConfigListScreen.__init__(self, []) + self.initConfigList() + + self["setupActions"] = ActionMap(["SetupActions", "ColorActions"], + { + "green": self.save, + "red": self.cancel, + "cancel": self.cancel, + "ok": self.ok, + }, -2) + + def checkReadWriteDir(self, configele): + print "checkReadWrite: ", configele.value + if configele.value in [x[0] for x in self.styles] or fileExists(configele.value, "w"): + configele.last_value = configele.value + return True + else: + dir = configele.value + configele.value = configele.last_value + self.session.open( + MessageBox, + _("The directory %s is not writable.\nMake sure you select a writable directory instead.")%dir, + type = MessageBox.TYPE_ERROR + ) + return False + + def initConfigList(self): + self.styles = [ ("", _("")), ("", _("")), ("", _("")) ] + styles_keys = [x[0] for x in self.styles] + tmp = config.movielist.videodirs.value + default = config.usage.default_path.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + print "DefaultPath: ", default, tmp + self.default_dirname = ConfigSelection(default = default, choices = tmp) + tmp = config.movielist.videodirs.value + default = config.usage.timer_path.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + print "TimerPath: ", default, tmp + self.timer_dirname = ConfigSelection(default = default, choices = self.styles+tmp) + tmp = config.movielist.videodirs.value + default = config.usage.instantrec_path.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + print "InstantrecPath: ", default, tmp + self.instantrec_dirname = ConfigSelection(default = default, choices = self.styles+tmp) + default = config.usage.timeshift_path.value + tmp = config.usage.allowed_timeshift_paths.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + print "TimeshiftPath: ", default, tmp + self.timeshift_dirname = ConfigSelection(default = default, choices = tmp) + self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False) + + self.list = [] + if config.usage.setup_level.index >= 2: + self.default_entry = getConfigListEntry(_("Default movie location"), self.default_dirname) + self.list.append(self.default_entry) + self.timer_entry = getConfigListEntry(_("Timer record location"), self.timer_dirname) + self.list.append(self.timer_entry) + self.instantrec_entry = getConfigListEntry(_("Instant record location"), self.instantrec_dirname) + self.list.append(self.instantrec_entry) + else: + self.default_entry = getConfigListEntry(_("Movie location"), self.default_dirname) + self.list.append(self.default_entry) + self.timeshift_entry = getConfigListEntry(_("Timeshift location"), self.timeshift_dirname) + self.list.append(self.timeshift_entry) + self["config"].setList(self.list) + + def ok(self): + currentry = self["config"].getCurrent() + self.lastvideodirs = config.movielist.videodirs.value + self.lasttimeshiftdirs = config.usage.allowed_timeshift_paths.value + if config.usage.setup_level.index >= 2: + txt = _("Default movie location") + else: + txt = _("Movie location") + if currentry == self.default_entry: + self.entrydirname = self.default_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + txt, + self.default_dirname.value + ) + elif currentry == self.timer_entry: + self.entrydirname = self.timer_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + _("Initial location in new timers"), + self.timer_dirname.value + ) + elif currentry == self.instantrec_entry: + self.entrydirname = self.instantrec_dirname + self.session.openWithCallback( + self.dirnameSelected, + MovieLocationBox, + _("Location for instant recordings"), + self.instantrec_dirname.value + ) + elif currentry == self.timeshift_entry: + self.entrydirname = self.timeshift_dirname + config.usage.timeshift_path.value = self.timeshift_dirname.value + self.session.openWithCallback( + self.dirnameSelected, + TimeshiftLocationBox + ) + + def dirnameSelected(self, res): + if res is not None: + self.entrydirname.value = res + if config.movielist.videodirs.value != self.lastvideodirs: + styles_keys = [x[0] for x in self.styles] + tmp = config.movielist.videodirs.value + default = self.default_dirname.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + self.default_dirname.setChoices(tmp, default=default) + tmp = config.movielist.videodirs.value + default = self.timer_dirname.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + self.timer_dirname.setChoices(self.styles+tmp, default=default) + tmp = config.movielist.videodirs.value + default = self.instantrec_dirname.value + if default not in tmp and default not in styles_keys: + tmp = tmp[:] + tmp.append(default) + self.instantrec_dirname.setChoices(self.styles+tmp, default=default) + self.entrydirname.value = res + if config.usage.allowed_timeshift_paths.value != self.lasttimeshiftdirs: + tmp = config.usage.allowed_timeshift_paths.value + default = self.instantrec_dirname.value + if default not in tmp: + tmp = tmp[:] + tmp.append(default) + self.timeshift_dirname.setChoices(tmp, default=default) + self.entrydirname.value = res + if self.entrydirname.last_value != res: + self.checkReadWriteDir(self.entrydirname) + + def save(self): + currentry = self["config"].getCurrent() + if self.checkReadWriteDir(currentry[1]): + config.usage.default_path.value = self.default_dirname.value + config.usage.timer_path.value = self.timer_dirname.value + config.usage.instantrec_path.value = self.instantrec_dirname.value + config.usage.timeshift_path.value = self.timeshift_dirname.value + config.usage.default_path.save() + config.usage.timer_path.save() + config.usage.instantrec_path.save() + config.usage.timeshift_path.save() + self.close() + + def cancel(self): + self.close() + Index: lib/python/Screens/InfoBar.py =================================================================== --- lib/python/Screens/InfoBar.py (revision 23912) +++ lib/python/Screens/InfoBar.py (working copy) @@ -208,7 +208,6 @@ return if answer in ("quit", "quitanddeleteconfirmed"): - config.movielist.last_videodir.cancel() self.close() elif answer == "movielist": ref = self.session.nav.getCurrentlyPlayingServiceReference() Index: lib/python/Screens/MovieSelection.py =================================================================== --- lib/python/Screens/MovieSelection.py (revision 23912) +++ lib/python/Screens/MovieSelection.py (working copy) @@ -7,8 +7,9 @@ from Components.Pixmap import Pixmap from Components.Label import Label from Components.PluginComponent import plugins -from Components.config import config, ConfigSubsection, ConfigText, ConfigInteger, ConfigLocations +from Components.config import config, ConfigSubsection, ConfigText, ConfigInteger, ConfigLocations, ConfigSet from Components.Sources.ServiceEvent import ServiceEvent +from Components.UsageConfig import defaultMoviePath from Plugins.Plugin import PluginDescriptor @@ -31,6 +32,7 @@ config.movielist.videodirs = ConfigLocations(default=[resolveFilename(SCOPE_HDD)]) config.movielist.first_tags = ConfigText(default="") config.movielist.second_tags = ConfigText(default="") +config.movielist.last_selected_tags = ConfigSet([], default=[]) def setPreferredTagEditor(te): @@ -168,7 +170,10 @@ HelpableScreen.__init__(self) self.tags = [ ] - self.selected_tags = None + if selectedmovie: + self.selected_tags = config.movielist.last_selected_tags.value + else: + self.selected_tags = None self.selected_tags_ele = None self.movemode = False @@ -183,8 +188,8 @@ self["DescriptionBorder"] = Pixmap() self["DescriptionBorder"].hide() - if not pathExists(config.movielist.last_videodir.value): - config.movielist.last_videodir.value = resolveFilename(SCOPE_HDD) + if not fileExists(config.movielist.last_videodir.value): + config.movielist.last_videodir.value = defaultMoviePath() config.movielist.last_videodir.save() self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + config.movielist.last_videodir.value) @@ -292,6 +297,7 @@ self.close(None) def saveconfig(self): + config.movielist.last_selected_tags.value = self.selected_tags config.movielist.moviesort.save() config.movielist.listtype.save() config.movielist.description.save() @@ -339,8 +345,8 @@ self["list"].setSortType(type) def reloadList(self, sel = None, home = False): - if not pathExists(config.movielist.last_videodir.value): - path = resolveFilename(SCOPE_HDD) + if not fileExists(config.movielist.last_videodir.value): + path = defaultMoviePath() config.movielist.last_videodir.value = path config.movielist.last_videodir.save() self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + path) @@ -370,7 +376,7 @@ def gotFilename(self, res): if res is not None and res is not config.movielist.last_videodir.value: - if pathExists(res): + if fileExists(res): config.movielist.last_videodir.value = res config.movielist.last_videodir.save() self.current_ref = eServiceReference("2:0:1:0:0:0:0:0:0:0:" + res) @@ -392,7 +398,7 @@ def showTagsN(self, tagele): if not self.tags: self.showTagWarning() - elif not tagele or self.selected_tags_ele == tagele or not tagele.value in self.tags: + elif not tagele or tagele.value in self.selected_tags or not tagele.value in self.tags: self.showTagsMenu(tagele) else: self.selected_tags_ele = tagele Index: lib/python/Screens/EventView.py =================================================================== --- lib/python/Screens/EventView.py (revision 23912) +++ lib/python/Screens/EventView.py (working copy) @@ -6,6 +6,7 @@ from Components.Label import Label from Components.ScrollLabel import ScrollLabel from Components.TimerList import TimerList +from Components.UsageConfig import preferredTimerPath from enigma import eEPGCache, eTimer, eServiceReference from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT from TimerEntry import TimerEntry @@ -85,7 +86,7 @@ self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName()) break else: - newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, *parseEvent(self.event)) + newEntry = RecordTimerEntry(self.currentService, checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(self.event)) self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry) def finishedAdd(self, answer): Index: lib/python/Screens/EpgSelection.py =================================================================== --- lib/python/Screens/EpgSelection.py (revision 23912) +++ lib/python/Screens/EpgSelection.py (working copy) @@ -6,6 +6,7 @@ from Components.EpgList import EPGList, EPG_TYPE_SINGLE, EPG_TYPE_SIMILAR, EPG_TYPE_MULTI from Components.ActionMap import ActionMap from Components.TimerSanityCheck import TimerSanityCheck +from Components.UsageConfig import preferredTimerPath from Screens.TimerEdit import TimerSanityConflict from Screens.EventView import EventViewSimple from Screens.MessageBox import MessageBox @@ -230,7 +231,7 @@ self.session.openWithCallback(cb_func, MessageBox, _("Do you really want to delete %s?") % event.getEventName()) break else: - newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, *parseEvent(event)) + newEntry = RecordTimerEntry(serviceref, checkOldTimers = True, dirname = preferredTimerPath(), *parseEvent(event)) self.session.openWithCallback(self.finishedAdd, TimerEntry, newEntry) def finishedAdd(self, answer): Index: lib/python/Screens/TimerEdit.py =================================================================== --- lib/python/Screens/TimerEdit.py (revision 23912) +++ lib/python/Screens/TimerEdit.py (working copy) @@ -4,6 +4,7 @@ from Components.MenuList import MenuList from Components.TimerList import TimerList from Components.TimerSanityCheck import TimerSanityCheck +from Components.UsageConfig import preferredTimerPath from RecordTimer import RecordTimerEntry, parseEvent, AFTEREVENT from Screen import Screen from Screens.ChoiceBox import ChoiceBox @@ -243,7 +244,7 @@ else: data = parseEvent(event, description = False) - self.addTimer(RecordTimerEntry(serviceref, checkOldTimers = True, dirname = config.movielist.last_timer_videodir.value, *data)) + self.addTimer(RecordTimerEntry(serviceref, checkOldTimers = True, dirname = preferredTimerPath(), *data)) def addTimer(self, timer): self.session.openWithCallback(self.finishedAdd, TimerEntry, timer) Index: lib/python/Components/config.py =================================================================== --- lib/python/Components/config.py (revision 23912) +++ lib/python/Components/config.py (working copy) @@ -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 @@ -1248,7 +1248,6 @@ self.default = default self.locations = [] self.mountpoints = [] - harddiskmanager.on_partition_list_change.append(self.mountpointsChanged) self.value = default[:] def setValue(self, value): @@ -1285,7 +1284,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 @@ -1304,20 +1303,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 @@ -1327,7 +1317,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): Index: lib/python/Components/Harddisk.py =================================================================== --- lib/python/Components/Harddisk.py (revision 23912) +++ lib/python/Components/Harddisk.py (working copy) @@ -229,7 +229,10 @@ # any access has been made to the disc. If there has been no access over a specifed time, # we set the hdd into standby. def readStats(self): - l = open("/sys/block/%s/stat" % self.device).read() + try: + l = open("/sys/block/%s/stat" % self.device).read() + except IOError: + return -1,-1 (nr_read, _, _, _, nr_write) = l.split()[:5] return int(nr_read), int(nr_write) @@ -259,7 +262,7 @@ l = sum(stats) print "sum", l, "prev_sum", self.last_stat - if l != self.last_stat: # access + if l != self.last_stat and l >= 0: # access print "hdd was accessed since previous check!" self.last_stat = l self.last_access = t @@ -459,9 +462,10 @@ idx = 0 for hdd in self.hdd: if hdd.device == device: - self.hdd[x].stop() + self.hdd[idx].stop() del self.hdd[idx] break + idx+=1 SystemInfo["Harddisk"] = len(self.hdd) > 0 def HDDCount(self): Index: lib/python/Components/UsageConfig.py =================================================================== --- lib/python/Components/UsageConfig.py (revision 23912) +++ lib/python/Components/UsageConfig.py (working copy) @@ -1,5 +1,6 @@ from Components.Harddisk import harddiskmanager from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations +from Tools.Directories import resolveFilename, SCOPE_HDD from enigma import Misc_Options, setTunerTypePriorityOrder; from SystemInfo import SystemInfo import os @@ -30,8 +31,11 @@ ("standard", _("standard")), ("swap", _("swap PiP and main picture")), ("swapstop", _("move PiP to main picture")), ("stop", _("stop PiP")) ]) + config.usage.default_path = ConfigText(default = resolveFilename(SCOPE_HDD)) + config.usage.timer_path = ConfigText(default = "") + config.usage.instantrec_path = ConfigText(default = "") + config.usage.timeshift_path = ConfigText(default = "/media/hdd/") config.usage.allowed_timeshift_paths = ConfigLocations(default = ["/media/hdd/"]) - config.usage.timeshift_path = ConfigText(default = "/media/hdd") config.usage.on_movie_start = ConfigSelection(default = "ask", choices = [ ("ask", _("Ask user")), ("resume", _("Resume from last position")), ("beginning", _("Start from the beginning")) ]) @@ -62,19 +66,19 @@ def TunerTypePriorityOrderChanged(configElement): setTunerTypePriorityOrder(int(configElement.value)) - config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged) + config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False) def setHDDStandby(configElement): for hdd in harddiskmanager.HDDList(): hdd[1].setIdleTime(int(configElement.value)) - config.usage.hdd_standby.addNotifier(setHDDStandby) + config.usage.hdd_standby.addNotifier(setHDDStandby, immediate_feedback=False) def set12VOutput(configElement): if configElement.value == "on": Misc_Options.getInstance().set_12V_output(1) elif configElement.value == "off": Misc_Options.getInstance().set_12V_output(0) - config.usage.output_12V.addNotifier(set12VOutput) + config.usage.output_12V.addNotifier(set12VOutput, immediate_feedback=False) SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output() @@ -125,3 +129,23 @@ defval = str(x) break sel.setChoices(map(str, choices), defval) + +def preferredPath(path): + if config.usage.setup_level.index < 2 or path == "": + return None # config.usage.default_path.value, but delay lookup until usage + elif path == "": + return config.movielist.last_videodir.value + elif path == "": + return config.movielist.last_timer_videodir.value + else: + return path + +def preferredTimerPath(): + return preferredPath(config.usage.timer_path.value) + +def preferredInstantRecordPath(): + return preferredPath(config.usage.instantrec_path.value) + +def defaultMoviePath(): + return config.usage.default_path.value + Index: lib/python/Components/FileList.py =================================================================== --- lib/python/Components/FileList.py (revision 23912) +++ lib/python/Components/FileList.py (working copy) @@ -3,7 +3,7 @@ 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 @@ -158,8 +158,11 @@ 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: @@ -372,8 +375,11 @@ 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: Index: data/menu.xml =================================================================== --- data/menu.xml (revision 23912) +++ data/menu.xml (working copy) @@ -70,7 +70,7 @@ --> - + Index: RecordTimer.py =================================================================== --- RecordTimer.py (revision 23912) +++ RecordTimer.py (working copy) @@ -3,6 +3,7 @@ from Tools import Directories, Notifications from Components.config import config +from Components.UsageConfig import defaultMoviePath import timer import xml.etree.cElementTree @@ -141,11 +142,13 @@ if self.name: filename += " - " + self.name - if self.dirname and not Directories.fileExists(self.dirname, 'w'): - self.dirnameHadToFallback = True - self.Filename = Directories.getRecordingFilename(filename, None) + if not self.dirname or not Directories.fileExists(self.dirname, 'w'): + if self.dirname: + self.dirnameHadToFallback = True + dirname = defaultMoviePath() else: - self.Filename = Directories.getRecordingFilename(filename, self.dirname) + dirname = self.dirname + self.Filename = Directories.getRecordingFilename(filename, dirname) self.log(0, "Filename calculated as: '%s'" % self.Filename) #begin_date + " - " + service_name + description)