Fix default recording path and usb recording.
[vuplus_dvbapp] / lib / python / Components / UsageConfig.py
index 90f11fe..36db2ad 100644 (file)
@@ -1,7 +1,10 @@
 from Components.Harddisk import harddiskmanager
+from Components.NimManager import nimmanager
 from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigNumber, ConfigSet, ConfigLocations
+from Tools.Directories import defaultRecordingLocation
 from Tools.Directories import resolveFilename, SCOPE_HDD
-from enigma import Misc_Options, setTunerTypePriorityOrder;
+from enigma import Misc_Options, eEnv
+from enigma import setTunerTypePriorityOrder, setPreferredTuner
 from SystemInfo import SystemInfo
 import os
 
@@ -33,7 +36,7 @@ def InitUsageConfig():
                ("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.default_path = ConfigText(default = "")
        config.usage.timer_path = ConfigText(default = "<default>")
        config.usage.instantrec_path = ConfigText(default = "<default>")
        config.usage.timeshift_path = ConfigText(default = "/media/hdd/")
@@ -53,7 +56,14 @@ def InitUsageConfig():
 
        config.usage.on_long_powerpress = ConfigSelection(default = "show_menu", choices = [
                ("show_menu", _("show shutdown menu")),
-               ("shutdown", _("immediate shutdown")) ] )
+               ("shutdown", _("immediate shutdown")),
+               ("standby", _("Standby")) ] )
+       
+       config.usage.on_short_powerpress = ConfigSelection(default = "standby", choices = [
+               ("show_menu", _("show shutdown menu")),
+               ("shutdown", _("immediate shutdown")),
+               ("standby", _("Standby")) ] )
+
 
        config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
                ("0", "DVB-S/-C/-T"),
@@ -63,6 +73,13 @@ def InitUsageConfig():
                ("4", "DVB-T/-C/-S"),
                ("5", "DVB-T/-S/-C") ])
 
+       nims = [ ("-1", _("auto")) ]
+       for x in nimmanager.nim_slots:
+               nims.append( (str(x.slot), x.getSlotName()) )
+       config.usage.frontend_priority = ConfigSelection(default = "-1", choices = nims)
+
+       config.usage.show_event_progress_in_servicelist = ConfigYesNo(default = False)
+
        config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
 
        config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)
@@ -73,6 +90,10 @@ def InitUsageConfig():
                setTunerTypePriorityOrder(int(configElement.value))
        config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged, immediate_feedback=False)
 
+       def PreferredTunerChanged(configElement):
+               setPreferredTuner(int(configElement.value))
+       config.usage.frontend_priority.addNotifier(PreferredTunerChanged)
+
        def setHDDStandby(configElement):
                for hdd in harddiskmanager.HDDList():
                        hdd[1].setIdleTime(int(configElement.value))
@@ -87,7 +108,7 @@ def InitUsageConfig():
 
        SystemInfo["12V_Output"] = Misc_Options.getInstance().detected_12V_output()
 
-       config.usage.keymap = ConfigText(default = "/usr/share/enigma2/keymap.xml")
+       config.usage.keymap = ConfigText(default = eEnv.resolve("${datadir}/enigma2/keymap.xml"))
 
        config.seek = ConfigSubsection()
        config.seek.selfdefined_13 = ConfigNumber(default=15)
@@ -95,19 +116,19 @@ def InitUsageConfig():
        config.seek.selfdefined_79 = ConfigNumber(default=300)
 
        config.seek.speeds_forward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
