def onSelect(self, session):
		ConfigText.onSelect(self, session)
		if session is not None:
			self.suggestionsWindow = session.instantiateDialog(MyTubeSuggestionsListScreen, self)
			self.suggestionsWindow.deactivate()
			self.suggestionsWindow.hide()
		self.getSuggestions()
	def onDeselect(self, session):
		if self.suggestionsThread is not None:
			self.suggestionsThread.stop()
		ConfigText.onDeselect(self, session)
		if self.suggestionsWindow:
			session.deleteDialog(self.suggestionsWindow)
			self.suggestionsWindow = None
Example #3
0
	def __init__(self, default, fixed_size, visible_width, updateSuggestions):
		ConfigText.__init__(self, default, fixed_size, visible_width)
		self.updateSuggestions = updateSuggestions
		self.suggestions = GoogleSuggestions()
		if config.plugins.YouTube.searchRegion.value:
			self.suggestions.hl = config.plugins.YouTube.searchRegion.value.lower()
		self.suggestionsThread = None
		self.suggestionsThreadRunning = False
Example #4
0
 def __init__(self, default = '', fixed_size = True, visible_width = False):
     ConfigText.__init__(self, default=default, fixed_size=fixed_size, visible_width=visible_width)
     mapping = self.mapping
     if mapping:
         if '<' not in mapping[1]:
             mapping[1] += '<'
         if '>' not in mapping[1]:
             mapping[1] += '>'
Example #5
0
	def __init__(self, session, args = None):
		global connected
		global conn
		self.skin = ModemSetup.skin
		secret = getSecretString()
		user = secret[:secret.find('*')]
		password = secret[secret.find('*')+1:]
		self.username = ConfigText(user, fixed_size=False)
		self.password = ConfigPassword(password, fixed_size=False)
		self.phone = ConfigText(getTelephone(), fixed_size=False)
		self.phone.setUseableChars(u"0123456789")
		lst = [ (_("Username"), self.username),
			(_("Password"), self.password),
			(_("Phone number"), self.phone) ]
		self["list"] = ConfigList(lst)
		self["key_green"] = Button("")
		self["key_red"] = Button("")
		self["state"] = Label("")
		self["actions"] = NumberActionMap(["ModemActions"],
		{
			"cancel": self.close,
			"left": self.keyLeft,
			"right": self.keyRight,
			"connect": self.connect,
			"disconnect": self.disconnect,
			"deleteForward": self.deleteForward,
			"deleteBackward": self.deleteBackward,
			"0": self.keyNumber,
			"1": self.keyNumber,
			"2": self.keyNumber,
			"3": self.keyNumber,
			"4": self.keyNumber,
			"5": self.keyNumber,
			"6": self.keyNumber,
			"7": self.keyNumber,
			"8": self.keyNumber,
			"9": self.keyNumber
		}, -1)

		self["ListActions"] = ActionMap(["ListboxDisableActions"],
		{
			"moveUp": self.nothing,
			"moveDown": self.nothing,
			"moveTop": self.nothing,
			"moveEnd": self.nothing,
			"pageUp": self.nothing,
			"pageDown": self.nothing
		}, -1)

		self.stateTimer = eTimer()
		self.stateTimer.callback.append(self.stateLoop)

		conn.appClosed.append(self.pppdClosed)
		conn.dataAvail.append(self.dataAvail)

		Screen.__init__(self, session)
		self.onClose.append(self.__closed)
		self.onLayoutFinish.append(self.__layoutFinished)
	def __init__(self, default = "", fixed_size = True, visible_width = False):
		ConfigText.__init__(self, default = default, fixed_size = fixed_size, visible_width = visible_width)

		# Workaround some characters currently not "typeable" using NumericalTextInput
		mapping = self.mapping
		if mapping:
			if "&" not in mapping[0]:
				mapping[0] += "&"
			if ";" not in mapping[0]:
				mapping[0] += ";"
			if "%" not in mapping[0]:
				mapping[0] += "%"
	def onSelect(self, session):
		if self.threaded:
			self.suggestionsThread = ConfigTextWithSuggestions.SuggestionsThread(self.suggestions)
			self.suggestionsThread.start()
		else:
			self.suggestionsThread = None
		ConfigText.onSelect(self, session)
		if session is not None:
			self.suggestionsWindow = session.instantiateDialog(SuggestionsListScreen, self)
			self.suggestionsWindow.deactivate()
			self.suggestionsWindow.hide()
		self.suggestions.getSuggestions(self.value)
