Пример #1
0
def renameDevice():
    import xbmcgui
    from lib import devices
    from lib import PushbulletTargets
    from lib import util

    dev = devices.getDefaultKodiDevice(util.getSetting('device_iden'),
                                       util.getSetting('device_name'))
    if not dev or not dev.ID:
        xbmcgui.Dialog().ok(T(32076), T(32077))
    name = xbmcgui.Dialog().input('{0}:'.format(T(32078)), dev.name or '')
    if not name: return
    if name == dev.name: return

    token = util.getSetting('token')

    client = PushbulletTargets.Client(token)

    while deviceNameExists(client, name):
        name = xbmcgui.Dialog().input(T(32079), dev.name or '')
        if not name: return
        if name == dev.name: return

    if not token:
        xbmcgui.Dialog().ok(T(32068), T(32080), T(32081))
        return

    try:
        if client.updateDevice(dev, nickname=name):
            util.setSetting('device_name', dev.name)
            xbmcgui.Dialog().ok(T(32062), '{0}: '.format(T(32082)), '',
                                dev.name)

    except PushbulletTargets.PushbulletException, e:
        showError(e.message)
Пример #2
0
 def reloadSettings(self):
     self.readerOn = not util.getSetting('reader_off',False)
     util.reload()
     self.speakListCount = util.getSetting('speak_list_count',True)
     self.autoItemExtra = False
     if util.getSetting('auto_item_extra',False):
         self.autoItemExtra = util.getSetting('auto_item_extra_delay',2)
Пример #3
0
 def reloadSettings(self):
     self.readerOn = not util.getSetting('reader_off',False)
     util.DEBUG = util.getSetting('debug_logging',True)
     self.speakListCount = util.getSetting('speak_list_count',True)
     self.autoItemExtra = False
     if util.getSetting('auto_item_extra',False):
         self.autoItemExtra = util.getSetting('auto_item_extra_delay',2)
Пример #4
0
def renameDevice():
    import xbmcgui
    from lib import devices
    from lib import pbclient
    from lib import util
    
    dev = devices.getDefaultKodiDevice(util.getSetting('pb_client_iden'),util.getSetting('pb_client_nickname'))
    if not dev or not dev.ID:
        xbmcgui.Dialog().ok(localise(32076),localise(32077))
    name = xbmcgui.Dialog().input('{0}:'.format(localise(32078)),dev.name or '')
    if not name: return
    if name == dev.name: return
    
    token = util.getSetting('pb_access_token')
    
    client = pbclient.Client(token)
    
    while deviceNameExists(client,name):
        name = xbmcgui.Dialog().input(localise(32079),dev.name or '')
        if not name: return
        if name == dev.name: return

    if not token:
        xbmcgui.Dialog().ok(localise(32068),localise(32080),localise(32081))
        return
        
    try:
        if client.updateDevice(dev,nickname=name):
            util.setSetting('pb_client_nickname',dev.name)
            xbmcgui.Dialog().ok(localise(32062),'{0}: '.format(localise(32082)),'',dev.name)
            
    except pbclient.PushbulletException, e:
        showError(e.message)
Пример #5
0
def preSavePassword(password):
	keyfile = getSetting('crypto_key_file', '')
	if keyfile: keyfile = ':' + binascii.hexlify(keyfile)
	if getSetting('crypto_type') == '0':
		return 'a' + password + keyfile
	elif getSetting('crypto_type') == '1':
		return 'd' + password + keyfile
	else:
		return 'b' + password + keyfile
Пример #6
0
    def loadSettings(self):
        self.reconnectDelay = 5
        self.interruptMedia = util.getSetting('interrupt_media', False)
        self.instantPlay = util.getSetting('instant_play', True)
        self.showNotification = util.getSetting('show_notification', True)

        if self.credentialsUpdated():
            if self.targetsBox: self.targetsBox.close()
            self.targetsBox = TargetsBox()
Пример #7
0
	def loadSettings(self):
		self.reconnectDelay = 5
		self.interruptMedia = util.getSetting('interrupt_media',False)
		self.instantPlay = util.getSetting('instant_play',True)
		self.showNotification = util.getSetting('show_notification',True)
		
		if self.credentialsUpdated():
			if self.targetsBox: self.targetsBox.close()
			self.targetsBox = TargetsBox()
