Exemplo n.º 1
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)
Exemplo n.º 2
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")
Exemplo n.º 3
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