Example #8
0
 def __init__(self, default = '', fixed_size = True, visible_width = False):
     ConfigText.__init__(self, default=default, fixed_size=fixed_size, visible_width=visible_width)
     mapping = self.mapping
     if mapping:
         mapping[1] = '1*-/,'
         mapping[2] = '2'
         mapping[3] = '3'
         mapping[4] = '4'
         mapping[5] = '5'
         mapping[6] = '6'
         mapping[7] = '7'
         mapping[8] = '8'
         mapping[9] = '9'
         mapping[0] = '0'
	def buildSetup(self, service):
		self.service = service
		self.is_dir = service.flags & eServiceReference.mustDescent
		info = self.serviceHandler.info(service)
		path = service.getPath()
		self["Path"] = Label(_("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0]))
		if self.is_dir:
			self.original_file = service.getName()
		else:
			self.original_file = os.path.basename(os.path.splitext(path)[0])
		self.original_name = info.getName(service)
		self.original_desc = info.getInfoString(service, iServiceInformation.sDescription)
		self.input_file = ConfigText(default=self.original_file, fixed_size=False, visible_width=82)
		self.input_title = ConfigText(default=self.original_name, fixed_size=False, visible_width=82)
		self.input_descr = ConfigText(default=self.original_desc, fixed_size=False, visible_width=82)
		self.createSetup()
Example #10
0
	def __init__(self, session, params=None):
		debug("[EmailConfigAccount] __init__")
		self._session = session
		Screen.__init__(self, session)
		self.setTitle(_("Account Setup"))
		self.list = []
		ConfigListScreen.__init__(self, self.list, session=session)
		self["buttonred"] = Label(_("cancel"))
		self["buttongreen"] = Label(_("ok"))
		self["setupActions"] = ActionMap(["SetupActions"],
		{
			"green": self.save,
			"red": self.cancel,
			"save": self.save,
			"cancel": self.cancel,
			"ok": self.save,
		}, -2)
		
		if params:
			(self._name, self._server, self._port, self._user, self._password, self._interval, self._maxmail, self._listall) = params
		else:
			(self._name, self._server, self._port, self._user, self._password, self._interval, self._maxmail, self._listall) = ("", "", "993", "", "", "60", "50", False)
		self._cName = ConfigText(self._name, fixed_size=False)
		self._cServer = ConfigText(self._server, fixed_size=False)
		self._cPort = ConfigSelection(choices=[("143", "143"), ("993", "993 (SSL)")], default=self._port)
		self._cUser = ConfigText(self._user, fixed_size=False)
		self._cPassword = ConfigPassword(self._password, fixed_size=False)
		self._cInterval = ConfigText(self._interval, fixed_size=False)
		self._cInterval.setUseableChars('0123456789,')
		self._cMaxmail = ConfigText(self._maxmail, fixed_size=False)
		self._cMaxmail.setUseableChars('0123456789,')
		self._cListall = ConfigEnableDisable(self._listall)
		
		self.list = [
					getConfigListEntry(_("account name"), self._cName),
					getConfigListEntry(_("IMAP Server"), self._cServer),
					getConfigListEntry(_("IMAP Port"), self._cPort),
					getConfigListEntry(_("user name"), self._cUser),
					getConfigListEntry(_("password"), self._cPassword),
					getConfigListEntry(_("mail check interval (minutes)"), self._cInterval),
					getConfigListEntry(_("maximum mail size to fetch"), self._cMaxmail),
					getConfigListEntry(_("list all mailboxes"), self._cListall)
					]
		self["config"].list = self.list
		self["config"].l.setList(self.list)
    def __init__(self, session, title="", text=""):
        #VirtualKeyBoard.__init__(self, session, title, text) Changed by Topfi, added parameter names
        VirtualKeyBoard.__init__(self, session, title=title, text=text)
        NumericalTextInput.__init__(self, nextFunc=self.nextFunc)
        SkinResolutionHelper.__init__(self)
        self.configText = None
        if config.AdvancedMovieSelection.keyboard.value == "virtual":
            use = self.KEYBOARD
        elif config.AdvancedMovieSelection.keyboard.value == "numerical":
            use = self.NUM_KEYB
        else:
            use = self.BOTH
        if not use & self.KEYBOARD:
            # hide the keyboard
            self["list"].hide()
            # overwrite VirtualKeyBoard actions
            # make sure not overwrite any action of base class
            self["actions"] = ActionMap(["OkCancelActions", "WizardActions", "ColorActions", "KeyboardInputActions", "InputBoxActions", "InputAsciiActions"],
            {
                "ok": self.__ok,
                "cancel": self.__cancel,
                "left": self.dummy,
                "right": self.dummy,
                "up": self.dummy,
                "down": self.dummy,
                "red": self.__cancel,
                "green": self.__ok,
                "yellow": self.dummy,
                "deleteBackward": self.dummy,
                "back": self.dummy                
            }, -2)

        if use & self.NUM_KEYB:
            self.timer = eTimer()
            self.timer.callback.append(self.timeout)
            self.configText = ConfigText("", False)
            if text:
                self.configText.text = text
                self.configText.marked_pos = len(text)
            self["config_actions"] = NumberActionMap(["SetupActions", "InputAsciiActions", "KeyboardInputActions"],
            {
                "1": self.keyNumberGlobal,
                "2": self.keyNumberGlobal,
                "3": self.keyNumberGlobal,
                "4": self.keyNumberGlobal,
                "5": self.keyNumberGlobal,
                "6": self.keyNumberGlobal,
                "7": self.keyNumberGlobal,
                "8": self.keyNumberGlobal,
                "9": self.keyNumberGlobal,
                "0": self.keyNumberGlobal
            }, -1) # to prevent left/right overriding the listbox
            if use & self.KEYBOARD:
                self.selectedKey = self.getKeyIndex(u"OK") 
            
        self.onLayoutFinish.append(self.__onLayoutFinish)
        self.onClose.append(self.__onClose)
	def __init__(self, default = "0000", size= 4):
		try:
			dummy = int(default,16)
		except:
			default="0"*size
		ConfigText.__init__(self, default, fixed_size = False)
		self.mapping = []
		self.mapping.append (u"0") # 0
		self.mapping.append (u"1") # 1
		self.mapping.append (u"2ABC") # 2
		self.mapping.append (u"3DEF") # 3
		self.mapping.append (u"4") # 4
		self.mapping.append (u"5") # 5
		self.mapping.append (u"6") # 6
		self.mapping.append (u"7") # 7
		self.mapping.append (u"8") # 8
		self.mapping.append (u"9") # 9
		
		self.size = size
	def handleKey(self, key):
		if key in KEY_NUMBERS or key == KEY_ASCII:
			if key == KEY_ASCII:
				owr = False
				ascii = getPrevAsciiCode()
				if not (48 <= ascii <= 57) or not(65 <= ascii <= 70) or not(97 <= ascii <= 102):
					return
	  			newChar = unichr(ascii)
			else:
				owr = self.lastKey == getKeyNumber(key)
				newChar = self.getKey(getKeyNumber(key))
			if self.allmarked:
				self.text = "0" * self.size
				self.allmarked = False
				self.marked_pos = 0
			self.insertChar(newChar, self.marked_pos, True)
		else:
			ConfigText.handleKey(self, key)
		self.conform()
Example #14
0
 def __init__(self, session, service):
     Screen.__init__(self, session)
     self.skinName = SkinTools.appendResolution("AdvancedMovieSelection_Rename_")
     self.service = service
     self.movieConfig = MovieConfig()
     self.is_vdir = isinstance(service, eServiceReferenceVDir)
     self.is_dir = service.flags & eServiceReference.mustDescent
     serviceHandler = ServiceCenter.getInstance()
     info = serviceHandler.info(service)
     path = service.getPath()
     if self.is_vdir:
         parts = path.split("/")
         if len(parts) > 2:
             dirName = parts[-3] + "/" + parts[-2]
         else: 
             dirName = parts[-2]
         self.original_file = dirName 
     elif self.is_dir:
         self.original_file = service.getName()
     else:
         self.original_file = os.path.basename(os.path.splitext(path)[0])
     if self.is_vdir:
         self.original_name = self.movieConfig.getRenamedName(service.getName())
     else:
         self.original_name = info.getName(service)
     self.original_desc = info.getInfoString(service, iServiceInformation.sDescription)
     self.input_file = ConfigText(default=self.original_file, fixed_size=False, visible_width=82)
     self.input_title = ConfigText(default=self.original_name, fixed_size=False, visible_width=82)
     self.input_descr = ConfigText(default=self.original_desc, fixed_size=False, visible_width=82)
     self["key_green"] = StaticText(_("Save"))
     self["key_red"] = StaticText(_("Cancel"))
     self["actions"] = ActionMap(["SetupActions"],
     {
         "ok": self.keyGo,
         "save": self.keyGo,
         "cancel": self.keyCancel,
     }, -2)
     self.list = [ ]
     ConfigListScreen.__init__(self, self.list, session=self.session)
     self.createSetup()
     self["Path"] = Label(_("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0]))
     self["HelpWindow"] = Pixmap()
     self.onLayoutFinish.append(self.setCustomTitle)
Example #15
0
class PopupInputDialog(InputBox):
    def __init__(self, session):
        InputBox.__init__(self, session)
        self.numti = NumericalTextInput()
        self.configText = ConfigText("", False)
        self.configText.help_window = self.session.instantiateDialog(PopupInputHelpDialog, self.numti)
        self.setTitle(_("Search:"))

    def keyNumberGlobal(self, number):
        self.configText.handleKey(KEY_0 + number)
        self["input"].number(number)

    def show(self):
        self["input"].setText("")
        self.configText.setValue("")
        self.configText.help_window.show()
        return Screen.show(self)

    def hide(self):
        self.configText.help_window.hide()
        return Screen.hide(self)
Example #16
0
	def __init__(self, session, name, path, descr):
		Screen.__init__(self, session)
		self.skinName = [ "AdvancedCutInput", "Setup" ]

		self["key_green"] = StaticText(_("OK"))
		self["key_red"] = StaticText(_("Cancel"))

		if self.baseName(path) == self.baseName(name):
			title = ""
		else:
			title = name
		dir = self.dirName(path)
		file = self.baseName(path) + " cut"
		self.input_replace = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "no")
		self.input_file = ConfigText(default = file, fixed_size = False, visible_width = 45)
		self.input_title = ConfigText(default = title, fixed_size = False, visible_width = 45)
		self.input_descr = ConfigText(default = descr, fixed_size = False, visible_width = 45)
		tmp = config.movielist.videodirs.value
		if not dir in tmp:
			tmp.append(dir)
		self.input_dir = ConfigSelection(choices = tmp, default = dir)
		self.input_manual = ConfigSelection(choices = [("no", _("Cutlist")), ("yes", _("Manual specification"))], default = "no")
		self.input_space = ConfigNothing()
		self.input_manualcuts = ConfigText(default = "", fixed_size = False)
		self.input_manualcuts.setUseableChars(" 0123456789:.")

		self["actions"] = ActionMap(["SetupActions"],
		{
			"ok": self.keySelectOrGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list)
		self.entry_replace = getConfigListEntry(_("Replace original:"), self.input_replace)
		self.entry_file = getConfigListEntry(_("New filename:"), self.input_file)
		self.entry_title = getConfigListEntry(_("New title:"), self.input_title)
		self.entry_descr = getConfigListEntry(_("New description:"), self.input_descr)
		self.entry_dir = getConfigListEntry(_("New location:"), self.input_dir)
		self.entry_manual = getConfigListEntry(_("Cut source:"), self.input_manual)
		self.entry_space = getConfigListEntry(_("Cuts (an IN OUT IN OUT ... sequence of hour:min:sec)"), self.input_space)
		self.entry_manualcuts = getConfigListEntry(":", self.input_manualcuts)
		self.createSetup(self["config"])

		self.onLayoutFinish.append(self.layoutFinished)
	def handleKey(self, key):
		ConfigText.handleKey(self, key)
		if key in [KEY_DELETE, KEY_BACKSPACE, KEY_ASCII, KEY_TIMEOUT]:
			self.getSuggestions()
 def onSelect(self, session):
     ConfigText.onSelect(self, session)
     self.getSuggestions()
Example #19
0
 def setValue(self, val):
     ConfigText.setValue(self, val)
Example #20
0
    def updateList(self):

        self.ina_active = NoSave(ConfigYesNo(default="False"))
        self.ina_user = NoSave(ConfigText(fixed_size=False))
        self.ina_pass = NoSave(ConfigText(fixed_size=False))
        self.ina_alias = NoSave(ConfigText(fixed_size=False))
        self.ina_period = NoSave(ConfigNumber())
        self.ina_sysactive = NoSave(ConfigYesNo(default="False"))
        self.ina_system = NoSave(ConfigText(fixed_size=False))

        if fileExists("/etc/rc3.d/S20inadyn-mt"):
            self.ina_active.value = True
        else:
            self.ina_active.value = False
        ina_active1 = getConfigListEntry(_("Activate Inadyn"), self.ina_active)
        self.list.append(ina_active1)

        if fileExists("/etc/inadyn.conf"):
            f = open("/etc/inadyn.conf", 'r')
            for line in f.readlines():
                line = line.strip()
                if line.startswith('username '):
                    line = line[9:]
                    self.ina_user.value = line
                    ina_user1 = getConfigListEntry(_("Username"),
                                                   self.ina_user)
                    self.list.append(ina_user1)
                elif line.startswith('password '):
                    line = line[9:]
                    self.ina_pass.value = line
                    ina_pass1 = getConfigListEntry(_("Password"),
                                                   self.ina_pass)
                    self.list.append(ina_pass1)
                elif line.startswith('alias '):
                    line = line[6:]
                    self.ina_alias.value = line
                    ina_alias1 = getConfigListEntry(_("Alias"), self.ina_alias)
                    self.list.append(ina_alias1)
                elif line.startswith('update_period_sec '):
                    line = int(line[18:])
                    line = (line / 60)
                    self.ina_period.value = line
                    ina_period1 = getConfigListEntry(
                        _("Time Update in Minutes"), self.ina_period)
                    self.list.append(ina_period1)
                elif line.startswith('dyndns_system ') or line.startswith(
                        '#dyndns_system '):
                    if line.startswith('#'):
                        line = line[15:]
                        self.ina_sysactive.value = False
                    else:
                        line = line[14:]
                        self.ina_sysactive.value = True

                    ina_sysactive1 = getConfigListEntry(
                        _("Set System"), self.ina_sysactive)
                    self.list.append(ina_sysactive1)

                    self.ina_system.value = line
                    ina_system1 = getConfigListEntry(_("System"),
                                                     self.ina_system)
                    self.list.append(ina_system1)

            f.close()

        self["config"].list = self.list
        self["config"].l.setList(self.list)
Example #21
0
from Components.SystemInfo import SystemInfo, hassoftcaminstalled
from Components import Opkg
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.Console import Console
from Plugins.Plugin import PluginDescriptor
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_SKIN
from Tools.LoadPixmap import LoadPixmap

from time import time
import os

language.addCallback(plugins.reloadPlugins)

config.misc.pluginbrowser = ConfigSubsection()
config.misc.pluginbrowser.plugin_order = ConfigText(default="")


class PluginBrowserSummary(Screen):
    def __init__(self, session, parent):
        Screen.__init__(self, session, parent=parent)
        self["entry"] = StaticText("")
        self["desc"] = StaticText("")
        self.onShow.append(self.addWatcher)
        self.onHide.append(self.removeWatcher)

    def addWatcher(self):
        self.parent.onChangedEntry.append(self.selectionChanged)
        self.parent.selectionChanged()

    def removeWatcher(self):
 def handleKey(self, key):
     ConfigText.handleKey(self, key)
     if key in [KEY_DELETE, KEY_BACKSPACE, KEY_ASCII, KEY_TIMEOUT]:
         self.getSuggestions()
Example #23
0
class AdvancedCutInput(Screen, ConfigListScreen):
	def __init__(self, session, name, path, descr):
		Screen.__init__(self, session)
		self.skinName = [ "AdvancedCutInput", "Setup" ]

		self["key_green"] = StaticText(_("OK"))
		self["key_red"] = StaticText(_("Cancel"))

		if self.baseName(path) == self.baseName(name):
			title = ""
		else:
			title = name
		dir = self.dirName(path)
		file = self.baseName(path) + " cut"
		self.input_replace = ConfigSelection(choices = [("no", _("No")), ("yes", _("Yes"))], default = "no")
		self.input_file = ConfigText(default = file, fixed_size = False, visible_width = 45)
		self.input_title = ConfigText(default = title, fixed_size = False, visible_width = 45)
		self.input_descr = ConfigText(default = descr, fixed_size = False, visible_width = 45)
		tmp = config.movielist.videodirs.value
		if not dir in tmp:
			tmp.append(dir)
		self.input_dir = ConfigSelection(choices = tmp, default = dir)
		self.input_manual = ConfigSelection(choices = [("no", _("Cutlist")), ("yes", _("Manual specification"))], default = "no")
		self.input_space = ConfigNothing()
		self.input_manualcuts = ConfigText(default = "", fixed_size = False)
		self.input_manualcuts.setUseableChars(" 0123456789:.")

		self["actions"] = ActionMap(["SetupActions"],
		{
			"ok": self.keySelectOrGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list)
		self.entry_replace = getConfigListEntry(_("Replace original:"), self.input_replace)
		self.entry_file = getConfigListEntry(_("New filename:"), self.input_file)
		self.entry_title = getConfigListEntry(_("New title:"), self.input_title)
		self.entry_descr = getConfigListEntry(_("New description:"), self.input_descr)
		self.entry_dir = getConfigListEntry(_("New location:"), self.input_dir)
		self.entry_manual = getConfigListEntry(_("Cut source:"), self.input_manual)
		self.entry_space = getConfigListEntry(_("Cuts (an IN OUT IN OUT ... sequence of hour:min:sec)"), self.input_space)
		self.entry_manualcuts = getConfigListEntry(":", self.input_manualcuts)
		self.createSetup(self["config"])

		self.onLayoutFinish.append(self.layoutFinished)

	def layoutFinished(self):
		self.setTitle(_("Cut Parameter Input"))

	def createSetup(self, configlist):
		list = [
			self.entry_replace
		]
		if self.input_replace.value == "no":
			list.extend((
				self.entry_file,
				self.entry_dir,
			))
		list.extend((
			self.entry_title,
			self.entry_descr,
			self.entry_manual,
		))
		if self.input_manual.value == "yes":
			list.extend((
				self.entry_space,
				self.entry_manualcuts,
			))
		self.list = list
		configlist.list = list
		configlist.l.setList(list)

	def keyLeft(self):
		ConfigListScreen.keyLeft(self)
		cc = self["config"].getCurrent()
		if cc is self.entry_replace or cc is self.entry_manual:
			self.createSetup(self["config"])

	def keyRight(self):
		ConfigListScreen.keyRight(self)
		cc = self["config"].getCurrent()
		if cc is self.entry_replace or cc is self.entry_manual:
			self.createSetup(self["config"])

	def pathSelected(self, res):
		if res is not None:
			if config.movielist.videodirs.value != self.input_dir.choices:
				self.input_dir.setChoices(config.movielist.videodirs.value, default=res)
			self.input_dir.value = res

	def keySelectOrGo(self):
		if self["config"].getCurrent() == self.entry_dir:
			self.session.openWithCallback(
				self.pathSelected,
				MovieLocationBox,
				_("Choose target folder"),
				self.input_dir.value,
			)
		else:
			self.keyGo()

	def keyGo(self):
		if self.input_replace.value == "yes":
			path = False
		else:
			path = self.rejoinName(self.input_dir.value, self.input_file.value)
		if self.input_manual.value == "no":
			cuts = False
		else:
			cuts = self.input_manualcuts.value.split(' ')
			while "" in cuts:
				cuts.remove("")
		self.close((True, self.input_replace.value == "yes", path, self.input_title.value, self.input_descr.value, cuts))

	def keyCancel(self):
		self.close((False,))

	def baseName(self, str):
		name = str.split('/')[-1]
		if name.endswith(".ts") is True:
			return name[:-3]
		else:
			return name

	def dirName(self, str):
		return '/'.join(str.split('/')[:-1]) + '/'

	def rejoinName(self, dir, name):
		name = name.strip()
		if name.endswith(".ts") is True:
			return dir + name[:-3]
		else:
			return dir + name
Example #24
0
from enigma import eServiceReference, eConsoleAppContainer
from Components.MediaPlayer import PlayList
import xml.dom.minidom
from Plugins.Plugin import PluginDescriptor
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Button import Button
from Screens.Screen import Screen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, getConfigListEntry
from Components.ConfigList import ConfigListScreen
import six

config.plugins.CDInfo = ConfigSubsection()
config.plugins.CDInfo.useCDTEXT = ConfigYesNo(default=True)
config.plugins.CDInfo.useCDDB = ConfigYesNo(default=True)
config.plugins.CDInfo.displayString = ConfigText("$i - $t ($a)",
                                                 fixed_size=False)
config.plugins.CDInfo.preferCDDB = ConfigYesNo(default=False)
config.plugins.CDInfo.CDDB_server = ConfigText("freedb.freedb.org",
                                               fixed_size=False)
config.plugins.CDInfo.CDDB_port = ConfigInteger(8880, limits=(1, 65536))
config.plugins.CDInfo.CDDB_timeout = ConfigInteger(20, limits=(-1, 60))
config.plugins.CDInfo.CDDB_cache = ConfigYesNo(default=True)


class CDInfo(ConfigListScreen, Screen):
    skin = """
		<screen position="90,95" size="560,430" title="CDInfo" >
		    <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
		    <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
		    <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
		    <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
Example #25
0
Components.ParentalControl.InitParentalControl()

profile("LOAD:Navigation")
from Navigation import Navigation

profile("LOAD:skin")
from skin import readSkin

profile("LOAD:Tools")
from Tools.Directories import InitFallbackFiles, resolveFilename, SCOPE_PLUGINS, SCOPE_ACTIVE_SKIN, SCOPE_CURRENT_SKIN, SCOPE_CONFIG
from Components.config import config, configfile, ConfigText, ConfigYesNo, ConfigInteger, ConfigSelection, NoSave

InitFallbackFiles()

profile("config.misc")
config.misc.blackradiopic = ConfigText(
    default=resolveFilename(SCOPE_ACTIVE_SKIN, "black.mvi"))
radiopic = resolveFilename(SCOPE_ACTIVE_SKIN, "radio.mvi")
if os.path.exists(resolveFilename(SCOPE_CONFIG, "radio.mvi")):
    radiopic = resolveFilename(SCOPE_CONFIG, "radio.mvi")
config.misc.radiopic = ConfigText(default=radiopic)
config.misc.isNextRecordTimerAfterEventActionAuto = ConfigYesNo(default=False)
config.misc.isNextPowerTimerAfterEventActionAuto = ConfigYesNo(default=False)
config.misc.SyncTimeUsing = ConfigSelection(default="0",
                                            choices=[("0", "Transponder Time"),
                                                     ("1", _("NTP"))])
config.misc.NTPserver = ConfigText(default='pool.ntp.org', fixed_size=False)

config.misc.startCounter = ConfigInteger(default=0)  # number of e2 starts...
config.misc.standbyCounter = NoSave(
    ConfigInteger(default=0))  # number of standby
config.misc.DeepStandby = NoSave(
Example #26
0
                self.updateList()

    def info(self):
        mysel = self['list'].getCurrent()
        if mysel:
            myline = mysel[1]
            self.session.open(MessageBox, _(myline), MessageBox.TYPE_INFO)


config.crontimers = ConfigSubsection()
config.crontimers.commandtype = NoSave(
    ConfigSelection(choices=[('custom',
                              _("Custom")), ('predefined', _("Predefined"))]))
config.crontimers.cmdtime = NoSave(ConfigClock(default=0))
config.crontimers.cmdtime.value, mytmpt = ([0, 0], [0, 0])
config.crontimers.user_command = NoSave(ConfigText(fixed_size=False))
config.crontimers.runwhen = NoSave(
    ConfigSelection(default='Daily',
                    choices=[('Hourly', _("Hourly")), ('Daily', _("Daily")),
                             ('Weekly', _("Weekly")),
                             ('Monthly', _("Monthly"))]))
config.crontimers.dayofweek = NoSave(
    ConfigSelection(default='Monday',
                    choices=[('Monday', _("Monday")),
                             ('Tuesday', _("Tuesday")),
                             ('Wednesday', _("Wednesday")),
                             ('Thursday', _("Thursday")),
                             ('Friday', _("Friday")),
                             ('Saturday', _("Saturday")),
                             ('Sunday', _("Sunday"))]))
config.crontimers.dayofmonth = NoSave(ConfigInteger(default=1, limits=(1, 31)))
Example #27
0
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuList
from Components.config import getConfigListEntry, configfile, ConfigSelection, ConfigSubsection, ConfigText, ConfigLocations
from Components.config import config
from Components.ConfigList import ConfigList, ConfigListScreen
from Components.FileList import MultiFileSelectList
from Plugins.Plugin import PluginDescriptor
from enigma import eTimer, eEnv, eEPGCache
from Tools.Directories import *
from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
from time import gmtime, strftime, localtime
from datetime import date
from re import sub

config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(
    default='/media/hdd/', visible_width=50, fixed_size=False)
config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[
    eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces',
    '/etc/wpa_supplicant.conf', '/etc/wpa_supplicant.ath0.conf',
    '/etc/wpa_supplicant.wlan0.conf', '/etc/resolv.conf', '/etc/default_gw',
    '/etc/hostname'
])


def getBackupPath():
    backuppath = config.plugins.configurationbackup.backuplocation.value
    if backuppath.endswith('/'):
        return backuppath + 'backup'
    else:
        return backuppath + '/backup'
Example #28
0
from Screens.MessageBox import MessageBox
from Components.config import config, ConfigSelection, ConfigYesNo, getConfigListEntry, ConfigSubsection, ConfigText
from Components.ConfigList import ConfigListScreen
from Components.NimManager import nimmanager
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.ProgressBar import ProgressBar
from Components.ServiceList import refreshServiceList
from Components.ActionMap import ActionMap

from enigma import eFastScan, eDVBFrontendParametersSatellite, eTimer

import os

config.misc.fastscan = ConfigSubsection()
config.misc.fastscan.last_configuration = ConfigText(default="()")
config.misc.fastscan.auto = ConfigSelection(default="true",
                                            choices=[("true", _("yes")),
                                                     ("false", _("no")),
                                                     ("multi", _("multi"))])
config.misc.fastscan.autoproviders = ConfigText(default="()")
config.misc.fastscan.drop = ConfigYesNo(default=True)

providers = [('Canal Digitaal', (1, 900, True)),
             ('TV Vlaanderen', (1, 910, True)),
             ('TeleSAT Belgium', (0, 920, False)),
             ('TeleSAT Luxembourg', (0, 921, False)),
             ('HD Austria', (0, 950, False)), ('Diveo', (0, 960, False)),
             ('Skylink Czech Republic', (1, 30, False)),
             ('Skylink Slovak Republic', (1, 31, False)),
             ('FreeSAT CZ', (2, 82, False)), ('FreeSAT SK', (2, 83, False)),
Example #29
0
    import simplejson as json
from Components.config import config, ConfigSelection, ConfigYesNo, ConfigText, getConfigListEntry
###################################################

###################################################
# E2 GUI COMMPONENTS
###################################################
from Plugins.Extensions.IPTVPlayer.components.asynccall import MainSessionWrapper, iptv_js_execute
from Plugins.Extensions.IPTVPlayer.components.iptvmultipleinputbox import IPTVMultipleInputBox
from Screens.MessageBox import MessageBox
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.efilmytv_login = ConfigText(default="",
                                                      fixed_size=False)
config.plugins.iptvplayer.efilmytv_password = ConfigText(default="",
                                                         fixed_size=False)


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry(
            _("login") + ":", config.plugins.iptvplayer.efilmytv_login))
    optionList.append(
        getConfigListEntry(
            _("password") + ":", config.plugins.iptvplayer.efilmytv_password))
    return optionList

Example #30
0
# skins are loaded in order of priority: skin with
# highest priority is loaded last, usually the user-provided
# skin.

# currently, loadSingleSkinData (colors, bordersets etc.)
# are applied one-after-each, in order of ascending priority.
# the dom_skin will keep all screens in descending priority,
# so the first screen found will be used.

# example: loadSkin("nemesis_greenline/skin.xml")
config.skin = ConfigSubsection()
DEFAULT_SKIN = "BlackShadowSE_P/skin.xml"
if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)):
    # in that case, fallback to Magic (which is an SD skin)
    DEFAULT_SKIN = "skin.xml"
config.skin.primary_skin = ConfigText(default=DEFAULT_SKIN)

DEFAULT_DISPLAY_SKIN = "skin_display.xml"
config.skin.display_skin = ConfigText(default=DEFAULT_DISPLAY_SKIN)

profile("LoadSkin")
res = None
name = skin_user_skinname()
if name:
    res = addSkin(name, SCOPE_CONFIG)
if not name or not res:
    addSkin('skin_user.xml', SCOPE_CONFIG)

# some boxes lie about their dimensions
addSkin('skin_box.xml')
# add optional discrete second infobar
	def onDeselect(self, session):
		self.cancelSuggestionsThread()
		ConfigText.onDeselect(self, session)
Example #32
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
#pragma mark - Config
from Components.config import config, ConfigSubsection, ConfigText, \
  ConfigPassword, ConfigLocations, ConfigSet, ConfigNumber, \
  ConfigSelection

from Tools.Directories import resolveFilename, SCOPE_HDD

config.plugins.ecasa = ConfigSubsection()
config.plugins.ecasa.google_username = ConfigText(default="", fixed_size=False)
config.plugins.ecasa.google_password = ConfigPassword(default="")
config.plugins.ecasa.cachedirs = ConfigLocations(
    default=[resolveFilename(SCOPE_HDD, "ecasa")])
config.plugins.ecasa.cache = ConfigText(default="/media/hdd/ecasa")
config.plugins.ecasa.user = ConfigText(default='default')
config.plugins.ecasa.searchhistory = ConfigSet(choices=[])
config.plugins.ecasa.userhistory = ConfigSet(choices=[])
config.plugins.ecasa.searchlimit = ConfigNumber(default=15)
config.plugins.ecasa.cachesize = ConfigNumber(default=15)
config.plugins.ecasa.slideshow_interval = ConfigNumber(default=30)
config.plugins.ecasa.flickr_api_key = ConfigText(default="", fixed_size=False)
config.plugins.ecasa.last_backend = ConfigSelection(
    default='picasa', choices=['picasa', 'flickr'])
Example #33
0
class TimerEntry(Screen, ConfigListScreen):
	def __init__(self, session, timer):
		Screen.__init__(self, session)
		self.setup_title = _("Timer entry")
		self.timer = timer

		self.entryDate = None
		self.entryService = None

		self["HelpWindow"] = Pixmap()
		self["HelpWindow"].hide()

		self["description"] = Label("")
		self["oktext"] = Label(_("OK"))
		self["canceltext"] = Label(_("Cancel"))
		self["ok"] = Pixmap()
		self["cancel"] = Pixmap()
		self["key_yellow"] = Label(_("Timer type"))

		self.createConfig()

		self["actions"] = NumberActionMap(["SetupActions", "GlobalActions", "PiPSetupActions", "ColorActions"],
		{
			"ok": self.keySelect,
			"save": self.keyGo,
			"cancel": self.keyCancel,
			"volumeUp": self.incrementStart,
			"volumeDown": self.decrementStart,
			"size+": self.incrementEnd,
			"size-": self.decrementEnd,
			"yellow": self.changeTimerType
		}, -2)

		self.onChangedEntry = [ ]
		self.list = []
		ConfigListScreen.__init__(self, self.list, session = session)
		self.createSetup("config")
		self.onLayoutFinish.append(self.layoutFinished)
		if not self.selectionChanged in self["config"].onSelectionChanged:
			self["config"].onSelectionChanged.append(self.selectionChanged)
		self.selectionChanged()

	def createConfig(self):
		justplay = self.timer.justplay
		always_zap = self.timer.always_zap

		afterevent = {
			AFTEREVENT.NONE: "nothing",
			AFTEREVENT.DEEPSTANDBY: "deepstandby",
			AFTEREVENT.STANDBY: "standby",
			AFTEREVENT.AUTO: "auto"
			}[self.timer.afterEvent]

		if self.timer.record_ecm and self.timer.descramble:
			recordingtype = "descrambled+ecm"
		elif self.timer.record_ecm:
			recordingtype = "scrambled+ecm"
		elif self.timer.descramble:
			recordingtype = "normal"

		weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

		# calculate default values
		day = []
		weekday = 0
		for x in (0, 1, 2, 3, 4, 5, 6):
			day.append(0)
		if self.timer.repeated: # repeated
			type = "repeated"
			if self.timer.repeated == 31: # Mon-Fri
				repeated = "weekdays"
			elif self.timer.repeated == 127: # daily
				repeated = "daily"
			else:
				flags = self.timer.repeated
				repeated = "user"
				count = 0
				for x in (0, 1, 2, 3, 4, 5, 6):
					if flags == 1: # weekly
# 							print "Set to weekday " + str(x)
						weekday = x
					if flags & 1 == 1: # set user defined flags
						day[x] = 1
						count += 1
					else:
						day[x] = 0
					flags >>= 1
				if count == 1:
					repeated = "weekly"
		else: # once
			type = "once"
			repeated = None
			weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
			day[weekday] = 1

		self.timerentry_justplay = ConfigSelection(choices = [
			("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
			default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
		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_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
		self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
		self.timerentry_name = ConfigText(default = self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode("utf-8"), visible_width = 50, fixed_size = False)
		self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
		self.timerentry_tags = self.timer.tags[:]
		self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])

		self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])

		self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
		self.timerentry_starttime = ConfigClock(default = self.timer.begin)
		self.timerentry_endtime = ConfigClock(default = self.timer.end)
		self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])

		default = self.timer.dirname or defaultMoviePath()
		tmp = config.movielist.videodirs.getValue()
		if default not in tmp:
			tmp.append(default)
		self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)

		self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)

		self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])

		self.timerentry_day = ConfigSubList()
		for x in (0, 1, 2, 3, 4, 5, 6):
			self.timerentry_day.append(ConfigYesNo(default = day[x]))

		# FIXME some service-chooser needed here
		servicename = "N/A"
		try: # no current service available?
			servicename = str(self.timer.service_ref.getServiceName())
		except:
			pass
		self.timerentry_service_ref = self.timer.service_ref
		self.timerentry_service = ConfigSelection([servicename])

	def createSetup(self, widget):
		self.list = []
		self.list.append(getConfigListEntry(_("Name"), self.timerentry_name, _("Set the name the recording will get.")))
		self.list.append(getConfigListEntry(_("Description"), self.timerentry_description, _("Set the description of the recording.")))
		self.timerJustplayEntry = getConfigListEntry(_("Timer type"), self.timerentry_justplay, _("Chose between record and ZAP."))
		self.list.append(self.timerJustplayEntry)
		self.timerTypeEntry = getConfigListEntry(_("Repeat type"), self.timerentry_type, _("A repeating timer or just once?"))
		self.list.append(self.timerTypeEntry)

		if self.timerentry_type.getValue() == "once":
			self.frequencyEntry = None
		else: # repeated
			self.frequencyEntry = getConfigListEntry(_("Repeats"), self.timerentry_repeated, _("Choose between Daily, Weekly, Weekdays or user defined."))
			self.list.append(self.frequencyEntry)
			self.repeatedbegindateEntry = getConfigListEntry(_("Starting on"), self.timerentry_repeatedbegindate, _("Set the date the timer must start."))
			self.list.append(self.repeatedbegindateEntry)
			if self.timerentry_repeated.getValue() == "daily":
				pass
			if self.timerentry_repeated.getValue() == "weekdays":
				pass
			if self.timerentry_repeated.getValue() == "weekly":
				self.list.append(getConfigListEntry(_("Weekday"), self.timerentry_weekday))

			if self.timerentry_repeated.getValue() == "user":
				self.list.append(getConfigListEntry(_("Monday"), self.timerentry_day[0]))
				self.list.append(getConfigListEntry(_("Tuesday"), self.timerentry_day[1]))
				self.list.append(getConfigListEntry(_("Wednesday"), self.timerentry_day[2]))
				self.list.append(getConfigListEntry(_("Thursday"), self.timerentry_day[3]))
				self.list.append(getConfigListEntry(_("Friday"), self.timerentry_day[4]))
				self.list.append(getConfigListEntry(_("Saturday"), self.timerentry_day[5]))
				self.list.append(getConfigListEntry(_("Sunday"), self.timerentry_day[6]))

		self.entryDate = getConfigListEntry(_("Date"), self.timerentry_date, _("Set the date the timer must start."))
		if self.timerentry_type.getValue() == "once":
			self.list.append(self.entryDate)

		self.entryStartTime = getConfigListEntry(_("Start time"), self.timerentry_starttime, _("Set the time the timer must start."))
		self.list.append(self.entryStartTime)

		self.entryShowEndTime = getConfigListEntry(_("Set end time"), self.timerentry_showendtime, _("Set the time the timer must stop."))
		if self.timerentry_justplay.getValue() == "zap":
			self.list.append(self.entryShowEndTime)
		self.entryEndTime = getConfigListEntry(_("End time"), self.timerentry_endtime, _("Set the time the timer must stop."))
		if self.timerentry_justplay.getValue() != "zap" or self.timerentry_showendtime.getValue():
			self.list.append(self.entryEndTime)

		self.channelEntry = getConfigListEntry(_("Channel"), self.timerentry_service, _("Set the channel for this timer."))
		self.list.append(self.channelEntry)

		self.dirname = getConfigListEntry(_("Location"), self.timerentry_dirname, _("Where should the recording be saved?"))
		self.tagsSet = getConfigListEntry(_("Tags"), self.timerentry_tagsset, _("Choose a tag for easy finding a recording."))
		if self.timerentry_justplay.getValue() != "zap":
			if config.usage.setup_level.index >= 2: # expert+
				self.list.append(self.dirname)
			if getPreferredTagEditor():
				self.list.append(self.tagsSet)
			self.list.append(getConfigListEntry(_("After event"), self.timerentry_afterevent, _("What action is required on complettion of the timer? 'Auto' lets the box return to the state it had when the timer started. 'Do nothing', 'Go to standby' and 'Go to deep standby' do ecaxtly that.")))
			self.list.append(getConfigListEntry(_("Recording type"), self.timerentry_recordingtype, _("Descramble & record ECM' gives the option to descramble afterwards if descrambling on recording failed. 'Don't descramble, record ECM' save a scramble recording that can be descrambled on playback. 'Normal' means descramble the recording and don't record ECM.")))

		self[widget].list = self.list
		self[widget].l.setList(self.list)

	def selectionChanged(self):
		if self["config"].getCurrent() and len(self["config"].getCurrent()) > 2 and self["config"].getCurrent()[2]:
			self["description"].setText(self["config"].getCurrent()[2])

	def layoutFinished(self):
		self.setTitle(_(self.setup_title))

	def createSummary(self):
		return SetupSummary

	# for summary:
	def changedEntry(self):
		for x in self.onChangedEntry:
			x()

	def getCurrentEntry(self):
		return self["config"].getCurrent() and self["config"].getCurrent()[0] or ""

	def getCurrentValue(self):
		return self["config"].getCurrent() and str(self["config"].getCurrent()[1].getText()) or ""

	def newConfig(self):
		if self["config"].getCurrent() in (self.timerTypeEntry, self.timerJustplayEntry, self.frequencyEntry, self.entryShowEndTime):
			self.createSetup("config")

	def keyLeft(self):
		if self["config"].getCurrent() in (self.channelEntry, self.tagsSet):
			self.keySelect()
		else:
			ConfigListScreen.keyLeft(self)
			self.newConfig()

	def keyRight(self):
		if self["config"].getCurrent() in (self.channelEntry, self.tagsSet):
			self.keySelect()
		else:
			ConfigListScreen.keyRight(self)
			self.newConfig()

	def keySelect(self):
		cur = self["config"].getCurrent()
		if cur == self.channelEntry:
			self.session.openWithCallback(
				self.finishedChannelSelection,
				ChannelSelection.SimpleChannelSelection,
				_("Select channel to record from")
			)
		elif config.usage.setup_level.index >= 2 and cur == self.dirname:
			self.session.openWithCallback(
				self.pathSelected,
				MovieLocationBox,
				_("Select target folder"),
				self.timerentry_dirname.getValue(),
				minFree = 100 # We require at least 100MB free space
			)
		elif getPreferredTagEditor() and cur == self.tagsSet:
			self.session.openWithCallback(
				self.tagEditFinished,
				getPreferredTagEditor(),
				self.timerentry_tags
			)
		else:
			self.keyGo()

	def finishedChannelSelection(self, *args):
		if args:
			self.timerentry_service_ref = ServiceReference(args[0])
			self.timerentry_service.setCurrentText(self.timerentry_service_ref.getServiceName())
			self["config"].invalidate(self.channelEntry)

	def getTimestamp(self, date, mytime):
		d = localtime(date)
		dt = datetime(d.tm_year, d.tm_mon, d.tm_mday, mytime[0], mytime[1])
		return int(mktime(dt.timetuple()))

	def getBeginEnd(self):
		date = self.timerentry_date.getValue()
		endtime = self.timerentry_endtime.getValue()
		starttime = self.timerentry_starttime.getValue()

		begin = self.getTimestamp(date, starttime)
		end = self.getTimestamp(date, endtime)

		# if the endtime is less than the starttime, add 1 day.
		if end < begin:
			end += 86400

		# if the timer type is a Zap and no end is set, set duration to 1 second so time is shown in EPG's.
		if self.timerentry_justplay.getValue() == "zap":
			if not self.timerentry_showendtime.getValue():
				end = begin + (config.recording.margin_before.getValue()*60) + 1

		return begin, end

	def selectChannelSelector(self, *args):
		self.session.openWithCallback(
				self.finishedChannelSelectionCorrection,
				ChannelSelection.SimpleChannelSelection,
				_("Select channel to record from")
			)

	def finishedChannelSelectionCorrection(self, *args):
		if args:
			self.finishedChannelSelection(*args)
			self.keyGo()

	def keyGo(self, result = None):
		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
		self.timer.name = self.timerentry_name.getValue()
		self.timer.description = self.timerentry_description.getValue()
		self.timer.justplay = self.timerentry_justplay.getValue() == "zap"
		self.timer.always_zap = self.timerentry_justplay.value == "zap+record"
		if self.timerentry_justplay.getValue() == "zap":
			if not self.timerentry_showendtime.getValue():
				self.timerentry_endtime.value = self.timerentry_starttime.getValue()
		self.timer.resetRepeated()
		self.timer.afterEvent = {
			"nothing": AFTEREVENT.NONE,
			"deepstandby": AFTEREVENT.DEEPSTANDBY,
			"standby": AFTEREVENT.STANDBY,
			"auto": AFTEREVENT.AUTO
			}[self.timerentry_afterevent.value]
		self.timer.descramble = {
			"normal": True,
			"descrambled+ecm": True,
			"scrambled+ecm": False,
			}[self.timerentry_recordingtype.value]
		self.timer.record_ecm = {
			"normal": False,
			"descrambled+ecm": True,
			"scrambled+ecm": True,
			}[self.timerentry_recordingtype.value]
		self.timer.service_ref = self.timerentry_service_ref
		self.timer.tags = self.timerentry_tags

		if self.timer.dirname or self.timerentry_dirname.getValue() != defaultMoviePath():
			self.timer.dirname = self.timerentry_dirname.getValue()
			config.movielist.last_timer_videodir.value = self.timer.dirname
			config.movielist.last_timer_videodir.save()

		if self.timerentry_type.getValue() == "once":
			self.timer.begin, self.timer.end = self.getBeginEnd()
		if self.timerentry_type.getValue() == "repeated":
			if self.timerentry_repeated.getValue() == "daily":
				for x in (0, 1, 2, 3, 4, 5, 6):
					self.timer.setRepeated(x)

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

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

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

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

			# when a timer end is set before the start, add 1 day
			if self.timer.end < self.timer.begin:
				self.timer.end += 86400

		if self.timer.eit is not None:
			event = eEPGCache.getInstance().lookupEventId(self.timer.service_ref.ref, self.timer.eit)
			if event:
				n = event.getNumOfLinkageServices()
				if n > 1:
					tlist = []
					ref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
					parent = self.timer.service_ref.ref
					selection = 0
					for x in range(n):
						i = event.getLinkageService(parent, x)
						if i.toString() == ref.toString():
							selection = x
						tlist.append((i.getName(), i))
					self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a subservice to record..."), list = tlist, selection = selection)
					return
				elif n > 0:
					parent = self.timer.service_ref.ref
					self.timer.service_ref = ServiceReference(event.getLinkageService(parent, 0))
		self.saveTimer()
		self.close((True, self.timer))

	def changeTimerType(self):
		self.timerentry_justplay.selectNext()
		self.timerJustplayEntry = getConfigListEntry(_("Timer type"), self.timerentry_justplay)
		self["config"].invalidate(self.timerJustplayEntry)

	def incrementStart(self):
		self.timerentry_starttime.increment()
		self["config"].invalidate(self.entryStartTime)
		if self.timerentry_type.value == "once" and self.timerentry_starttime.value == [0, 0]:
			self.timerentry_date.value += 86400
			self["config"].invalidate(self.entryDate)

	def decrementStart(self):
		self.timerentry_starttime.decrement()
		self["config"].invalidate(self.entryStartTime)
		if self.timerentry_type.value == "once" and self.timerentry_starttime.value == [23, 59]:
			self.timerentry_date.value -= 86400
			self["config"].invalidate(self.entryDate)

	def incrementEnd(self):
		if self.entryEndTime is not None:
			self.timerentry_endtime.increment()
			self["config"].invalidate(self.entryEndTime)

	def decrementEnd(self):
		if self.entryEndTime is not None:
			self.timerentry_endtime.decrement()
			self["config"].invalidate(self.entryEndTime)

	def subserviceSelected(self, service):
		if not service is None:
			self.timer.service_ref = ServiceReference(service[1])
		self.saveTimer()
		self.close((True, self.timer))

	def saveTimer(self):
		self.session.nav.RecordTimer.saveTimer()

	def keyCancel(self):
		self.close((False,))

	def pathSelected(self, res):
		if res is not None:
			if config.movielist.videodirs.getValue() != self.timerentry_dirname.choices:
				self.timerentry_dirname.setChoices(config.movielist.videodirs.getValue(), default=res)
			self.timerentry_dirname.value = res

	def tagEditFinished(self, ret):
		if ret is not None:
			self.timerentry_tags = ret
			self.timerentry_tagsset.setChoices([not ret and "None" or " ".join(ret)])
			self["config"].invalidate(self.tagsSet)
Example #34
0
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, ConfigText, ConfigYesNo, KEY_LEFT, KEY_RIGHT, getConfigListEntry
import skin


def getScale():
    return AVSwitch().getFramebufferScale()


config.pic = ConfigSubsection()
config.pic.framesize = ConfigInteger(default=30, limits=(0, 99))
config.pic.slidetime = ConfigInteger(default=10, limits=(1, 99))
config.pic.resize = ConfigSelection(default="1",
                                    choices=[("0", _("simple")),
                                             ("1", _("better"))])
config.pic.cache = ConfigYesNo(default=True)
config.pic.lastDir = ConfigText(default=resolveFilename(SCOPE_MEDIA))
config.pic.infoline = ConfigYesNo(default=True)
config.pic.loop = ConfigYesNo(default=True)
config.pic.bgcolor = ConfigSelection(default="#00000000",
                                     choices=[("#00000000", _("black")),
                                              ("#009eb9ff", _("blue")),
                                              ("#00ff5a51", _("red")),
                                              ("#00ffe875", _("yellow")),
                                              ("#0038FF48", _("green"))])
config.pic.autoOrientation = ConfigYesNo(default=False)
config.pic.textcolor = ConfigSelection(default="#0038FF48",
                                       choices=[("#00000000", _("black")),
                                                ("#009eb9ff", _("blue")),
                                                ("#00ff5a51", _("red")),
                                                ("#00ffe875", _("yellow")),
                                                ("#0038FF48", _("green"))])
class MovieRetitle(Screen, ConfigListScreen):
	def __init__(self, session, services):
		Screen.__init__(self, session)

		self.skinName = ["MovieRetitle", "Setup"]
		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session)

		self["Path"] = Label(_("Location:"))# + ' ' + os.path.dirname(os.path.splitext(path)[0]))
		self["HelpWindow"] = Pixmap()
		self.onLayoutFinish.append(self.setCustomTitle)

		self["key_green"] = StaticText(_("Save"))
		self["key_red"] = StaticText(_("Cancel"))
		self["actions"] = ActionMap(["SetupActions"],
		{
			"ok": self.keyGo,
			"save": self.keyGo,
			"cancel": self.keyCancel,
		}, -2)

		self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"],
		{
			"showVirtualKeyboard": self.KeyText,
		}, -2)
		self["VirtualKB"].setEnabled(False)
		self["HelpWindow"] = Pixmap()
		self["VKeyIcon"] = Pixmap()
		self["VKeyIcon"].hide()

		self.serviceHandler = ServiceCenter.getInstance()

		if isinstance(services, list):
			self.services = services
		else:
			self.services = [services]

		self.buildSetup(self.services.pop())

	def buildSetup(self, service):
		self.service = service
		self.is_dir = service.flags & eServiceReference.mustDescent
		info = self.serviceHandler.info(service)
		path = service.getPath()
		self["Path"] = Label(_("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0]))
		if self.is_dir:
			self.original_file = service.getName()
		else:
			self.original_file = os.path.basename(os.path.splitext(path)[0])
		self.original_name = info.getName(service)
		self.original_desc = info.getInfoString(service, iServiceInformation.sDescription)
		self.input_file = ConfigText(default=self.original_file, fixed_size=False, visible_width=82)
		self.input_title = ConfigText(default=self.original_name, fixed_size=False, visible_width=82)
		self.input_descr = ConfigText(default=self.original_desc, fixed_size=False, visible_width=82)
		self.createSetup()

	def createSetup(self):
		self.list = []
		if self.is_dir:
			self.list.append(getConfigListEntry(_("Foldername:"), self.input_file))
		else:
			self.list.append(getConfigListEntry(_("Filename:"), self.input_file))
			self.list.append(getConfigListEntry(_("Movietitle:"), self.input_title))
			self.list.append(getConfigListEntry(_("Description:"), self.input_descr))
		self["config"].setList(self.list)

	def handleInputHelpers(self):
		return
		if self["config"].getCurrent() is not None:
			if isinstance(self["config"].getCurrent()[1], ConfigText) or isinstance(self["config"].getCurrent()[1], ConfigPassword):
				if self.has_key("VKeyIcon"):
					self["VirtualKB"].setEnabled(True)
					self["VKeyIcon"].boolean = True
				if self.has_key("HelpWindow"):
					if self["config"].getCurrent()[1].help_window.instance is not None:
						helpwindowpos = self["HelpWindow"].getPosition()

						if helpwindowpos:
							helpwindowposx, helpwindowposy = helpwindowpos
							if helpwindowposx and helpwindowposy:
								from enigma import ePoint
								self["config"].getCurrent()[1].help_window.instance.move(ePoint(helpwindowposx,helpwindowposy))
			else:
				if self.has_key("VKeyIcon"):
					self["VirtualKB"].setEnabled(False)
					self["VKeyIcon"].boolean = False
		else:
			if self.has_key("VKeyIcon"):
				self["VirtualKB"].setEnabled(False)
				self["VKeyIcon"].boolean = False

	def setCustomTitle(self):
		if self.is_dir:
			self.setTitle(_("Change Foldername"))
		else:
			self.setTitle(_("Change File/Moviename and/or Description"))

	def keyGo(self):
		if self.is_dir:
			if self.input_file.getText() != self.original_file:
				self.renameDirectory(self.service, self.input_file.getText())
				self.original_file = self.input_file.getText()
		else:
			if self.input_title.getText() != self.original_name or self.input_descr.getText() != self.original_desc:
				self.setTitleDescr(self.service, self.input_title.getText(), self.input_descr.getText())
				self.original_name = self.input_title.getText()
				self.original_desc = self.input_descr.getText()
			if self.input_file.getText() != self.original_file:
				self.renameFile(self.service, self.input_file.getText())
				self.original_file = self.input_file.getText()
		if self.services:
			service = self.services.pop()
			self.buildSetup(service)
		else:
			self.close()

	def keyCancel(self):
		self.close()

	def setTitleDescr(self, service, title, descr):
		#TODO Use MetaSupport class
		if service.getPath().endswith(".ts"):
			meta_file = service.getPath() + ".meta"
		else:
			meta_file = service.getPath() + ".ts.meta"

		# Create new meta for ts files
		if not os.path.exists(meta_file):
			if os.path.isfile(service.getPath()):
				_title = os.path.basename(os.path.splitext(service.getPath())[0])
			else:
				_title = service.getName()
			_sid = ""
			_descr = ""
			_time = ""
			_tags = ""
			metafile = open(meta_file, "w")
			metafile.write("%s\n%s\n%s\n%s\n%s" % (_sid, _title, _descr, _time, _tags))
			metafile.close()

		if os.path.exists(meta_file):
			metafile = open(meta_file, "r")
			sid = metafile.readline()
			oldtitle = metafile.readline().rstrip()
			olddescr = metafile.readline().rstrip()
			rest = metafile.read()
			metafile.close()
			if not title and title != "":
				title = oldtitle
			if not descr and descr != "":
				descr = olddescr
			metafile = open(meta_file, "w")
			metafile.write("%s%s\n%s\n%s" % (sid, title, descr, rest))
			metafile.close()

	def renameDirectory(self, service, new_name):
		try:
			dir = os.path.dirname(self.service.getPath()[0:-1])
			os.rename(self.service.getPath(), os.path.join(dir, self.input_file.getText() + "/"))
			self.original_file = self.input_file.getText()
		except Exception, e:
			print e
Example #36
0
from Plugins.Extensions.IPTVPlayer.libs.e2ijson import loads as json_loads, dumps as json_dumps
###################################################

###################################################
# FOREIGN import
###################################################
import time
import urllib
from datetime import datetime, timedelta
from Components.config import config, ConfigText, getConfigListEntry
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.eurosportplayer_login    = ConfigText(default = "", fixed_size = False)
config.plugins.iptvplayer.eurosportplayer_password = ConfigText(default = "", fixed_size = False)

def GetConfigList():
    optionList = []
    optionList.append(getConfigListEntry(_("e-mail")+":",    config.plugins.iptvplayer.eurosportplayer_login))
    optionList.append(getConfigListEntry(_("password")+":", config.plugins.iptvplayer.eurosportplayer_password))
    return optionList
###################################################
def gettytul():
    return 'https://www.eurosportplayer.com/'

class EuroSportPlayer(CBaseHostClass):
    
    def __init__(self):
        CBaseHostClass.__init__(self, {'history':'eurosportplayer.com', 'cookie':'eurosportplayer.com.cookie'})
Example #37
0
from . import _
from Components.config import config, ConfigSubsection, ConfigText, ConfigYesNo
from Plugins.Plugin import PluginDescriptor
from HddMount import MountHddOnStart

config.plugins.HddMount = ConfigSubsection()
config.plugins.HddMount.MountOnStart = ConfigYesNo(default=True)
config.plugins.HddMount.MountOnHdd = ConfigText(default="nothing")
config.plugins.HddMount.MountOnMovie = ConfigText(default="nothing")
config.plugins.HddMount.SwapOnStart = ConfigYesNo(default=False)
config.plugins.HddMount.SwapFile = ConfigText(default="no")


def main(session, **kwargs):
    from Manager import MountSetup
    session.open(MountSetup)


EnigmaStart = False


def OnStart(reason, **kwargs):
    global EnigmaStart
    if reason == 0 and EnigmaStart == False:
        EnigmaStart = True
        enableswap = False
        if config.plugins.HddMount.SwapOnStart.value:
            SwapFile = config.plugins.HddMount.SwapFile.value
            if SwapFile != "no":
                if SwapFile[:2] == "sd":
                    from Components.Console import Console
Example #38
0
# currently, loadSingleSkinData (colors, bordersets etc.)
# are applied one-after-each, in order of ascending priority.
# the dom_skin will keep all screens in descending priority,
# so the first screen found will be used.

# example: loadSkin("nemesis_greenline/skin.xml")
config.skin = ConfigSubsection()
DEFAULT_SKIN = "GigabluePax/skin.xml"
if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)):
    DEFAULT_SKIN = "om-black/skin.xml"
if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)):
    DEFAULT_SKIN = "adriatic32_turquoise/skin.xml"
if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)):
    DEFAULT_SKIN = "Vali.HD.flex.MOD.wolv007/skin.xml"
config.skin.primary_skin = ConfigText(default=DEFAULT_SKIN)

profile("LoadSkin")
try:
    name = skin_user_skinname()
    if name is not None:
        addSkin(name, SCOPE_CONFIG)
    else:
        addSkin('skin_user.xml', SCOPE_CONFIG)
except (SkinError, IOError, AssertionError), err:
    print "not loading user skin: ", err

# some boxes lie about their dimensions
addSkin('skin_box.xml')
# add optional discrete second infobar
addSkin('skin_second_infobar.xml')
Example #39
0
from Components.Label import Label
from Components.Sources.List import List
from Components.Pixmap import Pixmap
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.Console import Console
from os import system, listdir, rename, symlink, unlink, path, mkdir
from time import sleep

config.esipanel = ConfigSubsection()
config.esipanel.cronmanager_commandtype = NoSave(
    ConfigSelection(choices=[('custom',
                              _("Custom")), ('predefined', _("Predefined"))]))
config.esipanel.cronmanager_cmdtime = NoSave(ConfigClock(default=0))
config.esipanel.cronmanager_cmdtime.value, mytmpt = ([0, 0], [0, 0])
config.esipanel.cronmanager_user_command = NoSave(ConfigText(fixed_size=False))
config.esipanel.cronmanager_runwhen = NoSave(
    ConfigSelection(default='Daily',
                    choices=[('Hourly', _("Hourly")), ('Daily', _("Daily")),
                             ('Weekly', _("Weekly")),
                             ('Monthly', _("Monthly"))]))
config.esipanel.cronmanager_dayofweek = NoSave(
    ConfigSelection(default='Monday',
                    choices=[('Monday', _("Monday")),
                             ('Tuesday', _("Tuesday")),
                             ('Wednesday', _("Wednesday")),
                             ('Thursday', _("Thursday")),
                             ('Friday', _("Friday")),
                             ('Saturday', _("Saturday")),
                             ('Sunday', _("Sunday"))]))
config.esipanel.cronmanager_dayofmonth = NoSave(
Example #40
0
	def __init__(self):
		ConfigText.__init__(self, default = "", fixed_size = True, visible_width = False)
Example #41
0
from Plugins.Extensions.IPTVPlayer.components.asynccall import MainSessionWrapper
from Screens.MessageBox import MessageBox
###############################################################################

###################################################
# FOREIGN import
###################################################
import re
from Components.config import config, ConfigYesNo, ConfigText, getConfigListEntry
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.diffanime_premium = ConfigYesNo(default=False)
config.plugins.iptvplayer.diffanime_login = ConfigText(default="",
                                                       fixed_size=False)
config.plugins.iptvplayer.diffanime_password = ConfigText(default="",
                                                          fixed_size=False)


def GetConfigList():
    optionList = []

    optionList.append(
        getConfigListEntry("Użytkownik Diffanime",
                           config.plugins.iptvplayer.diffanime_premium))
    if config.plugins.iptvplayer.diffanime_premium.value:
        optionList.append(
            getConfigListEntry("  Diffanime login:",
                               config.plugins.iptvplayer.diffanime_login))
        optionList.append(
Example #42
0
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_LANGUAGE, SCOPE_PLUGINS
import os, gettext

currentmcversion = "099"
currentmcplatform = "sh4"

config.plugins.mc_favorites = ConfigSubsection()
config.plugins.mc_favorites.foldercount = ConfigInteger(0)
config.plugins.mc_favorites.folders = ConfigSubList()

config.plugins.mc_globalsettings = ConfigSubsection()
config.plugins.mc_globalsettings.showinmainmenu = ConfigYesNo(default=False)
config.plugins.mc_globalsettings.showinextmenu = ConfigYesNo(default=False)
config.plugins.mc_globalsettings.currentversion = ConfigInteger(0, (0, 999))
config.plugins.mc_globalsettings.currentplatform = ConfigText(default = currentmcplatform)

config.plugins.mc_globalsettings.currentversion.value = currentmcversion
config.plugins.mc_globalsettings.currentplatform.value = currentmcplatform

PluginLanguageDomain = "OPenNFR-MediaCenter"
PluginLanguagePath = "Extensions/BMediaCenter/locale"
# Load Language
def localeInit():
	lang = language.getLanguage()[:2] 
	os.environ["LANGUAGE"] = lang
	gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
def _(txt):
	t = gettext.dgettext(PluginLanguageDomain, txt)
	if t == txt:
		t = gettext.gettext(txt)
Example #43
0
 def getValue(self):
     return ConfigText.getValue(self)
Example #44
0
class AdvancedCutInput(Screen, ConfigListScreen):
    def __init__(self, session, name, path, descr):
        Screen.__init__(self, session)
        self.skinName = ["AdvancedCutInput", "Setup"]

        self["key_green"] = StaticText(_("OK"))
        self["key_red"] = StaticText(_("Cancel"))

        if self.baseName(path) == self.baseName(name):
            title = ""
        else:
            title = name
        dir = self.dirName(path)
        file = self.baseName(path) + " cut"
        self.input_replace = ConfigSelection(choices=[("no", _("No")),
                                                      ("yes", _("Yes"))],
                                             default="no")
        self.input_file = ConfigText(default=file,
                                     fixed_size=False,
                                     visible_width=45)
        self.input_title = ConfigText(default=title,
                                      fixed_size=False,
                                      visible_width=45)
        self.input_descr = ConfigText(default=descr,
                                      fixed_size=False,
                                      visible_width=45)
        tmp = config.movielist.videodirs.value
        if not dir in tmp:
            tmp.append(dir)
        self.input_dir = ConfigSelection(choices=tmp, default=dir)
        self.input_manual = ConfigSelection(choices=[
            ("no", _("Cutlist")), ("yes", _("Manual specification"))
        ],
                                            default="no")
        self.input_space = ConfigNothing()
        self.input_manualcuts = ConfigText(default="", fixed_size=False)
        self.input_manualcuts.setUseableChars(" 0123456789:.")

        self["actions"] = ActionMap(
            ["SetupActions"], {
                "ok": self.keySelectOrGo,
                "save": self.keyGo,
                "cancel": self.keyCancel,
            }, -2)

        self.list = []
        ConfigListScreen.__init__(self, self.list)
        self.entry_replace = getConfigListEntry(_("Replace original:"),
                                                self.input_replace)
        self.entry_file = getConfigListEntry(_("New filename:"),
                                             self.input_file)
        self.entry_title = getConfigListEntry(_("New title:"),
                                              self.input_title)
        self.entry_descr = getConfigListEntry(_("New description:"),
                                              self.input_descr)
        self.entry_dir = getConfigListEntry(_("New location:"), self.input_dir)
        self.entry_manual = getConfigListEntry(_("Cut source:"),
                                               self.input_manual)
        self.entry_space = getConfigListEntry(
            _("Cuts (an IN OUT IN OUT ... sequence of hour:min:sec)"),
            self.input_space)
        self.entry_manualcuts = getConfigListEntry(":", self.input_manualcuts)
        self.createSetup(self["config"])

        self.onLayoutFinish.append(self.layoutFinished)

    def layoutFinished(self):
        self.setTitle(_("Cut Parameter Input"))

    def createSetup(self, configlist):
        list = [self.entry_replace]
        if self.input_replace.value == "no":
            list.extend((
                self.entry_file,
                self.entry_dir,
            ))
        list.extend((
            self.entry_title,
            self.entry_descr,
            self.entry_manual,
        ))
        if self.input_manual.value == "yes":
            list.extend((
                self.entry_space,
                self.entry_manualcuts,
            ))
        self.list = list
        configlist.list = list
        configlist.l.setList(list)

    def keyLeft(self):
        ConfigListScreen.keyLeft(self)
        cc = self["config"].getCurrent()
        if cc is self.entry_replace or cc is self.entry_manual:
            self.createSetup(self["config"])

    def keyRight(self):
        ConfigListScreen.keyRight(self)
        cc = self["config"].getCurrent()
        if cc is self.entry_replace or cc is self.entry_manual:
            self.createSetup(self["config"])

    def pathSelected(self, res):
        if res is not None:
            if config.movielist.videodirs.value != self.input_dir.choices:
                self.input_dir.setChoices(config.movielist.videodirs.value,
                                          default=res)
            self.input_dir.value = res

    def keySelectOrGo(self):
        if self["config"].getCurrent() == self.entry_dir:
            self.session.openWithCallback(
                self.pathSelected,
                MovieLocationBox,
                _("Choose target folder"),
                self.input_dir.value,
            )
        else:
            self.keyGo()

    def keyGo(self):
        if self.input_replace.value == "yes":
            path = False
        else:
            path = self.rejoinName(self.input_dir.value, self.input_file.value)
        if self.input_manual.value == "no":
            cuts = False
        else:
            cuts = self.input_manualcuts.value.split(' ')
            while "" in cuts:
                cuts.remove("")
        self.close((True, self.input_replace.value == "yes", path,
                    self.input_title.value, self.input_descr.value, cuts))

    def keyCancel(self):
        self.close((False, ))

    def baseName(self, str):
        name = str.split('/')[-1]
        if name.endswith(".ts") is True:
            return name[:-3]
        else:
            return name

    def dirName(self, str):
        return '/'.join(str.split('/')[:-1]) + '/'

    def rejoinName(self, dir, name):
        name = name.strip()
        if name.endswith(".ts") is True:
            return dir + name[:-3]
        else:
            return dir + name
Example #45
0
 def getMulti(self, selected):
     return ConfigText.getMulti(self, selected)
Example #46
0
config.pluginfilter = ConfigSubsection()
config.pluginfilter.kernel = ConfigYesNo(default=False)
config.pluginfilter.drivers = ConfigYesNo(default=True)
config.pluginfilter.extensions = ConfigYesNo(default=True)
config.pluginfilter.m2k = ConfigYesNo(default=True)
config.pluginfilter.picons = ConfigYesNo(default=True)
config.pluginfilter.pli = ConfigYesNo(default=False)
config.pluginfilter.security = ConfigYesNo(default=True)
config.pluginfilter.settings = ConfigYesNo(default=True)
config.pluginfilter.skins = ConfigYesNo(default=True)
config.pluginfilter.display = ConfigYesNo(default=True)
config.pluginfilter.softcams = ConfigYesNo(default=True)
config.pluginfilter.systemplugins = ConfigYesNo(default=True)
config.pluginfilter.vix = ConfigYesNo(default=False)
config.pluginfilter.weblinks = ConfigYesNo(default=True)
config.pluginfilter.userfeed = ConfigText(default='http://', fixed_size=False)


def languageChanged():
    plugins.clearPluginList()
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))


def Check_Softcam():
    found = False
    for x in os.listdir('/etc'):
        if x.find('.emu') > -1:
            found = True
            break
    return found
	def onSelect(self, session):
		ConfigText.onSelect(self, session)
		self.getSuggestions()
Example #48
0
from Components.config import config, configfile, ConfigInteger, ConfigSubsection, ConfigText, ConfigYesNo, getConfigListEntry, ConfigIP
from enigma import eServiceCenter, eServiceReference, eDVBDB
from ServiceReference import ServiceReference
from twisted.internet import reactor
from twisted.internet.protocol import ClientCreator
from twisted.protocols.ftp import FTPClient
from urllib import quote

from FTPDownloader import FTPDownloader

DIR_ENIGMA2 = '/etc/enigma2/'
DIR_TMP = '/tmp/'
RCSC_PREFIX = 'userbouquet.rcsc.'

config.plugins.RemoteStreamConverter = ConfigSubsection()
config.plugins.RemoteStreamConverter.address = ConfigText(default="",
                                                          fixed_size=False)
config.plugins.RemoteStreamConverter.ip = ConfigIP(default=[0, 0, 0, 0])
config.plugins.RemoteStreamConverter.username = ConfigText(default="root",
                                                           fixed_size=False)
config.plugins.RemoteStreamConverter.password = ConfigText(default="",
                                                           fixed_size=False)
config.plugins.RemoteStreamConverter.port = ConfigInteger(21, (0, 65535))
config.plugins.RemoteStreamConverter.passive = ConfigYesNo(False)
config.plugins.RemoteStreamConverter.telnetport = ConfigInteger(23, (0, 65535))


class ServerEditor(ConfigListScreen, Screen):
    skin = """
		<screen position="center,center" size="560,230" >
			<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" transparent="1" alphatest="on" />
			<ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" transparent="1" alphatest="on" />
class AdvancedKeyBoard(VirtualKeyBoard, NumericalTextInput, SkinResolutionHelper):
    KEYBOARD = 0x01
    NUM_KEYB = 0x02
    BOTH = KEYBOARD | NUM_KEYB

    def __init__(self, session, title="", text=""):
        VirtualKeyBoard.__init__(self, session, title, text)
        NumericalTextInput.__init__(self, nextFunc=self.nextFunc)
        SkinResolutionHelper.__init__(self)
        self.configText = None
        if config.AdvancedMovieSelection.keyboard.value == "virtual":
            use = self.KEYBOARD
        elif config.AdvancedMovieSelection.keyboard.value == "numerical":
            use = self.NUM_KEYB
        else:
            use = self.BOTH
        if not use & self.KEYBOARD:
            # hide the keyboard
            self["list"].hide()
            # overwrite VirtualKeyBoard actions
            # make sure not overwrite any action of base class
            self["actions"] = ActionMap(
                [
                    "OkCancelActions",
                    "WizardActions",
                    "ColorActions",
                    "KeyboardInputActions",
                    "InputBoxActions",
                    "InputAsciiActions",
                ],
                {
                    "ok": self.__ok,
                    "cancel": self.__cancel,
                    "left": self.dummy,
                    "right": self.dummy,
                    "up": self.dummy,
                    "down": self.dummy,
                    "red": self.__cancel,
                    "green": self.__ok,
                    "yellow": self.dummy,
                    "deleteBackward": self.dummy,
                    "back": self.dummy,
                },
                -2,
            )

        if use & self.NUM_KEYB:
            self.timer = eTimer()
            self.timer.callback.append(self.timeout)
            self.configText = ConfigText("", False)
            if text:
                self.configText.text = text
                self.configText.marked_pos = len(text)
            self["config_actions"] = NumberActionMap(
                ["SetupActions", "InputAsciiActions", "KeyboardInputActions"],
                {
                    "1": self.keyNumberGlobal,
                    "2": self.keyNumberGlobal,
                    "3": self.keyNumberGlobal,
                    "4": self.keyNumberGlobal,
                    "5": self.keyNumberGlobal,
                    "6": self.keyNumberGlobal,
                    "7": self.keyNumberGlobal,
                    "8": self.keyNumberGlobal,
                    "9": self.keyNumberGlobal,
                    "0": self.keyNumberGlobal,
                },
                -1,
            )  # to prevent left/right overriding the listbox
            if use & self.KEYBOARD:
                self.selectedKey = self.getKeyIndex(u"OK")

        self.onLayoutFinish.append(self.__onLayoutFinish)
        self.onClose.append(self.__onClose)

    def __onLayoutFinish(self):
        self.setTitle(_("Advanced Movie Selection - Input help"))
        if self.configText:
            self.configText.help_window = self.session.instantiateDialog(AdvancedTextInputHelpDialog, self)
            self.configText.help_window.show()

    def __onClose(self):
        if self.configText and self.configText.help_window:
            self.session.deleteDialog(self.configText.help_window)
            self.configText.help_window = None

    def getKeyIndex(self, key):
        index = 0
        for x in self.keys_list:
            for k in x:
                if k == key:
                    return index
                index += 1
        return index

    def buildVirtualKeyBoard(self, selectedKey=0):
        VirtualKeyBoard.buildVirtualKeyBoard(self, selectedKey=self.selectedKey)

    def dummy(self):
        pass

    def __ok(self):
        self.close(self["text"].getText())

    def __cancel(self):
        self.close(None)

    def timeout(self):
        self.handleKey(KEY_TIMEOUT)
        self["text"].setMarkedPos(-1)

    def handleKey(self, key):
        if self.configText:
            self.configText.handleKey(key)
            if key in KEY_NUMBERS:
                self.timer.start(1000, 1)

    def keyNumberGlobal(self, number):
        self.handleKey(KEY_0 + number)
        self.getKey(number)
        self.text = self.configText.getText()
        self["text"].setText(self.configText.getText())
        self["text"].setMarkedPos(self.configText.marked_pos)

    def okClicked(self):
        VirtualKeyBoard.okClicked(self)
        self["text"].setMarkedPos(-1)
        if self.configText:
            self.configText.text = self.text
            self.configText.marked_pos = len(self.text)

    def nextFunc(self):
        self["text"].setMarkedPos(-1)
Example #50
0
SIB_TOGGLE_SHOW = InfoBar.toggleShow
SIB_SWOFF = InfoBar.hide
SIB_STATE = -1

config.plugins.Widgets = ConfigSubsection()
config.plugins.Widgets.show_empty_positions = ConfigBoolean(default=True,
                                                            descriptions={
                                                                False:
                                                                _("hide"),
                                                                True: _("show")
                                                            })
config.plugins.Widgets.active_widgets = ConfigSubDict()
for x in range(0, 16):
    for y in range(0, 16):
        config.plugins.Widgets.active_widgets["w%i_%i" %
                                              (x, y)] = ConfigText("")


def Plugins(**kwargs):
    return [
        PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART,
                         fnc=SIBautostart)
    ]


class ReplaceInfoBar():
    def __init__(self):
        pass

    @cached
    def Replace(self):
Example #51
0
	def createConfig(self):
		justplay = self.timer.justplay
		always_zap = self.timer.always_zap

		afterevent = {
			AFTEREVENT.NONE: "nothing",
			AFTEREVENT.DEEPSTANDBY: "deepstandby",
			AFTEREVENT.STANDBY: "standby",
			AFTEREVENT.AUTO: "auto"
			}[self.timer.afterEvent]

		if self.timer.record_ecm and self.timer.descramble:
			recordingtype = "descrambled+ecm"
		elif self.timer.record_ecm:
			recordingtype = "scrambled+ecm"
		elif self.timer.descramble:
			recordingtype = "normal"

		weekday_table = ("mon", "tue", "wed", "thu", "fri", "sat", "sun")

		# calculate default values
		day = []
		weekday = 0
		for x in (0, 1, 2, 3, 4, 5, 6):
			day.append(0)
		if self.timer.repeated: # repeated
			type = "repeated"
			if self.timer.repeated == 31: # Mon-Fri
				repeated = "weekdays"
			elif self.timer.repeated == 127: # daily
				repeated = "daily"
			else:
				flags = self.timer.repeated
				repeated = "user"
				count = 0
				for x in (0, 1, 2, 3, 4, 5, 6):
					if flags == 1: # weekly
# 							print "Set to weekday " + str(x)
						weekday = x
					if flags & 1 == 1: # set user defined flags
						day[x] = 1
						count += 1
					else:
						day[x] = 0
					flags >>= 1
				if count == 1:
					repeated = "weekly"
		else: # once
			type = "once"
			repeated = None
			weekday = int(strftime("%u", localtime(self.timer.begin))) - 1
			day[weekday] = 1

		self.timerentry_justplay = ConfigSelection(choices = [
			("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))],
			default = {0: "record", 1: "zap", 2: "zap+record"}[justplay + 2*always_zap])
		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_recordingtype = ConfigSelection(choices = [("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm"))], default = recordingtype)
		self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type)
		self.timerentry_name = ConfigText(default = self.timer.name.replace('\xc2\x86', '').replace('\xc2\x87', '').encode("utf-8"), visible_width = 50, fixed_size = False)
		self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False)
		self.timerentry_tags = self.timer.tags[:]
		self.timerentry_tagsset = ConfigSelection(choices = [not self.timerentry_tags and "None" or " ".join(self.timerentry_tags)])

		self.timerentry_repeated = ConfigSelection(default = repeated, choices = [("weekly", _("weekly")), ("daily", _("daily")), ("weekdays", _("Mon-Fri")), ("user", _("user defined"))])

		self.timerentry_date = ConfigDateTime(default = self.timer.begin, formatstring = _("%d.%B %Y"), increment = 86400)
		self.timerentry_starttime = ConfigClock(default = self.timer.begin)
		self.timerentry_endtime = ConfigClock(default = self.timer.end)
		self.timerentry_showendtime = ConfigSelection(default = ((self.timer.end - self.timer.begin) > 4), choices = [(True, _("yes")), (False, _("no"))])

		default = self.timer.dirname or defaultMoviePath()
		tmp = config.movielist.videodirs.getValue()
		if default not in tmp:
			tmp.append(default)
		self.timerentry_dirname = ConfigSelection(default = default, choices = tmp)

		self.timerentry_repeatedbegindate = ConfigDateTime(default = self.timer.repeatedbegindate, formatstring = _("%d.%B %Y"), increment = 86400)

		self.timerentry_weekday = ConfigSelection(default = weekday_table[weekday], choices = [("mon",_("Monday")), ("tue", _("Tuesday")), ("wed",_("Wednesday")), ("thu", _("Thursday")), ("fri", _("Friday")), ("sat", _("Saturday")), ("sun", _("Sunday"))])

		self.timerentry_day = ConfigSubList()
		for x in (0, 1, 2, 3, 4, 5, 6):
			self.timerentry_day.append(ConfigYesNo(default = day[x]))

		# FIXME some service-chooser needed here
		servicename = "N/A"
		try: # no current service available?
			servicename = str(self.timer.service_ref.getServiceName())
		except:
			pass
		self.timerentry_service_ref = self.timer.service_ref
		self.timerentry_service = ConfigSelection([servicename])
    import json
except Exception:
    import simplejson as json
from Components.config import config, ConfigSelection, ConfigYesNo, ConfigText, getConfigListEntry
###################################################

###################################################
# E2 GUI COMMPONENTS
###################################################
from Plugins.Extensions.IPTVPlayer.icomponents.asynccall import MainSessionWrapper
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.api_key_9kweu = ConfigText(default="",
                                                     fixed_size=False)
config.plugins.iptvplayer.api_key_2captcha = ConfigText(default="",
                                                        fixed_size=False)
config.plugins.iptvplayer.bsto_linkcache = ConfigYesNo(default=True)
config.plugins.iptvplayer.bsto_bypassrecaptcha = ConfigSelection(
    default="None",
    choices=[("None", _("None")), ("9kw.eu", "https://9kw.eu/"),
             ("2captcha.com", "http://2captcha.com/")])


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry(_("Use links cache"),
                           config.plugins.iptvplayer.bsto_linkcache))
    optionList.append(
Example #53
0
class ModemSetup(Screen):
	skin = """
		<screen position="180,100" size="320,300" title="Modem" >
		<ePixmap pixmap="buttons/green.png" position="10,10" size="140,40" alphatest="on" />
		<ePixmap pixmap="buttons/red.png" position="160,10" size="140,40" alphatest="on" />
		<widget name="key_green" position="10,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
		<widget name="key_red" position="160,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
		<widget name="list" position="10,60" size="300,120" />
		<widget name="state" position="10,210" size="300,80" font="Regular;20" />
		</screen>"""

	def nothing(self):
		print "nothing!"

	def __init__(self, session, args = None):
		global connected
		global conn
		self.skin = ModemSetup.skin
		secret = getSecretString()
		user = secret[:secret.find('*')]
		password = secret[secret.find('*')+1:]
		self.username = ConfigText(user, fixed_size=False)
		self.password = ConfigPassword(password, fixed_size=False)
		self.phone = ConfigText(getTelephone(), fixed_size=False)
		self.phone.setUseableChars(u"0123456789")
		lst = [ (_("Username"), self.username),
			(_("Password"), self.password),
			(_("Phone number"), self.phone) ]
		self["list"] = ConfigList(lst)
		self["key_green"] = Button("")
		self["key_red"] = Button("")
		self["state"] = Label("")
		self["actions"] = NumberActionMap(["ModemActions"],
		{
			"cancel": self.close,
			"left": self.keyLeft,
			"right": self.keyRight,
			"connect": self.connect,
			"disconnect": self.disconnect,
			"deleteForward": self.deleteForward,
			"deleteBackward": self.deleteBackward,
			"0": self.keyNumber,
			"1": self.keyNumber,
			"2": self.keyNumber,
			"3": self.keyNumber,
			"4": self.keyNumber,
			"5": self.keyNumber,
			"6": self.keyNumber,
			"7": self.keyNumber,
			"8": self.keyNumber,
			"9": self.keyNumber
		}, -1)

		self["ListActions"] = ActionMap(["ListboxDisableActions"],
		{
			"moveUp": self.nothing,
			"moveDown": self.nothing,
			"moveTop": self.nothing,
			"moveEnd": self.nothing,
			"pageUp": self.nothing,
			"pageDown": self.nothing
		}, -1)

		self.stateTimer = eTimer()
		self.stateTimer.callback.append(self.stateLoop)

		conn.appClosed.append(self.pppdClosed)
		conn.dataAvail.append(self.dataAvail)

		Screen.__init__(self, session)
		self.onClose.append(self.__closed)
		self.onLayoutFinish.append(self.__layoutFinished)

	def __layoutFinished(self):
		global conn
		if conn.running():
			self["state"].setText(_("Connected!"))
			self.green_function = NONE
			self.red_function = DISCONNECT
		else:
			self.green_function = CONNECT
			self.red_function = NONE
		self.updateGui()

	def __closed(self):
		global connected
		conn.appClosed.remove(self.pppdClosed)
		conn.dataAvail.remove(self.dataAvail)
		if not connected:
			conn.sendCtrlC()
		setOptions(self.phone.getText(), self.username.getText())
		setSecretString(self.username.getText() + ' * ' + self.password.getText())

	def stateLoop(self):
		txt = self["state"].getText()
		txt += '.'
		self["state"].setText(txt)

	def connect(self):
		if self.green_function == CONNECT:
			global gateway
			gateway = getDefaultGateway()
			self["state"].setText(_("Dialing:"))
			system("route del default")
			system("modprobe ppp_async")
			self.stateTimer.start(1000,False)
			setOptions(self.phone.getText(), self.username.getText())
			setSecretString(self.username.getText() + ' * ' + self.password.getText())
			ret = conn.execute("pppd", "pppd", "-d", "-detach")
			if ret:
				print "execute pppd failed!"
				self.pppdClosed(ret)
				pppdClosed(ret)
			self.green_function = NONE
			self.red_function = ABORT
			self.updateGui()

	def disconnect(self):
		conn.sendCtrlC()
		self.red_function = NONE
		self.updateGui()

	def keyLeft(self):
		if self.green_function == CONNECT:
			self["list"].handleKey(KEY_LEFT)

	def keyRight(self):
		if self.green_function == CONNECT:
			self["list"].handleKey(KEY_RIGHT)

	def keyNumber(self, number):
		if self.green_function == CONNECT:
			self["list"].handleKey(KEY_0 + number)

	def deleteForward(self):
		if self.green_function == CONNECT:
			self["list"].handleKey(KEY_DELETE)

	def deleteBackward(self):
		if self.green_function == CONNECT:
			self["list"].handleKey(KEY_BACKSPACE)

	def pppdClosed(self, retval):
		global connected
		self.stateTimer.stop()
		self.red_function = NONE
		self.green_function = CONNECT
		self["state"].setText("")
		self.updateGui()
		connected = False

	def dataAvail(self, text):
		if text.find("Serial connection established") != -1:
			tmp = self["state"].getText()
			tmp += "OK\nLogin:"******"state"].setText(tmp)
		if text.find("PAP authentication succeeded") != -1:
			tmp = self["state"].getText()
			tmp += "OK\n"
			self["state"].setText(tmp)
			self.stateTimer.stop()
		if text.find("ip-up finished") != -1:
			global connected
			tmp = self["state"].getText()
			tmp += "Connected :)\n"
			self["state"].setText(tmp)
			self.red_function = DISCONNECT
			connected=True
		if text.find("Connect script failed") != -1:
			tmp = self["state"].getText()
			tmp += "FAILED\n"
			self["state"].setText(tmp)
			self.stateTimer.stop()
			self.red_function = NONE
			self.green_function = CONNECT
		self.updateGui()

	def updateGui(self):
		if self.red_function == NONE:
			self["key_red"].setText("")
		elif self.red_function == DISCONNECT:
			self["key_red"].setText(_("Disconnect"))
		elif self.red_function == ABORT:
			self["key_red"].setText(_("Abort"))
		if self.green_function == NONE:
			self["key_green"].setText("")
		elif self.green_function == CONNECT:
			self["key_green"].setText(_("Connect"))
		focus_enabled = self.green_function == CONNECT
		self["list"].instance.setSelectionEnable(focus_enabled)
		self["ListActions"].setEnabled(not focus_enabled)
Example #54
0
class MovieRetitle(Screen, ConfigListScreen):
    def __init__(self, session, service):
        Screen.__init__(self, session)
        self.skinName = SkinTools.appendResolution("AdvancedMovieSelection_Rename_")
        self.service = service
        self.movieConfig = MovieConfig()
        self.is_vdir = isinstance(service, eServiceReferenceVDir)
        self.is_dir = service.flags & eServiceReference.mustDescent
        serviceHandler = ServiceCenter.getInstance()
        info = serviceHandler.info(service)
        path = service.getPath()
        if self.is_vdir:
            parts = path.split("/")
            if len(parts) > 2:
                dirName = parts[-3] + "/" + parts[-2]
            else: 
                dirName = parts[-2]
            self.original_file = dirName 
        elif self.is_dir:
            self.original_file = service.getName()
        else:
            self.original_file = os.path.basename(os.path.splitext(path)[0])
        if self.is_vdir:
            self.original_name = self.movieConfig.getRenamedName(service.getName())
        else:
            self.original_name = info.getName(service)
        self.original_desc = info.getInfoString(service, iServiceInformation.sDescription)
        self.input_file = ConfigText(default=self.original_file, fixed_size=False, visible_width=82)
        self.input_title = ConfigText(default=self.original_name, fixed_size=False, visible_width=82)
        self.input_descr = ConfigText(default=self.original_desc, fixed_size=False, visible_width=82)
        self["key_green"] = StaticText(_("Save"))
        self["key_red"] = StaticText(_("Cancel"))
        self["actions"] = ActionMap(["SetupActions"],
        {
            "ok": self.keyGo,
            "save": self.keyGo,
            "cancel": self.keyCancel,
        }, -2)
        self.list = [ ]
        ConfigListScreen.__init__(self, self.list, session=self.session)
        self.createSetup()
        self["Path"] = Label(_("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0]))
        self["HelpWindow"] = Pixmap()
        self.onLayoutFinish.append(self.setCustomTitle)

    def createSetup(self):
        self.list = []
        if self.is_vdir:
            self.list.append(getConfigListEntry(_("Displayed bookmark name:"), self.input_title))
        elif self.is_dir:
            self.list.append(getConfigListEntry(_("Foldername:"), self.input_file))
        else:
            self.list.append(getConfigListEntry(_("Filename:"), self.input_file))
            self.list.append(getConfigListEntry(_("Movietitle:"), self.input_title))
            self.list.append(getConfigListEntry(_("Description:"), self.input_descr))

        self["config"].setList(self.list)

    def showKeypad(self, retval = None):
        current = self["config"].getCurrent()
        helpwindowpos = self["HelpWindow"].getPosition()
        if hasattr(current[1], 'help_window'):
            if current[1].help_window.instance is not None:
                current[1].help_window.instance.show()
                current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1]))
        
    def setCustomTitle(self):
        if self.is_vdir:
            self.setTitle(_("Change Bookmarkname"))
        elif self.is_dir:
            self.setTitle(_("Change Foldername"))
        else:
            self.setTitle(_("Change File/Moviename and/or Description"))

    def keyGo(self):
        if self.is_vdir:
            if self.input_title.getText() != self.original_name:
                self.renameVDir(self.original_file, self.input_title.getText())
                self.original_name = self.input_title.getText()
        if self.is_dir:
            if self.input_file.getText() != self.original_file:
                self.renameDirectory(self.service, self.input_file.getText())
                self.original_file = self.input_file.getText()
        else:
            if self.input_title.getText() != self.original_name or self.input_descr.getText() != self.original_desc:
                self.setTitleDescr(self.service, self.input_title.getText(), self.input_descr.getText())
                self.original_name = self.input_title.getText()
                self.original_desc = self.input_descr.getText()
            if self.input_file.getText() != self.original_file:
                self.renameFile(self.service, self.input_file.getText())
                self.original_file = self.input_file.getText()
        self.close()
    
    def keyCancel(self):
        self.close()

    def setTitleDescr(self, service, title, descr):
        try:
            if service.getPath().endswith(".ts"):
                meta_file = service.getPath() + ".meta"
            else:
                meta_file = service.getPath() + ".ts.meta"
            
            # Create new meta for ts files
            if not os.path.exists(meta_file):
                if os.path.isfile(service.getPath()):
                    _title = os.path.basename(os.path.splitext(service.getPath())[0])
                else:
                    _title = service.getName()
                _sid = "0:0:0:0:0:0:0:0:0:0:"
                _descr = ""
                _time = ""
                _tags = ""
                metafile = open(meta_file, "w")
                metafile.write("%s\n%s\n%s\n%s\n%s" % (_sid, _title, _descr, _time, _tags))
                metafile.close()
    
            if os.path.exists(meta_file):
                metafile = open(meta_file, "r")
                sid = metafile.readline()
                oldtitle = metafile.readline().rstrip()
                olddescr = metafile.readline().rstrip()
                rest = metafile.read()
                metafile.close()
                if not title and title != "":
                    title = oldtitle
                if not descr and descr != "":
                    descr = olddescr
                metafile = open(meta_file, "w")
                metafile.write("%s%s\n%s\n%s" % (sid, title, descr, rest))
                metafile.close()
        except:
            printStackTrace()

    def renameDirectory(self, service, new_name):
        try:
            dir_name = os.path.dirname(self.service.getPath()[0:-1])
            os.rename(self.service.getPath(), os.path.join(dir_name, self.input_file.getText() + "/"))
            self.original_file = self.input_file.getText()
        except:
            printStackTrace()

    def renameFile(self, service, new_name):
        try:
            path = os.path.dirname(service.getPath())
            file_name = os.path.basename(os.path.splitext(service.getPath())[0])
            src = os.path.join(path, file_name)
            dst = os.path.join(path, new_name)
            import glob
            for f in glob.glob(os.path.join(path, src + "*")):
                os.rename(f, f.replace(src, dst))
        except:
            printStackTrace()

    def renameVDir(self, dir_name, name):
        try:
            if not dir_name + "\t" + self.original_name in self.movieConfig.rename:
                self.movieConfig.rename.append(dir_name + "\t" + name)
            elif name == "":
                for index, item in enumerate(self.movieConfig.rename):
                    i = item.split("\t")
                    if i[0] == dir_name:
                        print dir_name + "\t" + name
                        del self.movieConfig.rename[index]
            else:
                for index, item in enumerate(self.movieConfig.rename):
                    i = item.split("\t")
                    if i[0] == dir_name:
                        self.movieConfig.rename[index] = dir_name + "\t" + name
            self.movieConfig.safe()
        except:
            printStackTrace()
class MovieRetitle(Screen, ConfigListScreen):
    def __init__(self, session, services):
        Screen.__init__(self, session)

        self.skinName = ["MovieRetitle", "Setup"]
        self.list = []
        ConfigListScreen.__init__(self, self.list, session)

        self["Path"] = Label(
            _("Location:"
              ))  # + ' ' + os.path.dirname(os.path.splitext(path)[0]))
        self["HelpWindow"] = Pixmap()
        self.onLayoutFinish.append(self.setCustomTitle)

        self["key_green"] = StaticText(_("Save"))
        self["key_red"] = StaticText(_("Cancel"))
        self["actions"] = ActionMap(["SetupActions"], {
            "ok": self.keyGo,
            "save": self.keyGo,
            "cancel": self.keyCancel,
        }, -2)

        self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"], {
            "showVirtualKeyboard": self.KeyText,
        }, -2)
        self["VirtualKB"].setEnabled(False)
        self["HelpWindow"] = Pixmap()
        self["VKeyIcon"] = Pixmap()
        self["VKeyIcon"].hide()

        self.serviceHandler = ServiceCenter.getInstance()

        if isinstance(services, list):
            self.services = services
        else:
            self.services = [services]

        self.buildSetup(self.services.pop())

    def buildSetup(self, service):
        self.service = service
        self.is_dir = service.flags & eServiceReference.mustDescent
        info = self.serviceHandler.info(service)
        path = service.getPath()
        self["Path"] = Label(
            _("Location:") + ' ' + os.path.dirname(os.path.splitext(path)[0]))
        if self.is_dir:
            self.original_file = service.getName()
        else:
            self.original_file = os.path.basename(os.path.splitext(path)[0])
        self.original_name = info.getName(service)
        self.original_desc = info.getInfoString(
            service, iServiceInformation.sDescription)
        self.input_file = ConfigText(default=self.original_file,
                                     fixed_size=False,
                                     visible_width=82)
        self.input_title = ConfigText(default=self.original_name,
                                      fixed_size=False,
                                      visible_width=82)
        self.input_descr = ConfigText(default=self.original_desc,
                                      fixed_size=False,
                                      visible_width=82)
        self.createSetup()

    def createSetup(self):
        self.list = []
        if self.is_dir:
            self.list.append(
                getConfigListEntry(_("Foldername:"), self.input_file))
        else:
            self.list.append(
                getConfigListEntry(_("Filename:"), self.input_file))
            self.list.append(
                getConfigListEntry(_("Movietitle:"), self.input_title))
            self.list.append(
                getConfigListEntry(_("Description:"), self.input_descr))
        self["config"].setList(self.list)

    def handleInputHelpers(self):
        return
        if self["config"].getCurrent() is not None:
            if isinstance(self["config"].getCurrent()[1],
                          ConfigText) or isinstance(
                              self["config"].getCurrent()[1], ConfigPassword):
                if self.has_key("VKeyIcon"):
                    self["VirtualKB"].setEnabled(True)
                    self["VKeyIcon"].boolean = True
                if self.has_key("HelpWindow"):
                    if self["config"].getCurrent(
                    )[1].help_window.instance is not None:
                        helpwindowpos = self["HelpWindow"].getPosition()

                        if helpwindowpos:
                            helpwindowposx, helpwindowposy = helpwindowpos
                            if helpwindowposx and helpwindowposy:
                                from enigma import ePoint
                                self["config"].getCurrent(
                                )[1].help_window.instance.move(
                                    ePoint(helpwindowposx, helpwindowposy))
            else:
                if self.has_key("VKeyIcon"):
                    self["VirtualKB"].setEnabled(False)
                    self["VKeyIcon"].boolean = False
        else:
            if self.has_key("VKeyIcon"):
                self["VirtualKB"].setEnabled(False)
                self["VKeyIcon"].boolean = False

    def setCustomTitle(self):
        if self.is_dir:
            self.setTitle(_("Change Foldername"))
        else:
            self.setTitle(_("Change File/Moviename and/or Description"))

    def keyGo(self):
        if self.is_dir:
            if self.input_file.getText() != self.original_file:
                self.renameDirectory(self.service, self.input_file.getText())
                self.original_file = self.input_file.getText()
        else:
            if self.input_title.getText(
            ) != self.original_name or self.input_descr.getText(
            ) != self.original_desc:
                self.setTitleDescr(self.service, self.input_title.getText(),
                                   self.input_descr.getText())
                self.original_name = self.input_title.getText()
                self.original_desc = self.input_descr.getText()
            if self.input_file.getText() != self.original_file:
                self.renameFile(self.service, self.input_file.getText())
                self.original_file = self.input_file.getText()
        if self.services:
            service = self.services.pop()
            self.buildSetup(service)
        else:
            self.close()

    def keyCancel(self):
        self.close()

    def setTitleDescr(self, service, title, descr):
        #TODO Use MetaSupport class
        if service.getPath().endswith(".ts"):
            meta_file = service.getPath() + ".meta"
        else:
            meta_file = service.getPath() + ".ts.meta"

        # Create new meta for ts files
        if not os.path.exists(meta_file):
            if os.path.isfile(service.getPath()):
                _title = os.path.basename(
                    os.path.splitext(service.getPath())[0])
            else:
                _title = service.getName()
            _sid = ""
            _descr = ""
            _time = ""
            _tags = ""
            metafile = open(meta_file, "w")
            metafile.write("%s\n%s\n%s\n%s\n%s" %
                           (_sid, _title, _descr, _time, _tags))
            metafile.close()

        if os.path.exists(meta_file):
            metafile = open(meta_file, "r")
            sid = metafile.readline()
            oldtitle = metafile.readline().rstrip()
            olddescr = metafile.readline().rstrip()
            rest = metafile.read()
            metafile.close()
            if not title and title != "":
                title = oldtitle
            if not descr and descr != "":
                descr = olddescr
            metafile = open(meta_file, "w")
            metafile.write("%s%s\n%s\n%s" % (sid, title, descr, rest))
            metafile.close()

    def renameDirectory(self, service, new_name):
        try:
            dir = os.path.dirname(self.service.getPath()[0:-1])
            os.rename(self.service.getPath(),
                      os.path.join(dir,
                                   self.input_file.getText() + "/"))
            self.original_file = self.input_file.getText()
        except Exception, e:
            print e