Пример #8
0
    def __init__(self):
        self.token = util.getSetting('token')
        self.deviceID = util.getSetting('device_iden')
        self.deviceName = util.getSetting('device_name')
        self.device = None
        self.targets = None

        self.reconnectDelay = 5
        self.nextReconnect = 0
        self.hasConnected = False
        self.badToken = False
        self.start()
        self.connect()
Пример #9
0
	def __init__(self):
		self.token = util.getSetting('token')
		self.deviceID = util.getSetting('device_iden')
		self.deviceName = util.getSetting('device_name')
		self.device = None
		self.targets = None

		self.reconnectDelay = 5
		self.nextReconnect = 0
		self.hasConnected = False
		self.badToken = False
		self.start()
		self.connect()
Пример #10
0
def preInstalledFirstRun():
    if not util.isPreInstalled(): #Do as little as possible if there is no pre-install
        if util.wasPreInstalled():
            util.LOG('PRE INSTALL: REMOVED')
            # Set version to 0.0.0 so normal first run will execute and fix the keymap
            util.setSetting('version','0.0.0')
            import enabler
            enabler.markPreOrPost() # Update the install status
        return False

    import enabler

    lastVersion = util.getSetting('version')

    if not enabler.isPostInstalled() and util.wasPostInstalled():
        util.LOG('POST INSTALL: UN-INSTALLED OR REMOVED')
        # Add-on was removed. Assume un-installed and treat this as a pre-installed first run to disable the addon
    elif lastVersion:
        enabler.markPreOrPost() # Update the install status
        return False

    # Set version to 0.0.0 so normal first run will execute on first enable
    util.setSetting('version','0.0.0')

    util.LOG('PRE-INSTALLED FIRST RUN')
    util.LOG('Installing basic keymap')

    # Install keymap with just F12 enabling included
    from lib import keymapeditor
    keymapeditor.installBasicKeymap()

    util.LOG('Pre-installed - DISABLING')

    enabler.disableAddon()
    return True
Пример #11
0
def getBackend(provider='auto'):
    provider = util.getSetting('backend') or provider
    b = getBackendByProvider(provider)
    if not b or not b._available():
         for b in backendsByPriority:
            if b._available(): break
    return b
Пример #12
0
    def checkNewVersion(self):
        try:
            #Fails on Helix beta 1 on OpenElec #1103
            from distutils.version import LooseVersion
        except ImportError:
            def LooseVersion(v):
                comp = [int(x) for x in re.split(r'a|b',v)[0].split(".")]
                fourth = 2
                fifth = 0
                if 'b' in v:
                    fourth = 1
                    fifth = int(v.split('b')[-1] or 0)
                elif 'a' in 'v':
                    fourth = 0
                    fifth = int(v.split('a')[-1] or 0)
                comp.append(fourth)
                comp.append(fifth)
                return comp


        lastVersion = util.getSetting('version','0.0.0')
        util.setSetting('version',__version__)

        if lastVersion == '0.0.0':
            self.firstRun()
            return True
        elif LooseVersion(lastVersion) < LooseVersion(__version__):
            self.queueNotice(u'{0}... {1}'.format(T(32104),__version__))
            return True
        return False
Пример #13
0
    def checkNewVersion(self):
        try:
            #Fails on Helix beta 1 on OpenElec #1103
            from distutils.version import LooseVersion
        except ImportError:
            def LooseVersion(v):
                comp = [int(x) for x in re.split(r'a|b',v)[0].split(".")]
                fourth = 2
                fifth = 0
                if 'b' in v:
                    fourth = 1
                    fifth = int(v.split('b')[-1] or 0)
                elif 'a' in 'v':
                    fourth = 0
                    fifth = int(v.split('a')[-1] or 0)
                comp.append(fourth)
                comp.append(fifth)
                return comp


        lastVersion = util.getSetting('version','0.0.0')
        util.setSetting('version',__version__)

        if lastVersion == '0.0.0':
            self.firstRun()
            return True
        elif LooseVersion(lastVersion) < LooseVersion(__version__):
            self.queueNotice(u'{0}... {1}'.format(T(32104),__version__))
            return True
        return False