-       config.seek.speeds_backward = ConfigSet(default=[8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
+       config.seek.speeds_backward = ConfigSet(default=[2, 4, 8, 16, 32, 64, 128], choices=[1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128])
        config.seek.speeds_slowmotion = ConfigSet(default=[2, 4, 8], choices=[2, 4, 6, 8, 12, 16, 25])
 
        config.seek.enter_forward = ConfigSelection(default = "2", choices = ["2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
        config.seek.enter_backward = ConfigSelection(default = "1", choices = ["1", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
-       config.seek.stepwise_minspeed = ConfigSelection(default = "16", choices = ["Never", "2", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128"])
-       config.seek.stepwise_repeat = ConfigSelection(default = "3", choices = ["2", "3", "4", "5", "6"])
 
        config.seek.on_pause = ConfigSelection(default = "play", choices = [
                ("play", _("Play")),
                ("step", _("Singlestep (GOP)")),
                ("last", _("Last speed")) ])
 
+       config.usage.timerlist_finished_timer_position = ConfigSelection(default = "beginning", choices = [("beginning", _("at beginning")), ("end", _("at end"))])
+
        def updateEnterForward(configElement):
                if not configElement.value:
                        configElement.value = [2]
@@ -122,6 +143,76 @@ def InitUsageConfig():
 
        config.seek.speeds_backward.addNotifier(updateEnterBackward, immediate_feedback = False)
 
+       config.subtitles = ConfigSubsection()
+       config.subtitles.subtitle_fontcolor = ConfigSelection(default = "0", choices = [
+               ("0", _("default")),
+               ("1", _("white")),
+               ("2", _("yellow")),
+               ("3", _("green")),
+               ("4", _("cyan")),
+               ("5", _("blue")),
+               ("6", _("magneta")),
+               ("7", _("red")),
+               ("8", _("black")) ])
+       config.subtitles.subtitle_fontsize  = ConfigSelection(choices = ["%d" % x for x in range(16,101) if not x % 2], default = "20")
+       config.subtitles.subtitle_bgcolor = ConfigSelection(default = "0", choices = [
+               ("0", _("black")),
+               ("1", _("red")),
+               ("2", _("magneta")),
+               ("3", _("blue")),
+               ("4", _("cyan")),
+               ("5", _("green")),
+               ("6", _("yellow")),
+               ("7", _("white"))])
+       config.subtitles.subtitle_bgopacity = ConfigSelection(default = "225", choices = [
+               ("0", _("No transparency")),
+               ("25", "10%"),
+               ("50", "20%"),
+               ("75", "30%"),
+               ("100", "40%"),
+               ("125", "50%"),
+               ("150", "60%"),
+               ("175", "70%"),
+               ("200", "80%"),
+               ("225", "90%"),
+               ("255", _("Full transparency"))])
+       config.subtitles.subtitle_edgestyle = ConfigSelection(default = "2", choices = [
+               ("0", "None"),
+               ("1", "Raised"),
+               ("2", "Depressed"),
+               ("3", "Uniform")])
+       config.subtitles.subtitle_edgestyle_level = ConfigSelection(choices = ["0", "1", "2", "3", "4", "5"], default = "3")
+       config.subtitles.subtitle_opacity = ConfigSelection(default = "0", choices = [
+               ("0", _("No transparency")),
+               ("75", "25%"),
+               ("150", "50%")])
+       config.subtitles.subtitle_original_position = ConfigYesNo(default = True)
+       config.subtitles.subtitle_alignment = ConfigSelection(choices = [("left", _("left")), ("center", _("center")), ("right", _("right"))], default = "center")
+       config.subtitles.subtitle_position = ConfigSelection( choices = ["0", "50", "100", "150", "200", "250", "300", "350", "400", "450", "500", "550", "600"], default = "100")
+
+       config.subtitles.dvb_subtitles_centered = ConfigYesNo(default = False)
+
+       subtitle_delay_choicelist = []
+       for i in range(-900000, 1845000, 45000):
+               if i == 0:
+                       subtitle_delay_choicelist.append(("0", _("No delay")))
+               else:
+                       subtitle_delay_choicelist.append((str(i), "%2.1f sec" % (i / 90000.)))
+       config.subtitles.subtitle_noPTSrecordingdelay = ConfigSelection(default = "315000", choices = subtitle_delay_choicelist)
+       config.subtitles.subtitle_bad_timing_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
+       config.subtitles.subtitle_rewrap = ConfigYesNo(default = False)
+       config.subtitles.colourise_dialogs = ConfigYesNo(default = False)
+       config.subtitles.pango_subtitle_fontswitch = ConfigYesNo(default = True)
+       config.subtitles.pango_subtitles_delay = ConfigSelection(default = "0", choices = subtitle_delay_choicelist)
+       config.subtitles.pango_subtitles_fps = ConfigSelection(default = "1", choices = [
+               ("1", _("Original")),
+               ("23976", _("23.976")),
+               ("24000", _("24")),
+               ("25000", _("25")),
+               ("29970", _("29.97")),
+               ("30000", _("30"))])
+       config.subtitles.pango_autoturnon = ConfigYesNo(default = True)
+
 def updateChoices(sel, choices):
        if choices:
                defval = None
@@ -136,7 +227,7 @@ def updateChoices(sel, choices):
                sel.setChoices(map(str, choices), defval)
 
 def preferredPath(path):
-       if config.usage.setup_level.index < 2 or path == "<default>":
+       if config.usage.setup_level.index < 2 or path == "<default>" or not path:
                return None  # config.usage.default_path.value, but delay lookup until usage
        elif path == "<current>":
                return config.movielist.last_videodir.value
@@ -152,5 +243,5 @@ def preferredInstantRecordPath():
        return preferredPath(config.usage.instantrec_path.value)
 
 def defaultMoviePath():
-       return config.usage.default_path.value
+       return defaultRecordingLocation(config.usage.default_path.value)