Example #56
0
try:
    import json
except Exception:
    import simplejson as json
from Components.config import config, ConfigSelection, ConfigText, getConfigListEntry
###################################################

###################################################
# Config options for HOST
###################################################
config.plugins.iptvplayer.skstream_proxy = ConfigSelection(
    default="None",
    choices=[("None", _("None")),
             ("proxy_1", _("Alternative proxy server (1)")),
             ("proxy_2", _("Alternative proxy server (2)"))])
config.plugins.iptvplayer.skstream_alt_domain = ConfigText(default="",
                                                           fixed_size=False)


def GetConfigList():
    optionList = []
    optionList.append(
        getConfigListEntry(_("Use proxy server:"),
                           config.plugins.iptvplayer.skstream_proxy))
    if config.plugins.iptvplayer.skstream_proxy.value == 'None':
        optionList.append(
            getConfigListEntry(_("Alternative domain:"),
                               config.plugins.iptvplayer.skstream_alt_domain))
    return optionList


###################################################
Example #57
0
# highest priority is loaded last, usually the user-provided
# skin.

# currently, loadSingleSkinData (colors, bordersets etc.)
# are applied one-after-each, in order of ascending priority.
# the dom_skin will keep all screens in descending priority,
# so the first screen found will be used.

# example: loadSkin("nemesis_greenline/skin.xml")
config.skin = ConfigSubsection()
DEFAULT_SKIN = "PLi-HD/skin.xml"
# on SD hardware, PLi-HD will not be available
if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)):
    # in that case, fallback to Magic (which is an SD skin)
    DEFAULT_SKIN = "Magic/skin.xml"