Пример #14
0
    def shutdownClicked(self):
        options = []
        options.append({'key': 'sign_out', 'display': T(32421, 'Sign Out')})
        options.append({'key': 'exit', 'display': T(32422, 'Exit')})
        if util.getSetting('kiosk.mode', False):
            if xbmc.getCondVisibility('System.CanPowerDown'):
                options.append({'key': 'shutdown', 'display': T(32423, 'Shutdown')})
            if xbmc.getCondVisibility('System.CanSuspend'):
                options.append({'key': 'suspend', 'display': T(32424, 'Suspend')})
            if xbmc.getCondVisibility('System.CanHibernate'):
                options.append({'key': 'hibernate', 'display': T(32425, 'Hibernate')})
            if xbmc.getCondVisibility('System.CanReboot'):
                options.append({'key': 'reboot', 'display': T(32426, 'Reboot')})

        with self.propertyContext('dropdown'):
            choice = dropdown.showDropdown(options, (60, 101))
            if not choice:
                return

        if choice['key'] == 'sign_out':
            self.selected = 'signout'
            self.doClose()
        elif choice['key'] == 'exit':
            self.doClose()
        elif choice['key'] == 'shutdown':
            xbmc.executebuiltin('Powerdown()')
        elif choice['key'] == 'suspend':
            xbmc.executebuiltin('Suspend()')
        elif choice['key'] == 'hibernate':
            xbmc.executebuiltin('Hibernate()')
        elif choice['key'] == 'reboot':
            xbmc.executebuiltin('Reset()')
Пример #15
0
def getBackend(provider='auto'):
    provider = util.getSetting('backend') or provider
    b = getBackendByProvider(provider)
    if not b or not b._available():
         for b in backendsByPriority:
            if b._available(): break
    return b
Пример #16
0
def getBackend():
	userBackendIndex = util.getSetting('default_tts',0)
	b = backends[userBackendIndex]
	if not b.available():
 		for b in backendsByPriority:
			if b.available(): break
	return b
Пример #17
0
def preInstalledFirstRun():
    if not util.isPreInstalled(): #Do as little as possible if there is no pre-install
        if util.wasPreInstalled():
            util.LOG('PRE INSTALL: REMOVED')
            # Set version to 0.0.0 so normal first run will execute and fix the keymap
            util.setSetting('version','0.0.0')
            import enabler
            enabler.markPreOrPost() # Update the install status
        return False

    import enabler

    lastVersion = util.getSetting('version')

    if not enabler.isPostInstalled() and util.wasPostInstalled():
        util.LOG('POST INSTALL: UN-INSTALLED OR REMOVED')
        # Add-on was removed. Assume un-installed and treat this as a pre-installed first run to disable the addon
    elif lastVersion:
        enabler.markPreOrPost() # Update the install status
        return False

    # Set version to 0.0.0 so normal first run will execute on first enable
    util.setSetting('version','0.0.0')

    util.LOG('PRE-INSTALLED FIRST RUN')
    util.LOG('Installing basic keymap')

    # Install keymap with just F12 enabling included
    from lib import keymapeditor
    keymapeditor.installBasicKeymap()

    util.LOG('Pre-installed - DISABLING')

    enabler.disableAddon()
    return True
Пример #18
0
def authorize():
    import OAuthHelper

    token = OAuthHelper.getToken(__addonid__)
    if token:
        saveToken(token)
        if not util.getSetting('pb_client_iden'):
            linkDevice()
Пример #19
0
	def credentialsUpdated(self):
		token = util.getSetting('token')
		deviceID = util.getSetting('device_iden')
		if not self.targetsBox:
			if token and deviceID:
				return True
			else:
				return None
		if token != self.targetsBox.token:
			util.LOG('TOKEN CHANGED')
			return True

		if deviceID != self.targetsBox.deviceID:
			util.LOG('DEVICE CHANGED FROM: {0} TO: {1}'.format(self.targetsBox.deviceName,util.getSetting('device_name')))
			return True

		return False
Пример #20
0
def authorize():
    import OAuthHelper
    
    token = OAuthHelper.getToken(__addonid__)
    if token:
        saveToken(token)
        if not util.getSetting('pb_client_iden'):
            linkDevice()
Пример #21
0
def getPasswordCryptoMethod():
	s_idx = getSetting('crypto_type','2')
	if s_idx == '0':
		return 'aes'
	elif s_idx == '1':
		return 'des'
	else:
		return 'both'
