Ejemplo n.º 1
0
	def showHarddiskPopup(self, dev = None, media_state = None):
		from Components.Harddisk import harddiskmanager
		if not self.HDDDetectedCB in harddiskmanager.delayed_device_Notifier:
			harddiskmanager.delayed_device_Notifier.append(self.HDDDetectedCB)
		if config.misc.initialharddisknotification.value:
			from Screens.MessageBox import MessageBox
			if harddiskmanager.HDDCount() and not harddiskmanager.HDDEnabledCount():
				Notifications.AddNotificationWithCallback(self.HDDDetectedAnswer, MessageBox, _("Unconfigured storage devices found!")  + "\n" \
					+ _("Please make sure to set up your storage devices with the storage management in menu -> setup -> system -> storage devices.") + "\n\n" \
					+ _("Set up your storage device now?"), type = MessageBox.TYPE_YESNO, timeout = 15, default = False, domain = "InfoBar")
				config.misc.initialharddisknotification.value = False
				config.misc.initialharddisknotification.save()
		elif config.misc.missingdefaultstoragenotification.value and not config.misc.initialharddisknotification.value:
			from Screens.ChoiceBox import ChoiceBox
			from Components.UsageConfig import defaultStorageDevice
			choices = [
				(_("OK, do nothing"), "ok"),
				(_("OK, and don't ask again"), "ok_always")
			]
			if harddiskmanager.HDDCount():
				choices.append((_("OK, and set up a new default storage device"), "ok_setup"))
			titletxt = _("Default storage device is not available!") + "\n"
			if dev is None and defaultStorageDevice() != "<undefined>" and harddiskmanager.isDefaultStorageDeviceActivebyUUID(defaultStorageDevice()) is False:
				Notifications.AddNotificationWithCallback(self.missingDefaultHDDAnswer, ChoiceBox, title = titletxt \
					+ _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> storage devices.") + "\n", list = choices, domain = "InfoBar")
			elif dev is not None and defaultStorageDevice() != "<undefined>" and harddiskmanager.isDefaultStorageDeviceActivebyUUID(defaultStorageDevice()) is False:
				part = harddiskmanager.getPartitionbyDevice(dev)
				if part is not None and part.uuid is not None and media_state is not None and media_state == "remove_default":
					titletxt = _("Default storage device was removed!") + "\n"
					Notifications.AddNotificationWithCallback(self.missingDefaultHDDAnswer, ChoiceBox, title = titletxt \
						+ _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> storage devices.") + "\n", list = choices, domain = "InfoBar")
Ejemplo n.º 2
0
 def save(self):
     currentry = self["config"].getCurrent()
     defaultChanged = None
     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()
         if self.default_device.value != "/media/hdd":
             if self.default_device.value != "<undefined>":  #changing default ?
                 tmp = harddiskmanager.getPartitionbyMountpoint(
                     self.default_device.value)
                 if tmp is not None:
                     defaultChanged = harddiskmanager.changeStorageDevice(
                         tmp.uuid, "mount_default", None)
             else:  #disabling default ?
                 p = harddiskmanager.getDefaultStorageDevicebyUUID(
                     defaultStorageDevice())
                 if p is not None:
                     defaultChanged = harddiskmanager.changeStorageDevice(
                         defaultStorageDevice(), "unmount", None)
         if defaultChanged is None:
             self.close()
         elif defaultChanged is False:
             self.session.open(
                 MessageBox,
                 _("There was en error while configuring your storage device."
                   ), MessageBox.TYPE_ERROR)
         else:
             self.close()
Ejemplo n.º 3
0
	def save(self):
		currentry = self["config"].getCurrent()
		defaultChanged = None
		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()
			if self.default_device.value != "/media/hdd":
				if self.default_device.value != "<undefined>": #changing default ?
					tmp = harddiskmanager.getPartitionbyMountpoint(self.default_device.value)
					if tmp is not None:
						defaultChanged = harddiskmanager.changeStorageDevice(tmp.uuid, "mount_default", None)
				else: #disabling default ?
					p = harddiskmanager.getDefaultStorageDevicebyUUID(defaultStorageDevice())
					if p is not None:
						defaultChanged = harddiskmanager.changeStorageDevice(defaultStorageDevice(), "unmount", None)
			if defaultChanged is None:
				self.close()
			elif defaultChanged is False:
				self.session.open(MessageBox, _("There was en error while configuring your storage device."), MessageBox.TYPE_ERROR)
			else:
				self.close()
Ejemplo n.º 4
0
 def showHarddiskPopup(self, dev=None, media_state=None):
     from Components.Harddisk import harddiskmanager
     if not self.HDDDetectedCB in harddiskmanager.delayed_device_Notifier:
         harddiskmanager.delayed_device_Notifier.append(self.HDDDetectedCB)
     if config.misc.initialharddisknotification.value:
         from Screens.MessageBox import MessageBox
         if harddiskmanager.HDDCount(
         ) and not harddiskmanager.HDDEnabledCount():
             Notifications.AddNotificationWithCallback(self.HDDDetectedAnswer, MessageBox, _("Unconfigured storage devices found!")  + "\n" \
              + _("Please make sure to set up your storage devices with the storage management in menu -> setup -> system -> storage devices.") + "\n\n" \
              + _("Set up your storage device now?"), type = MessageBox.TYPE_YESNO, timeout = 15, default = False, domain = "InfoBar")
             config.misc.initialharddisknotification.value = False
             config.misc.initialharddisknotification.save()
     elif config.misc.missingdefaultstoragenotification.value and not config.misc.initialharddisknotification.value:
         from Screens.ChoiceBox import ChoiceBox
         from Components.UsageConfig import defaultStorageDevice
         choices = [(_("OK, do nothing"), "ok"),
                    (_("OK, and don't ask again"), "ok_always")]
         if harddiskmanager.HDDCount():
             choices.append(
                 (_("OK, and set up a new default storage device"),
                  "ok_setup"))
         titletxt = _("Default storage device is not available!") + "\n"
         if dev is None and defaultStorageDevice(
         ) != "<undefined>" and harddiskmanager.isDefaultStorageDeviceActivebyUUID(
                 defaultStorageDevice()) is False:
             Notifications.AddNotificationWithCallback(self.missingDefaultHDDAnswer, ChoiceBox, title = titletxt \
              + _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> storage devices.") + "\n", list = choices, domain = "InfoBar")
         elif dev is not None and defaultStorageDevice(
         ) != "<undefined>" and harddiskmanager.isDefaultStorageDeviceActivebyUUID(
                 defaultStorageDevice()) is False:
             part = harddiskmanager.getPartitionbyDevice(dev)
             if part is not None and part.uuid is not None and media_state is not None and media_state == "remove_default":
                 titletxt = _("Default storage device was removed!") + "\n"
                 Notifications.AddNotificationWithCallback(self.missingDefaultHDDAnswer, ChoiceBox, title = titletxt \
                  + _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> storage devices.") + "\n", list = choices, domain = "InfoBar")
Ejemplo n.º 5
0
def mountpoint_chosen(option):
    if option is None:
        return

    from Screens.ChoiceBox import ChoiceBox

    print "scanning", option
    (description, mountpoint, session) = option
    res = scanDevice(mountpoint)

    list = [(r.description, r, res[r], session) for r in res]

    if not list:
        from Components.Harddisk import harddiskmanager
        from Components.UsageConfig import defaultStorageDevice
        p = harddiskmanager.getPartitionbyMountpoint(mountpoint)

        if mountpoint != "/":
            if p is not None and p.uuid is None:  #ignore partitions with unknown or no filesystem uuid
                print "ignore", mountpoint, "because we have no uuid"
                return
            if defaultStorageDevice(
            ) == "<undefined>" or not harddiskmanager.HDDEnabledCount(
            ):  # no configured default storage device found
                if p is not None and p.isInitialized:
                    print "ignore", mountpoint, "as its usable as default storage device"
                    return

        description = None
        if p:
            description = p.description

        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,
                         timeout=10,
                         title=description)
        else:
            print "ignore", mountpoint, "because its not accessible"
        return

    session.openWithCallback(execute,
                             ChoiceBox,
                             title=_("The following files were found..."),
                             list=list)
Ejemplo n.º 6
0
def mountpoint_chosen(option):
	if option is None:
		return

	from Screens.ChoiceBox import ChoiceBox

	print "scanning", option
	(description, mountpoint, session) = option
	res = scanDevice(mountpoint)

	list = [ (r.description, r, res[r], session) for r in res ]

	if not list:
		from Components.Harddisk import harddiskmanager
		from Components.UsageConfig import defaultStorageDevice
		p = harddiskmanager.getPartitionbyMountpoint(mountpoint)

		if mountpoint != "/":
			if p is not None and p.uuid is None: #ignore partitions with unknown or no filesystem uuid
				print "ignore", mountpoint, "because we have no uuid"
				return
			if defaultStorageDevice() == "<undefined>" or not harddiskmanager.HDDEnabledCount(): # no configured default storage device found
				if p is not None and p.isInitialized:
					print "ignore", mountpoint, "as its usable as default storage device"
					return

		description = None
		if p:
			description = p.description

		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, timeout = 10, title = description)
		else:
			print "ignore", mountpoint, "because its not accessible"
		return
	
	session.openWithCallback(execute, ChoiceBox, 
		title = _("The following files were found..."),
		list = list)
Ejemplo n.º 7
0
	def getConfigListValues(self):
		if not self.timerentry_service_ref.isRecordable():
			self.session.openWithCallback(self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR)
			return
		if self.timerentry_justplay.value == 'record':
			if not harddiskmanager.inside_mountpoint(self.timerentry_dirname.value):
				if harddiskmanager.HDDCount() and not harddiskmanager.HDDEnabledCount():
					self.session.open(MessageBox, _("Unconfigured storage devices found!") + "\n" \
						+ _("Please make sure to set up your storage devices with the improved storage management in menu -> setup -> system -> storage devices."), MessageBox.TYPE_ERROR)
					return
				elif harddiskmanager.HDDEnabledCount() and defaultStorageDevice() == "<undefined>":
					self.session.open(MessageBox, _("No default storage device found!") + "\n" \
						+ _("Please make sure to set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
					return
				elif harddiskmanager.HDDEnabledCount() and defaultStorageDevice() != "<undefined>":
					part = harddiskmanager.getDefaultStorageDevicebyUUID(defaultStorageDevice())
					if part is None:
						self.session.open(MessageBox, _("Default storage device is not available!") + "\n" \
							+ _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
						return
				else:
					self.session.open(MessageBox, _("Recording destination for this timer does not exists."), MessageBox.TYPE_ERROR)
					return

		self.timer.name = self.timerentry_name.value
		self.timer.description = self.timerentry_description.value
		self.timer.justplay = self.timerentry_justplay.value == "zap"
		if self.timerentry_justplay.value == "zap":
			if not self.timerentry_showendtime.value:
				self.timerentry_endtime.value = self.timerentry_starttime.value

		self.timer.resetRepeated()
		self.timer.afterEvent = {
			"nothing": AFTEREVENT.NONE,
			"deepstandby": AFTEREVENT.DEEPSTANDBY,
			"standby": AFTEREVENT.STANDBY,
			"auto": AFTEREVENT.AUTO
			}[self.timerentry_afterevent.value]
		self.timer.service_ref = self.timerentry_service_ref
		self.timer.tags = self.timerentry_tags

		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()
		if self.timerentry_type.value == "repeated":
			if self.timerentry_repeated.value == "daily":
				for x in (0, 1, 2, 3, 4, 5, 6):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "weekly":
				self.timer.setRepeated(self.timerentry_weekday.index)

			if self.timerentry_repeated.value == "weekdays":
				for x in (0, 1, 2, 3, 4):
					self.timer.setRepeated(x)

			if self.timerentry_repeated.value == "user":
				for x in (0, 1, 2, 3, 4, 5, 6):
					if self.timerentry_day[x].value:
						self.timer.setRepeated(x)

			self.timer.repeatedbegindate = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
			if self.timer.repeated:
				self.timer.begin = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(self.timerentry_repeatedbegindate.value, self.timerentry_endtime.value)
			else:
				self.timer.begin = self.getTimestamp(time.time(), self.timerentry_starttime.value)
				self.timer.end = self.getTimestamp(time.time(), self.timerentry_endtime.value)

			# when a timer end is set before the start, add 1 day
			if self.timer.end < self.timer.begin:
				self.timer.end += 86400
Ejemplo n.º 8
0
if os.path.exists("/usr/bin/apt-get"):
    streamtypechoices.append(('8193', 'GStreamer(8193)'))


cfg.livetype = ConfigSelection(default='1', choices=streamtypechoices)
cfg.vodtype = ConfigSelection(default='4097', choices=streamtypechoices)
cfg.catchuptype = ConfigSelection(default='4097', choices=streamtypechoices)


try:
    from Components.UsageConfig import defaultMoviePath
    downloadpath = defaultMoviePath()
except:
    from Components.UsageConfig import defaultStorageDevice
    downloadpath = defaultStorageDevice()


cfg.location = ConfigDirectory(default=dir_dst)
cfg.main = ConfigYesNo(default=False)
cfg.livepreview = ConfigYesNo(default=False)
cfg.stopstream = ConfigYesNo(default=False)
cfg.skin = ConfigSelection(default='default', choices=folders)
cfg.parental = ConfigYesNo(default=False)
cfg.timeout = ConfigNumber(default=5)
cfg.downloadlocation = ConfigDirectory(default=downloadpath)
cfg.refreshTMDB = ConfigYesNo(default=True)
cfg.TMDBLanguage = ConfigSelection(default='en', choices=languages)
cfg.catchupstart = ConfigSelectionNumber(0, 30, 1, default=0)
cfg.catchupend = ConfigSelectionNumber(0, 30, 1, default=0)
Ejemplo n.º 9
0
    def getConfigListValues(self):
        if not self.timerentry_service_ref.isRecordable():
            self.session.openWithCallback(
                self.selectChannelSelector, MessageBox,
                _("You didn't select a channel to record from."),
                MessageBox.TYPE_ERROR)
            return
        if self.timerentry_justplay.value == 'record':
            if not harddiskmanager.inside_mountpoint(
                    self.timerentry_dirname.value):
                if harddiskmanager.HDDCount(
                ) and not harddiskmanager.HDDEnabledCount():
                    self.session.open(MessageBox, _("Unconfigured storage devices found!") + "\n" \
                     + _("Please make sure to set up your storage devices with the improved storage management in menu -> setup -> system -> storage devices."), MessageBox.TYPE_ERROR)
                    return
                elif harddiskmanager.HDDEnabledCount(
                ) and defaultStorageDevice() == "<undefined>":
                    self.session.open(MessageBox, _("No default storage device found!") + "\n" \
                     + _("Please make sure to set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
                    return
                elif harddiskmanager.HDDEnabledCount(
                ) and defaultStorageDevice() != "<undefined>":
                    part = harddiskmanager.getDefaultStorageDevicebyUUID(
                        defaultStorageDevice())
                    if part is None:
                        self.session.open(MessageBox, _("Default storage device is not available!") + "\n" \
                         + _("Please verify if your default storage device is attached or set up your default storage device in menu -> setup -> system -> recording paths."), MessageBox.TYPE_ERROR)
                        return
                else:
                    self.session.open(
                        MessageBox,
                        _("Recording destination for this timer does not exists."
                          ), MessageBox.TYPE_ERROR)
                    return

        self.timer.name = self.timerentry_name.value
        self.timer.description = self.timerentry_description.value
        self.timer.justplay = self.timerentry_justplay.value == "zap"
        if self.timerentry_justplay.value == "zap":
            if not self.timerentry_showendtime.value:
                self.timerentry_endtime.value = self.timerentry_starttime.value

        self.timer.resetRepeated()
        self.timer.afterEvent = {
            "nothing": AFTEREVENT.NONE,
            "deepstandby": AFTEREVENT.DEEPSTANDBY,
            "standby": AFTEREVENT.STANDBY,
            "auto": AFTEREVENT.AUTO
        }[self.timerentry_afterevent.value]
        self.timer.service_ref = self.timerentry_service_ref
        self.timer.tags = self.timerentry_tags

        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()
        if self.timerentry_type.value == "repeated":
            if self.timerentry_repeated.value == "daily":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "weekly":
                self.timer.setRepeated(self.timerentry_weekday.index)

            if self.timerentry_repeated.value == "weekdays":
                for x in (0, 1, 2, 3, 4):
                    self.timer.setRepeated(x)

            if self.timerentry_repeated.value == "user":
                for x in (0, 1, 2, 3, 4, 5, 6):
                    if self.timerentry_day[x].value:
                        self.timer.setRepeated(x)

            self.timer.repeatedbegindate = self.getTimestamp(
                self.timerentry_repeatedbegindate.value,
                self.timerentry_starttime.value)
            if self.timer.repeated:
                self.timer.begin = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    self.timerentry_repeatedbegindate.value,
                    self.timerentry_endtime.value)
            else:
                self.timer.begin = self.getTimestamp(
                    time.time(), self.timerentry_starttime.value)
                self.timer.end = self.getTimestamp(
                    time.time(), self.timerentry_endtime.value)

            # when a timer end is set before the start, add 1 day
            if self.timer.end < self.timer.begin:
                self.timer.end += 86400
Ejemplo n.º 10
0
    def initConfigList(self):
        self.styles = [("<default>", _("<Default movie location>")),
                       ("<current>", _("<Current movielist location>")),
                       ("<timer>", _("<Last timer location>"))]
        styles_keys = [x[0] for x in self.styles]

        mountpoints = [(p.mountpoint, p.description)
                       for p in harddiskmanager.getConfiguredStorageDevices()
                       if p.isInitialized]
        mountpoints.sort(reverse=True)
        self.storage_styles = [("<undefined>",
                                _("<No default storage device selected.>"))]
        self.storage_styles += mountpoints
        storage_styles_keys = [x[0] for x in self.storage_styles]
        default = defaultStorageDevice()
        if default not in storage_styles_keys:
            p = harddiskmanager.getDefaultStorageDevicebyUUID(default)
            if p is not None:
                default = p.mountpoint
                if p.mountpoint not in storage_styles_keys:
                    self.storage_styles.append((p.mountpoint, p.description))
            else:
                cfg_uuid = config.storage.get(default, None)
                if cfg_uuid is not None:
                    if cfg_uuid["enabled"].value:
                        default = cfg_uuid["mountpoint"].value
                        if default not in storage_styles_keys:
                            description = cfg_uuid[
                                "device_description"].value.split()[0] or ""
                            description += " ( " + _("Offline") + " )"
                            self.storage_styles.append((default, description))
                    else:
                        default = "<undefined>"
                else:
                    default = "<undefined>"
        print("DefaultDevice: ", default, self.storage_styles)
        self.default_device = ConfigSelection(default=default,
                                              choices=self.storage_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.timeshift_dirname.last_value = self.timeshift_dirname.value
        self.default_dirname.addNotifier(self.checkReadWriteDir,
                                         initial_call=False,
                                         immediate_feedback=False)
        self.default_dirname.last_value = self.default_dirname.value
        self.timer_dirname.addNotifier(self.checkReadWriteDir,
                                       initial_call=False,
                                       immediate_feedback=False)
        self.timer_dirname.last_value = self.timer_dirname.value
        self.instantrec_dirname.addNotifier(self.checkReadWriteDir,
                                            initial_call=False,
                                            immediate_feedback=False)
        self.instantrec_dirname.last_value = self.instantrec_dirname.value
        self.timeshift_dirname.addNotifier(self.checkReadWriteDir,
                                           initial_call=False,
                                           immediate_feedback=False)
        self.timeshift_dirname.last_value = self.timeshift_dirname.value

        self.list = []
        self.device_entry = getConfigListEntry(_("Default storage device"),
                                               self.default_device)
        self.list.append(self.device_entry)
        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)
        if not self.selectionChanged in self["config"].onSelectionChanged:
            self["config"].onSelectionChanged.append(self.selectionChanged)
Ejemplo n.º 11
0
	def initConfigList(self):
		self.styles = [ ("<default>", _("<Default movie location>")), ("<current>", _("<Current movielist location>")), ("<timer>", _("<Last timer location>")) ]
		styles_keys = [x[0] for x in self.styles]

		mountpoints = [ (p.mountpoint, p.description) for p in harddiskmanager.getConfiguredStorageDevices() if p.isInitialized]
		mountpoints.sort(reverse = True)
		self.storage_styles = [ ("<undefined>", _("<No default storage device selected.>"))]
		self.storage_styles += mountpoints
		storage_styles_keys = [x[0] for x in self.storage_styles]
		default = defaultStorageDevice()
		if default not in storage_styles_keys:
			p = harddiskmanager.getDefaultStorageDevicebyUUID(default)
			if p is not None:
				default = p.mountpoint
				if p.mountpoint not in storage_styles_keys:
					self.storage_styles.append((p.mountpoint, p.description))
			else:
				cfg_uuid = config.storage.get(default, None)
				if cfg_uuid is not None:
					if cfg_uuid["enabled"].value:
						default = cfg_uuid["mountpoint"].value
						if default not in storage_styles_keys:
							description = cfg_uuid["device_description"].value.split()[0] or ""
							description += " ( " + _("Offline") + " )"
							self.storage_styles.append((default, description ))
					else:
						default = "<undefined>"
				else:
					default = "<undefined>"
		print "DefaultDevice: ", default, self.storage_styles
		self.default_device = ConfigSelection(default = default, choices = self.storage_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.timeshift_dirname.last_value = self.timeshift_dirname.value
		self.default_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.default_dirname.last_value = self.default_dirname.value
		self.timer_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.timer_dirname.last_value = self.timer_dirname.value
		self.instantrec_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.instantrec_dirname.last_value = self.instantrec_dirname.value
		self.timeshift_dirname.addNotifier(self.checkReadWriteDir, initial_call=False, immediate_feedback=False)
		self.timeshift_dirname.last_value = self.timeshift_dirname.value

		self.list = []
		self.device_entry = getConfigListEntry(_("Default storage device"), self.default_device)
		self.list.append(self.device_entry)
		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)
		if not self.selectionChanged in self["config"].onSelectionChanged:
			self["config"].onSelectionChanged.append(self.selectionChanged)