config.skin.primary_skin = ConfigText(default=DEFAULT_SKIN)

profile("LoadSkin")
res = None
name = skin_user_skinname()
if name:
    res = addSkin(name, SCOPE_CONFIG)
if not name or not res:
    addSkin('skin_user.xml', SCOPE_CONFIG)

# some boxes lie about their dimensions
addSkin('skin_box.xml')
# add optional discrete second infobar
addSkin('skin_second_infobar.xml')
display_skin_id = 1
addSkin('skin_display.xml')
Example #58
0
    def __init__(self, session, name, path, descr):
        Screen.__init__(self, session)
        self.skinName = ["AdvancedCutInput", "Setup"]

        self["key_green"] = StaticText(_("OK"))
        self["key_red"] = StaticText(_("Cancel"))

        if self.baseName(path) == self.baseName(name):
            title = ""
        else:
            title = name
        dir = self.dirName(path)
        file = self.baseName(path) + " cut"
        self.input_replace = ConfigSelection(choices=[("no", _("No")),
                                                      ("yes", _("Yes"))],
                                             default="no")
        self.input_file = ConfigText(default=file,
                                     fixed_size=False,
                                     visible_width=45)
        self.input_title = ConfigText(default=title,
                                      fixed_size=False,
                                      visible_width=45)
        self.input_descr = ConfigText(default=descr,
                                      fixed_size=False,
                                      visible_width=45)
        tmp = config.movielist.videodirs.value
        if not dir in tmp:
            tmp.append(dir)
        self.input_dir = ConfigSelection(choices=tmp, default=dir)
        self.input_manual = ConfigSelection(choices=[
            ("no", _("Cutlist")), ("yes", _("Manual specification"))
        ],
                                            default="no")
        self.input_space = ConfigNothing()
        self.input_manualcuts = ConfigText(default="", fixed_size=False)
        self.input_manualcuts.setUseableChars(" 0123456789:.")

        self["actions"] = ActionMap(
            ["SetupActions"], {
                "ok": self.keySelectOrGo,
                "save": self.keyGo,
                "cancel": self.keyCancel,
            }, -2)

        self.list = []
        ConfigListScreen.__init__(self, self.list)
        self.entry_replace = getConfigListEntry(_("Replace original:"),
                                                self.input_replace)
        self.entry_file = getConfigListEntry(_("New filename:"),
                                             self.input_file)
        self.entry_title = getConfigListEntry(_("New title:"),
                                              self.input_title)
        self.entry_descr = getConfigListEntry(_("New description:"),
                                              self.input_descr)
        self.entry_dir = getConfigListEntry(_("New location:"), self.input_dir)
        self.entry_manual = getConfigListEntry(_("Cut source:"),
                                               self.input_manual)
        self.entry_space = getConfigListEntry(
            _("Cuts (an IN OUT IN OUT ... sequence of hour:min:sec)"),
            self.input_space)
        self.entry_manualcuts = getConfigListEntry(":", self.input_manualcuts)
        self.createSetup(self["config"])

        self.onLayoutFinish.append(self.layoutFinished)