Пример #22
0
 def setOutDir(self):
     tmpfs = util.getTmpfs()
     if util.getSetting('use_tmpfs', True) and tmpfs:
         util.LOG('Using tmpfs at: {0}'.format(tmpfs))
         self.outDir = os.path.join(tmpfs, 'xbmc_speech')
     else:
         self.outDir = os.path.join(util.profileDirectory(), 'xbmc_speech')
     if not os.path.exists(self.outDir): os.makedirs(self.outDir)
Пример #23
0
 def setOutDir(self):
     tmpfs = util.getTmpfs()
     if util.getSetting('use_tmpfs',True) and tmpfs:
         util.LOG('Using tmpfs at: {0}'.format(tmpfs))
         self.outDir = os.path.join(tmpfs,'xbmc_speech')
     else:
         self.outDir = os.path.join(util.profileDirectory(),'xbmc_speech')
     if not os.path.exists(self.outDir): os.makedirs(self.outDir)
    def visible(self):
        visible = self._visible()
        if visible:
            if not util.getSetting('speak_background_progress', False):
                return False
        else:
            if self._win: return True

        return visible
Пример #25
0
    def credentialsUpdated(self):
        token = util.getSetting('token')
        deviceID = util.getSetting('device_iden')
        if not self.targetsBox:
            if token and deviceID:
                return True
            else:
                return None
        if token != self.targetsBox.token:
            util.LOG('TOKEN CHANGED')
            return True

        if deviceID != self.targetsBox.deviceID:
            util.LOG('DEVICE CHANGED FROM: {0} TO: {1}'.format(
                self.targetsBox.deviceName, util.getSetting('device_name')))
            return True

        return False
Пример #26
0
	def start(self):
		self.targets = PushbulletTargets.Targets(
			self.token,
			most_recent=util.getSetting('most_recent',0),
			most_recent_callback=self.mostRecentUpdated
		)

		self.device = devices.getDefaultKodiDevice(self.deviceID,self.deviceName)
		self.targets.registerDevice(self.device)
Пример #27
0
    def start(self):
        self.targets = PushbulletTargets.Targets(
            self.token,
            most_recent=util.getSetting('most_recent', 0),
            most_recent_callback=self.mostRecentUpdated)

        self.device = devices.getDefaultKodiDevice(self.deviceID,
                                                   self.deviceName)
        self.targets.registerDevice(self.device)
Пример #28
0
def selectDevice():
    from lib import gui, pbclient

    token = util.getSetting('pb_access_token')

    client = pbclient.Client(token)

    ID = gui.selectDevice(client, extra=localise(32083))
    if ID == None: return
    util.setSetting('selected_device', ID)
Пример #29
0
def selectDevice():
	from lib import gui, PushbulletTargets

	token = util.getSetting('token')

	client = PushbulletTargets.Client(token)

	ID = gui.selectDevice(client,extra=T(32083))
	if ID == None: return
	util.setSetting('selected_device',ID)
Пример #30
0
    def visible(self):
        visible = self._visible()
        if visible:
            if not util.getSetting("speak_background_progress", False):
                return False
        else:
            if self._win:
                return True

        return visible
Пример #31
0
def selectDevice():
    from lib import gui, PushbulletTargets

    token = util.getSetting('token')

    client = PushbulletTargets.Client(token)

    ID = gui.selectDevice(client, extra=T(32083))
    if ID == None: return
    util.setSetting('selected_device', ID)
Пример #32
0
def selectDevice():
    from lib import gui, pbclient

    token = util.getSetting('pb_access_token')

    client = pbclient.Client(token)

    ID = gui.selectDevice(client,extra=localise(32083))
    if ID == None: return
    util.setSetting('selected_device',ID)
Пример #33
0
 def _loadSettings(self):
     jsonString = util.getSetting(
         'library.settings.{0}'.format(self.serverID), '')
     self._settings = {}
     try:
         self._settings = json.loads(jsonString)
     except ValueError:
         pass
     except:
         util.ERROR()
Пример #34
0
	def prepareSmileyList(self):
		class SmiliesList(list):
			def get(self,key,default=None): return default
			
		new = SmiliesList()
		if util.getSetting('use_skin_mods',True) and util.getSetting('font_installed',True):
			for f,r,x in self.FB.smiliesDefs: #@UnusedVariable
				f = '(?m)((?:^|\s|\[CR\]))'+ re.escape(f)
				if '[/COLOR]' in r:
					new.append((f,r))
				else:
					new.append((f,'[COLOR FFBBBB00]'+r+'[/COLOR]'))
		else:
			for f,r,x in self.FB.smiliesDefs: #@UnusedVariable
				f = '(?m)((?:^|\s))'+ re.escape(f)
				if '[/COLOR]' in x:
					new.append((f,x))
				else:
					new.append((f,'[COLOR FFBBBB00]'+x+'[/COLOR]'))
		self.FB.smilies = new
Пример #35
0
    def loadFirstWindow(self):
        last = util.getSetting('window.last')
        if last:
            if last != 'GUIDE' or tablo.API.hasSubscription():
                for window, ID in ((DeviceWindow, 101), (LiveTVWindow, 102), (RecordingsWindow, 103), (GuideWindow, 104), (ScheduledWindow, 105)):
                    if window.name == last:
                        self.setFocusId(ID)
                        return self.openWindow(window, hide_menu=False)

        self.setFocusId(102)
        self.openWindow(LiveTVWindow, hide_menu=False)
Пример #36
0
    def loadFirstWindow(self):
        last = util.getSetting('window.last')
        if last:
            if last != 'GUIDE' or tablo.API.hasSubscription():
                for window, ID in ((DeviceWindow, 101), (LiveTVWindow, 102),
                                   (RecordingsWindow, 103), (GuideWindow, 104),
                                   (ScheduledWindow, 105)):
                    if window.name == last:
                        self.setFocusId(ID)
                        return self.openWindow(window, hide_menu=False)

        self.setFocusId(102)
        self.openWindow(LiveTVWindow, hide_menu=False)
Пример #37
0
    def _collectLineUp(self):
        if not self.devices.hasTunerDevices:
            util.DEBUG_LOG('ERROR: No tuner devices responded!')
            raise errors.NoTunersException()

        lineUps = []

        err = None
        for d in self.devices.tunerDevices:
            try:
                lineUp = d.lineUp()
                if lineUp: lineUps.append((d, lineUp))
            except:
                err = util.ERROR()
                continue

        if not lineUps:
            if err:
                util.LOG('ERROR: No compatible devices found!')
                raise errors.NoCompatibleDevicesException()
            else:
                util.DEBUG_LOG('ERROR: Empty lineup!')
                raise errors.EmptyLineupException()

        hideDRM = not util.getSetting('show.DRM', False)

        while lineUps:
            lowest = min(
                lineUps,
                key=lambda l: l[1] and chanTuple(l[1][0]['GuideNumber'], l[0].
                                                 channelCount) or (0, 0, 0)
            )  #Prefer devices with the most channels assuming (possibly wrongly) that they are getting a better signal
            if not lowest[1]:
                lineUps.pop(lineUps.index(lowest))
                continue

            chanData = lowest[1].pop(0)

            if hideDRM and chanData.get('DRM'): continue

            channelNumber = chanData['GuideNumber']

            if '.' in channelNumber: self.hasSubChannels = True

            if channelNumber in self.channels:
                self.channels[chanData['GuideNumber']].add(chanData, lowest[0])
            else:
                self.channels[chanData['GuideNumber']] = Channel(
                    chanData, lowest[0])

        if not self.channels: util.DEBUG_LOG(lineUps)
Пример #38
0
def main():
	if not util.getToken():
		import xbmcgui
		xbmcgui.Dialog().ok(T(32084),T(32085),T(32086))
		util.ADDON.openSettings()
		return
		
	if not util.getSetting('device_iden'):
		import xbmcgui
		xbmcgui.Dialog().ok(T(32084),T(32087),T(32088),T(32089))
		util.ADDON.openSettings()
		return

	from lib import gui
	gui.start()
Пример #39
0
def createHandlerWithCallback(callback):
	if getSetting('disable_async_connections',False):
		return urllib2.HTTPHandler
	
	class rc(AsyncHTTPResponse):
		_prog_callback = callback
		
	class conn(httplib.HTTPConnection):
		response_class = rc
		
	class handler(urllib2.HTTPHandler):
		def http_open(self, req):
			return self.do_open(conn, req)
	
	return handler