Example #59
0
	def __init__(self, text, visible_width=60):
		ConfigText.__init__(self, default = text, fixed_size = True, visible_width = visible_width)
Example #60
0

# Set default configuration
config.plugins.e2m3u2b = ConfigSubsection()
config.plugins.e2m3u2b.autobouquetupdate = ConfigYesNo(default=False)
config.plugins.e2m3u2b.scheduletype = ConfigSelection(
    default='interval', choices=['interval', 'fixed time'])
config.plugins.e2m3u2b.updateinterval = ConfigSelectionNumber(default=6,
                                                              min=2,
                                                              max=48,
                                                              stepwidth=1)
config.plugins.e2m3u2b.schedulefixedtime = ConfigClock(default=0)
config.plugins.e2m3u2b.autobouquetupdateatboot = ConfigYesNo(default=False)
config.plugins.e2m3u2b.iconpath = ConfigSelection(
    default=e2m3u2bouquet.PICONSPATH, choices=getMounted())
config.plugins.e2m3u2b.last_update = ConfigText()
config.plugins.e2m3u2b.extensions = ConfigYesNo(default=False)
config.plugins.e2m3u2b.mainmenu = ConfigYesNo(default=False)
config.plugins.e2m3u2b.do_epgimport = ConfigYesNo(default=False)
config.plugins.e2m3u2b.debug = ConfigOnOff(default=False)
config.plugins.e2m3u2b.cfglevel = ConfigText(default='')


class AutoStartTimer:
    def __init__(self, session):
        self.session = session
        self.timer = eTimer()
        self.timer.callback.append(self.on_timer)
        self.update()

    def get_wake_time(self):