Пример #40
0
def main():
    if not util.getToken():
        import xbmcgui
        xbmcgui.Dialog().ok(T(32084), T(32085), T(32086))
        util.ADDON.openSettings()
        return

    if not util.getSetting('device_iden'):
        import xbmcgui
        xbmcgui.Dialog().ok(T(32084), T(32087), T(32088), T(32089))
        util.ADDON.openSettings()
        return

    from lib import gui
    gui.start()
Пример #41
0
def main():
    if not util.getToken():
        import xbmcgui
        xbmcgui.Dialog().ok(localise(32084),localise(32085),localise(32086))
        util.ADDON.openSettings()
        return
        
    if not util.getSetting('pb_client_iden'):
        import xbmcgui
        xbmcgui.Dialog().ok(localise(32084),localise(32087),localise(32088),localise(32089))
        util.ADDON.openSettings()
        return

    from lib import gui
    gui.start()
Пример #42
0
def main():
    if not util.getToken():
        import xbmcgui
        xbmcgui.Dialog().ok(localise(32084), localise(32085), localise(32086))
        util.ADDON.openSettings()
        return

    if not util.getSetting('pb_client_iden'):
        import xbmcgui
        xbmcgui.Dialog().ok(localise(32084), localise(32087), localise(32088),
                            localise(32089))
        util.ADDON.openSettings()
        return

    from lib import gui
    gui.start()
Пример #43
0
	def setReplaces(self):
		self.quoteReplace = unicode.encode('[CR]_________________________[CR][B]'+T(32180)+'[/B][CR]'+T(32181)+' [B]%s[/B][CR][I]%s[/I][CR]_________________________[CR][CR]','utf8')
		self.aQuoteReplace = unicode.encode('[CR]_________________________[CR][B]'+T(32180)+'[/B][CR][I]%s[/I][CR]_________________________[CR][CR]','utf8')
		self.quoteImageReplace = '[COLOR FFFF0000]I[/COLOR][COLOR FFFF8000]M[/COLOR][COLOR FF00FF00]A[/COLOR][COLOR FF0000FF]G[/COLOR][COLOR FFFF00FF]E[/COLOR]: \g<url>'
		self.hrReplace = ('[B]_____________________________________________________________________________________[/B]').encode('utf8')
		#self.imageReplace = '[COLOR FFFF0000]I[/COLOR][COLOR FFFF8000]M[/COLOR][COLOR FF00FF00]G[/COLOR][COLOR FF0000FF]#[/COLOR][COLOR FFFF00FF]{0}[/COLOR]: [I]{1}[/I] '
		#self.imageReplace = u'[COLOR FFFF0000]([/COLOR][COLOR FF00FF00]([/COLOR]{0}[COLOR FF0000FF])[/COLOR][COLOR FFFFFF00])[/COLOR]{1}'
		
		if util.getSetting('use_skin_mods',True) and util.getSetting('font_installed',True):
			self.imageConvert = self.imageConvertMod
			self.imageConvertQuote = self.imageConvertModQuote
			self.imageReplace = u'[CR][COLOR FF808080]\u250c\u2500\u2500\u2500\u2510[/COLOR][CR]'
			if util.getSetting('hide_image_urls',True):
				self.imageReplace += u'[COLOR FF808080]\u2502[/COLOR]{0}[COLOR FF808080]\u2502[/COLOR][CR]'
			else:
				self.imageReplace += u'[COLOR FF808080]\u2502[/COLOR]{0}[COLOR FF808080]\u2502[/COLOR][COLOR FF00AAAA]{1}[/COLOR][CR]'
			self.imageReplaceQuote = u'\u2022\u2024{0}\u2022 '
			self.imageReplace += u'[COLOR FF808080]\u2514\u2500\u2500\u2500\u2518[/COLOR][CR]'
			if util.getSetting('hide_link_urls',True):
				self.linkReplace = u'[COLOR FF00AAAA]\u261B{0}[/COLOR]'
			else:
				self.linkReplace = u'[COLOR FF00AAAA]{0} (\u261B [B]{1}[/B])[/COLOR]'
			self.link2Replace = u'[COLOR FF00AAAA](\u261B [B]\g<url>[/B])[/COLOR]'
			self.quoteStartReplace = u'\u250c'+u'\u2500'*300+u'[CR][B]'+T(32180)+u' %s[/B]'
			self.quoteEndReplace = u'\u2514'+u'\u2500'*300+u'[CR]'
			self.quoteVert = u'\u2502'
			self.hrReplace = u'[COLOR FF808080][B]'+u'\u2500'*300+u'[/B][/COLOR]'
			self.codeStartReplace = u'\u250c'+u'\u2500'*300
			self.codeEndReplace = u'\u2514'+u'\u2500'*300
			self.bullet = u'\u2022'
		else:
			self.imageConvert = self.imageConvertNoMod
			self.imageConvertQuote = self.imageConvertNoModQuote
			self.imageReplaceQuote = 'IMG#{0} '
			if util.getSetting('hide_image_urls',True):
				self.imageReplace = self.imageReplaceQuote
			else:
				self.imageReplace = '[COLOR FFFF0000]I[/COLOR][COLOR FFFF8000]M[/COLOR][COLOR FF00FF00]G[/COLOR][COLOR FF0000FF]#[/COLOR][COLOR FFFF00FF]{0}[/COLOR]: [COLOR FF00AAAA][I]{1}[/I][/COLOR] '
			if util.getSetting('hide_link_urls',True):
				self.linkReplace = u'[COLOR cyan]{1} {0}[/COLOR]'.format('{0}',T(32182))
			else:
				self.linkReplace = u'[COLOR cyan]{0} ({2} [B]{1}[/B])[/COLOR]'.format('{0}','{1}',T(32182))
			self.link2Replace = u'[COLOR cyan]({0} [B]\g<url>[/B])[/COLOR]'.format(T(32182))
			self.quoteStartReplace = u','+u'-'*300+u'[CR][B]'+T(32180)+u' %s[/B]'
			self.quoteEndReplace = u'`'+u'-'*300+u'[CR]'
			self.quoteVert = u'|'
			self.hrReplace = u'[COLOR FF808080][B]'+u'_'*300+u'[/B][/COLOR]'
			self.codeStartReplace = u','+u'-'*300
			self.codeEndReplace = u'`'+u'-'*300
			self.bullet = u'*'
			
		self.userReplace = '@\g<user>'
		self.codeReplace = self.codeStartReplace + '[CR][B][COLOR FF999999]'+T(32183)+r'[/COLOR][/B][CR]%s[CR]' + self.codeEndReplace
		self.phpReplace = self.codeStartReplace + '[CR][B][COLOR FF999999]'+T(32184)+r'[/COLOR][/B][CR]%s[CR]' + self.codeEndReplace
		self.htmlReplace = self.codeStartReplace + '[CR][B][COLOR FF999999]'+T(32185)+r'[/COLOR][/B][CR]%s[CR]' + self.codeEndReplace
Пример #44
0
def linkDevice():
    import xbmcgui
    from lib import pbclient
    from lib import devices

    token = util.getSetting('pb_access_token')

    if not token:
        xbmcgui.Dialog().ok(localise(32068), localise(32069), localise(32070))
        return

    client = pbclient.Client(token)
    deviceMap = {}
    try:
        for d in client.getDevicesList():
            if not d.get('active'): continue
            deviceMap[d['iden']] = d['nickname']
    except pbclient.PushbulletException, e:
        showError(e.message)
        return
Пример #45
0
    def _onFirstInit(self):
        self.resetTimeout()

        self.bigSeekHideTimer = kodigui.PropertyTimer(self._winID, 0.5, 'hide.bigseek')

        if self.handler.playlist:
            self.handler.playlist.on('change', self.updateProperties)

        self.seekbarControl = self.getControl(self.SEEK_IMAGE_ID)
        self.positionControl = self.getControl(self.POSITION_IMAGE_ID)
        self.bifImageControl = self.getControl(self.BIF_IMAGE_ID)
        self.selectionIndicator = self.getControl(self.SELECTION_INDICATOR)
        self.selectionBox = self.getControl(203)
        self.bigSeekControl = kodigui.ManagedControlList(self, self.BIG_SEEK_LIST_ID, 12)
        self.bigSeekGroupControl = self.getControl(self.BIG_SEEK_GROUP_ID)
        self.initialized = True
        self.setBoolProperty('subtitle.downloads', util.getSetting('subtitle_downloads', False))
        self.updateProperties()
        self.videoSettingsHaveChanged()
        self.update()
Пример #46
0
def linkDevice():
    import xbmcgui
    from lib import pbclient
    from lib import devices
    
    token = util.getSetting('pb_access_token')
    
    if not token:
        xbmcgui.Dialog().ok(localise(32068), localise(32069),localise(32070))
        return
        
    client = pbclient.Client(token)
    deviceMap = {}
    try:
        for d in client.getDevicesList():
            if not d.get('active'): continue
            deviceMap[d['iden']] = d['nickname']
    except pbclient.PushbulletException, e:
        showError(e.message)
        return
Пример #47
0
    def startTimer(self):
        if not util.getSetting('post_play_auto', True):
            util.DEBUG_LOG('Post play auto-play disabled')
            return

        if not self.next:
            return

        if time.time() > self.passoutProtection and self.prev.duration.asInt(
        ) > PASSOUT_LAST_VIDEO_DURATION_MILLIS:
            util.DEBUG_LOG('Post play auto-play skipped: Passout protection')
            return
        else:
            millis = (self.passoutProtection - time.time()) * 1000
            util.DEBUG_LOG(
                'Post play auto-play: Passout protection in {0}'.format(
                    util.durationToShortText(millis)))

        util.DEBUG_LOG('Staring post-play timer')
        self.timeout = time.time() + 16
        threading.Thread(target=self.countdown).start()
Пример #48
0
def sectionClicked(section, filter_=None):
    import library
    library.ITEM_TYPE = section.TYPE
    key = section.key
    if not key.isdigit():
        key = section.getLibrarySectionId()
    viewtype = util.getSetting('viewtype.{0}.{1}'.format(
        section.server.uuid, key))
    if section.TYPE in ('artist', 'photo', 'photodirectory'):
        default = library.VIEWS_SQUARE.get(viewtype)
        return handleOpen(library.LibraryWindow,
                          windows=library.VIEWS_SQUARE.get('all'),
                          default_window=default,
                          section=section,
                          filter_=filter_)
    else:
        default = library.VIEWS_POSTER.get(viewtype)
        return handleOpen(library.LibraryWindow,
                          windows=library.VIEWS_POSTER.get('all'),
                          default_window=default,
                          section=section,
                          filter_=filter_)
Пример #49
0
 def _available(cls):
     if cls.broken and util.getSetting('disable_broken_backends', True):
         return False
     return cls.available()
Пример #50
0
 def updateInterval(self):
     if util.getSetting('override_poll_interval',False):
         self.interval = util.getSetting('poll_interval',self.tts.interval)
     else:
         self.interval = self.tts.interval
Пример #51
0
 def checkBackend(self):
     provider = util.getSetting('backend',None)
     if provider == self.backendProvider: return
     self.initTTS()
Пример #52
0
 def get(self):
     return util.getSetting(self.ID, self.default)
Пример #53
0
 def setting(cls, setting):
     """Returns a backend setting, or default if not set
     """
     cls._loadedSettings[setting] = util.getSetting(
         '{0}.{1}'.format(setting, cls.provider), cls.settings.get(setting))
     return cls._loadedSettings[setting]
Пример #54
0
 def checkBackend(self):
     backendSettingID = util.getSetting("default_tts", -1)
     if backendSettingID == self.backendSettingID:
         return
     self.initTTS()
Пример #55
0
 def _available(cls):
     if cls.broken and util.getSetting('disable_broken_backends',True): return False
     return cls.available()
Пример #56
0
 def initTTS(self):
     self.setBackend(backends.getBackend()())
     self.backendSettingID = util.getSetting("default_tts", -1)
     util.LOG("Backend: %s" % self.tts.provider)
Пример #57
0
	def currentVoice(self): return util.getSetting('voice.{0}'.format(self.provider),'')
		
	def close(self): pass
Пример #58
0
 def checkBackend(self):
     provider = util.getSetting('backend',None)
     if provider == self.backendProvider: return
     self.initTTS()
Пример #59
0
 def updateInterval(self):
     if util.getSetting('override_poll_interval',False):
         self.interval = util.getSetting('poll_interval',self.tts.interval)
     else:
         self.interval = self.tts.interval
 def updateFromSettings(self):
     self.last = 0
     self.interval = util.getSetting('background_progress_interval', 5)
     self.playDuringMedia = util.getSetting(
         'speak_background_progress_during_media', False)