示例#1
0
	def openWindowSettings(self):
		d = dialogs.ChoiceMenu('Options')
		d.addItem('settings',util.T(32903))
		d.addItem('back_view',util.T(32580))
		d.addItem('clear_back_view',util.T(32581))
		d.addItem('set_fade',util.T(32582))
		d.addItem('set_selection_color',util.T(32583))
		res = d.getResult()
		if not res: return
		if res == 'back_view':
			val = xbmcgui.Dialog().browse(2,'Choose Image','files','',True,False)
			if not val: return
			setWindowBackgroundImage(val,view=self.viewType)
		elif res == 'clear_back_view':
			setWindowBackgroundImage('',view=self.viewType,clear=True)
		elif res == 'set_fade':
			dialogs.showFadeDialog(view_type=self.viewType)
		elif res == 'set_selection_color':
			image = util.getSetting('window_background_%s' % self.viewType)
			f = util.getSetting('background_fade_%s' % self.viewType, 50)
			val = hex(int((f/100.0)*255))[2:].upper()
			fade = val
			color = util.getSetting('selection_color_%s' % self.viewType, '802080FF')
			color = dialogs.showSelectionColorDialog(start_color=color,preview_image=image,fade=fade)
			setWindowSelectionColors(color,view=self.viewType)
		elif res == 'settings':
			external = True
			if WM.main == self: external = False
			state = self.checkSettings()
			WM.main.openSettings(external=external)
			self.checkSettings(state)
示例#2
0
def setWindowColorsDark(dark=None,view=None):
	if dark == None:
		dark = util.getSetting('window_colors_dark', False)
		for v in VIEW_TYPES:
			d = util.getSetting('window_colors_dark_%s' % v, False)
			dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_dark_%s' % v, d and '1' or '0')
			if d:
				dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_fore_%s' % v, 'FFFFFFFF')
				dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_back_%s' % v, 'FF000000')
			else:
				dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_fore_%s' % v, 'FF000000')
				dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_back_%s' % v, 'FFFFFFFF')
	elif view:
		util.setSetting('window_colors_dark_%s' % view, dark)
		dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_dark_%s' % view, dark and '1' or '0')
		if dark:
			dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_fore_%s' % view, 'FFFFFFFF')
			dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_back_%s' % view, 'FF000000')
		else:
			dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_fore_%s' % view, 'FF000000')
			dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_back_%s' % view, 'FFFFFFFF')
	else:
		util.setSetting('window_colors_dark', dark)
		
	dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_dark', dark and '1' or '0')
	if dark:
		dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_fore', 'FFFFFFFF')
		dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_back', 'FF000000')
	else:
		dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_fore', 'FF000000')
		dialogs.setGlobalSkinProperty('ForumBrowser_window_colors_back', 'FFFFFFFF')
示例#3
0
    def fillSearch(self):
        if LAST_SEARCH: self.keywordsButton.setLabel(LAST_SEARCH)
        lastSection = util.getSetting('search_last_section','')
        lastCountry = util.getSetting('search_last_country','')
        sectionIDX = 0
        countryIDX = 0

        items = []
        ct = 0
        for sid, sname, catID in API.sections:  # @UnusedVariable
            item = xbmcgui.ListItem(label=sname)
            item.setProperty('sectionid',sid)
            items.append(item)
            if sid == lastSection: sectionIDX = ct
            ct+=1
        self.sectionList.addItems(items)
        items = []
        ct = 0
        for c in API.countries:
            item = xbmcgui.ListItem(label=c.get('n',''))
            item.setProperty('flag',c.get('u',''))
            ccode = c.get('c','')
            item.setProperty('country',ccode)
            items.append(item)
            if ccode == lastCountry: countryIDX = ct
            ct+=1
        self.countryList.addItems(items)

        self.sectionList.selectItem(sectionIDX)
        self.countryList.selectItem(countryIDX)
示例#4
0
	def getResult(self,windowFile='script-forumbrowser-image-dialog.xml',select=None,filtering=False,keep_colors=False,selectFirstOnBack=False):
		if util.getSetting('video_pause_on_dialog',True): util.PLAYER.pauseStack()
		w = openWindow(ImageChoiceDialog,windowFile ,return_window=True,theme='Default',menu=self,items=self.items,caption=self.caption,select=select,filtering=filtering,keep_colors=keep_colors,selectFirstOnBack=selectFirstOnBack)
		if util.getSetting('video_pause_on_dialog',True): util.PLAYER.resumeStack()
		result = w.result
		del w
		if result == None: return None
		return self.items[result]['id']
示例#5
0
 def __init__(self,*args,**kwargs):
     kodigui.BaseDialog.__init__(self,*args,**kwargs)
     self.groupID = kwargs.get('group_id')
     self.storageServer = kwargs.get('storage_server')
     self.sortMode = util.getSetting('episodes.sort.mode','AIRDATE')
     self.sortASC = util.getSetting('episodes.sort.asc',True)
     self.play = None
     self.count = 0
示例#6
0
 def getRegistry(self, reg, default=None, sec=None):
     if sec == 'myplex' and reg == 'MyPlexAccount':
         ret = util.getSetting('{0}.{1}'.format(sec, reg), default)
         if ret:
             return ret
         return json.dumps({'authToken': util.getSetting('auth.token')})
     else:
         return util.getSetting('{0}.{1}'.format(sec, reg), default)
示例#7
0
	def getResult(self,close_on_context=True,xml_file=None):
		self.closeContext = close_on_context
		self.hideSplash()
		if util.getSetting('video_pause_on_dialog',True): util.PLAYER.pauseStack()
		idx = self.getChoiceIndex(xml_file)
		if util.getSetting('video_pause_on_dialog',True): util.PLAYER.resumeStack()
		if idx < 0: return None
		if self.items[idx]['disabled']: return None
		return self.items[idx]['id']
示例#8
0
 def getManualConnections(self):
     conns = []
     for i in range(2):
         ip = util.getSetting('manual_ip_{0}'.format(i))
         if not ip:
             continue
         port = util.getSetting('manual_port_{0}'.format(i), 32400)
         conns.append({'connection': ip, 'port': port})
     return json.dumps(conns)
示例#9
0
	def getResult(self,windowFile='script-forumbrowser-options-dialog.xml',select=None,close_on_context=True):
		self.closeContext = close_on_context
		if util.getSetting('video_pause_on_dialog',True): util.PLAYER.pauseStack()
		w = openWindow(ImageChoiceDialog,windowFile,return_window=True,theme='Default',menu=self,items=self.items,caption=self.caption,select=select)
		if util.getSetting('video_pause_on_dialog',True): util.PLAYER.resumeStack()
		result = w.result
		del w
		if result == None: return None
		if self.items[result]['disabled']: return None
		return self.items[result]['id']
示例#10
0
def dialogSelect(heading,ilist,autoclose=0):
	if util.getSetting('video_pause_on_dialog',True): util.PLAYER.pauseStack()
	c = ChoiceMenu(heading)
	i=0
	for disp in ilist:
		c.addItem(i,disp)
		i+=1
	result = c.getResult()
	#result =  xbmcgui.Dialog().select(heading,ilist,autoclose)
	if util.getSetting('video_pause_on_dialog',True): util.PLAYER.resumeStack()
	return result
示例#11
0
def setWindowSlideUp(up=None,view=None):
	if up == None:
		up = util.getSetting('window_slide_up', False)
		for v in VIEW_TYPES:
			u = util.getSetting('window_slide_up_%s' % v, False)
			dialogs.setGlobalSkinProperty('ForumBrowser_window_slide_up_%s' % v, u and '1' or '0')
	else:
		if view:
			util.setSetting('window_slide_up_%s' % view, up)
			dialogs.setGlobalSkinProperty('ForumBrowser_window_slide_up_%s' % view, up and '1' or '0')
		util.setSetting('window_slide_up', up)
	dialogs.setGlobalSkinProperty('ForumBrowser_window_slide_up', up and '1' or '0')
示例#12
0
def setWindowBackgroundImage(image=None,view=None,clear=False,save=True):
	if clear:
		util.setSetting('window_background_%s' % view, '')
		dialogs.setGlobalSkinProperty('ForumBrowser_window_background_%s' % view,'')
		return
	if view == None:
		for v in VIEW_TYPES:
			i = util.getSetting('window_background_%s' % v,'')
			dialogs.setGlobalSkinProperty('ForumBrowser_window_background_%s' % v,i)
	else:
		if not image: image = util.getSetting('window_background_%s' % view,'')
		if save: util.setSetting('window_background_%s' % view, image)
		dialogs.setGlobalSkinProperty('ForumBrowser_window_background_%s' % view,image)
示例#13
0
	def initViewMode(self):
		setID = util.getSetting('selected_device')
		if setID:
			self.viewMode = setID
		else:
			defModeIdx = util.getSetting('default_view_mode',0)
			viewMode = ['SELF','ALL','LAST'][defModeIdx]

			if viewMode == 'LAST':
				last = util.getSetting('last_view_mode')
				self.viewMode = last or 'SELF'
			else:
				self.viewMode = viewMode
示例#14
0
def showMessage(caption,text,text2='',text3='',error=False,success=None,scroll=False):
	if text2: text += '[CR]' + text2
	if text3: text += '[CR]' + text3
	xmlFilename = 'script-forumbrowser-message-dialog.xml'
	THEME = util.getSavedTheme(get_current=True)
	path = xbmc.translatePath(util.__addon__.getAddonInfo('path'))
	theme = 'Default'
	if os.path.exists(os.path.join(path,'resources','skins',THEME,'720p',xmlFilename)): theme = THEME
	w = MessageDialog(xmlFilename ,path,theme,caption=caption,text=text,error=error,success=success,scroll=scroll)
	if util.getSetting('video_pause_on_dialog',True): util.PLAYER.pauseStack()
	w.doModal()
	del w
	if util.getSetting('video_pause_on_dialog',True): util.PLAYER.resumeStack()
示例#15
0
    def initViewMode(self):
        setID = util.getSetting('selected_device')
        if setID:
            self.viewMode = setID
        else:
            defModeIdx = util.getSetting('default_view_mode', 0)
            viewMode = ['SELF', 'ALL', 'LAST'][defModeIdx]

            if viewMode == 'LAST':
                last = util.getSetting('last_view_mode')
                self.viewMode = last or 'SELF'
            else:
                self.viewMode = viewMode
示例#16
0
    def initViewMode(self):
        setID = util.getSetting("selected_device")
        if setID:
            self.viewMode = setID
        else:
            defModeIdx = util.getSetting("default_view_mode", 0)
            viewMode = ["SELF", "ALL", "LAST"][defModeIdx]

            if viewMode == "LAST":
                last = util.getSetting("last_view_mode")
                self.viewMode = last or "SELF"
            else:
                self.viewMode = viewMode
示例#17
0
 def __init__(self,*args,**kwargs):
     BaseWindowDialog.onInit(self)
     self.canceled = True
     self.letter = ''
     self.genre1 = ''
     self.genre2 = ''
     self.genre3 = ''
     self.time = ''
     self.watched = None
     self.genre1Exclude = util.getSetting('filter_last_excludegenre1',False)
     self.genre2Exclude = util.getSetting('filter_last_excludegenre2',False)
     self.genre3Exclude = util.getSetting('filter_last_excludegenre3',False)
     BaseWindowDialog.__init__(self)
示例#18
0
def showActivitySplash(caption=util.T(32248),cancel_stops_connections=False,modal_callback=None):
	if util.getSetting('hide_activity_splash',False):
		s = FakeActivitySplash(caption)
	else:
		s = ActivitySplash(caption,cancel_stops_connections=cancel_stops_connections,modal_callback=modal_callback)
	s.update(0,caption)
	return s
示例#19
0
文件: main.py 项目: camster1/RTOTV
    def fillChannelList(self,update=False):
        last = util.getSetting('last.channel')

        items = []
        current = None
        for channel in self.lineUp.channels.values():
            mli = self.createListItem(channel)
            if not mli: continue

            if last == channel.number:
                current = mli

            items.append(mli)

        if not items:
            return False

        if update:
            self.channelList.replaceItems(items)
        else:
            self.channelList.reset()
            self.channelList.addItems(items)

        if current: self.setCurrent(current)
        return True
示例#20
0
文件: main.py 项目: camster1/RTOTV
    def checkIfUpdated(self):
        lastAPILevel = util.getSetting('API.LEVEL',0)
        util.setSetting('API.LEVEL',API_LEVEL)

        if not lastAPILevel:
            return self.firstRun()
        elif lastAPILevel < 2:
            util.showTextDialog('Info',util.T(32100))
示例#21
0
文件: main.py 项目: camster1/RTOTV
 def getStartChannel(self):
     util.DEBUG_LOG('Found {0} total channels'.format(len(self.lineUp)))
     last = util.getSetting('last.channel')
     if last and last in self.lineUp:
         return self.lineUp[last]
     elif len(self.lineUp):
         return self.lineUp.indexed(0)
     return None
示例#22
0
def checkForSkinMods():
	paths = getPaths()
	skinName = os.path.basename(paths.skinPath)
	LOG('XBMC Skin (In Use): %s %s' % (skinName,paths.versionUsed))
	LOG('XBMC Skin   (Home): %s %s' % (skinName,paths.versionLocal))
	update = False

	if not fontInstalled(paths) and getSetting('font_installed',False):
		installFont()
		LOG('Restoring missing font installation')
		update = True

	if not keyboardInstalled(paths) and getSetting('keyboard_installed',False):
		installKeyboardMod(update=False,paths=paths)
		LOG('Restoring missing keyboard mod installation')
		update = True

	return update
示例#23
0
文件: main.py 项目: camster1/RTOTV
def start():
    util.LOG('Version: {0}'.format(util.ADDON.getAddonInfo('version')))
    util.DEBUG_LOG('Current Kodi skin: {0}'.format(skin.currentKodiSkin()))

    util.setGlobalProperty('guide.full.detail',util.getSetting('guide.full.detail',False) and 'true' or '')
    util.setGlobalProperty('DVR_ENABLED','')
    util.setGlobalProperty('busy','')
    util.setGlobalProperty('window.animations',util.getSetting('window.animations',True) and '1' or '')
    util.setGlobalProperty('search.terms','')

    path = skin.getSkinPath()

    back = BackgroundWindow('script-hdhomerun-view-background.xml',path,'Main','1080i')
    back.show()

    if util.getSetting('touch.mode',False):
        util.setGlobalProperty('touch.mode','true')
        window = GuideOverlayWindow(skin.OVERLAY,path,'Main','1080i')
        window.touchMode = True
    else:
        #player.FullsceenVideoInitializer().start()
        util.setGlobalProperty('touch.mode','')
        window = GuideOverlayDialog(skin.OVERLAY,path,'Main','1080i')

    with util.Cron(5) as window.cron:
        window.doModal()
        window.shutdown()
        window.abort = True
        del window

    threads = threading.enumerate()
    while len(threads) > 1:
        util.DEBUG_LOG('Waiting on {0} threads...'.format(len(threads) - 1))
        threads = threading.enumerate()
        for t in threads:
            if t != threading.currentThread():
                t.join()
                break

    back.doClose()
    del back

    util.DEBUG_LOG('Finished')
示例#24
0
def setWindowSelectionColors(color=None,view=None):
	if not color:
		for v in VIEW_TYPES:
			sc = util.getSetting('selection_color_%s' % v, '802080FF')
			v_nf = dialogs.binascii.hexlify(chr(int(ord(dialogs.binascii.unhexlify(sc[:2])) / 4))) + sc[2:]
			dialogs.setGlobalSkinProperty('ForumBrowser_selection_color_%s' % v,sc)
			dialogs.setGlobalSkinProperty('ForumBrowser_selection_color_nofocus_%s' % v,v_nf)
	else:
		util.setSetting('selection_color_%s' % view, color)
		color_nf = dialogs.binascii.hexlify(chr(int(ord(dialogs.binascii.unhexlify(color[:2])) / 4))) + color[2:]
		dialogs.setGlobalSkinProperty('ForumBrowser_selection_color_%s' % view,color)
		dialogs.setGlobalSkinProperty('ForumBrowser_selection_color_nofocus_%s' % view,color_nf)
示例#25
0
	def setProperties(self):
		self.setProperty('caption',self.caption)
		self.setProperty('message',self.text)
		if self.error:
			self.setProperty('error','error')
		elif self.success is not None:
			if self.success:
				self.setProperty('error','success')
			else:
				self.setProperty('error','warning')
		if self.scroll and not util.getSetting('message_dialog_always_show_ok',False):
			self.setProperty('hidebutton','hidebutton')
示例#26
0
文件: main.py 项目: camster1/RTOTV
    def openDVRWindow(self):
        if not self.hasDVR():
            return

        if (self.dvrWindow and self.dvrWindow.open) or (self.optionsDialog and self.optionsDialog.open):
            return

        if not self.dvrWindow:
            path = skin.getSkinPath()
            if util.getSetting('touch.mode',False):
                self.dvrWindow = dvr.DVRWindow(skin.DVR_WINDOW,path,'Main','1080i',main=self)
            else:
                self.dvrWindow = dvr.DVRDialog(skin.DVR_WINDOW,path,'Main','1080i',main=self)

        self.dvrWindow.modal()

        self.showProgress() #Hide the progress because of re-init triggering <onload>


        if self.dvrWindow.play:
            self.showOverlay(False)
            util.setGlobalProperty('window.animations',util.getSetting('window.animations',True) and '1' or '')

            if isinstance(self.dvrWindow.play, hdhr.storageservers.Recording):
                rec = self.dvrWindow.play
                self.playRecording(rec)
                util.setGlobalProperty('playing.dvr','1')
            else:
                self.playChannelByNumber(self.dvrWindow.play.channelNumber)

            self.dvrWindow.play = None


            return True

        return False
示例#27
0
文件: main.py 项目: camster1/RTOTV
    def start(self):
        if not self.getLineUpAndGuide(): #If we fail to get lineUp, just exit
            self.doClose()
            return

        util.setGlobalProperty('DVR_ENABLED',self.hasDVR() and 'true' or '')
        self.fillChannelList()

        self.player = player.HDHRPlayer().init(self,self.devices,self.touchMode)

        if self.hasDVR() and util.getSetting('dvr.skip.livetv', False):
            return self.windowLoop()

        channel = self.getStartChannel()
        if not channel:
            xbmcgui.Dialog().ok(util.T(32018),util.T(32017),'',util.T(32012))
            self.doClose()
            return

        if self.player.isPlayingHDHR():
            self.fullscreenVideo()
            self.showProgress()
            if self.player.isPlayingRecording():
                util.DEBUG_LOG('HDHR video already playing (recorded)')
                try:
                    url = self.player.url
                    rec = hdhr.storageservers.StorageServers(self.devices).getRecordingByPlayURL(url)
                    self.setCurrent(rec=rec)
                except:
                    util.ERROR()
            else:
                util.DEBUG_LOG('HDHR video already playing (live)')
                self.setCurrent(self.getListItemByChannel(channel))
        else:
            util.DEBUG_LOG('HDHR video not currently playing. Starting channel...')
            self.playChannel(channel)

        self.selectChannel(channel)

        self.cron.registerReceiver(self)

        self.setFocusId(210) #Set focus now that dummy list is ready

        self.checkIfUpdated()
示例#28
0
文件: updater.py 项目: camster1/RTOTV
def updateCore(force=False):
    if not force: return
    import xbmc
    import os, urllib, urllib2
    import tarfile

    util.LOG('Checking for new youtube_dl core version...')

    currentVersion = util.getSetting('core_version')
    try:
        newVersion = urllib2.urlopen(VERSION_URL).read().strip()
        if currentVersion == newVersion:
            util.LOG('Core version up to date')
            return False
    except:
        util.ERROR()
        return False

    util.LOG('Updating youtube_dl core to new version: {0}'.format(newVersion))

    profile = xbmc.translatePath(
        util.ADDON.getAddonInfo('profile')).decode('utf-8')
    archivePath = os.path.join(profile, 'youtube_dl.tar.gz')
    extractedPath = os.path.join(profile, 'youtube-dl')

    try:
        if os.path.exists(extractedPath):
            import shutil
            shutil.rmtree(extractedPath, ignore_errors=True)
            util.LOG('Old version removed')

        urllib.urlretrieve(LATEST_URL, filename=archivePath)
        with tarfile.open(archivePath, mode='r:gz') as tf:
            members = [
                m for m in tf.getmembers()
                if m.name.startswith('youtube-dl/youtube_dl')
            ]  #get just the files from the youtube_dl source directory
            tf.extractall(path=profile, members=members)
    except:
        util.ERROR('Core update FAILED')

    util.LOG('Core update complete')
    return True
示例#29
0
文件: main.py 项目: camster1/RTOTV
    def onFirstInit(self):
        if self.touchMode:
            util.DEBUG_LOG('Touch mode: ENABLED')
            self.setProperty('touch.mode','True')
        else:
            util.DEBUG_LOG('Touch mode: DISABLED')
        self.started = True

        self.propertyTimer = kodigui.PropertyTimer(self._winID,util.getSetting('overlay.timeout',0),'show.overlay','', callback=self.overlayTimerCallback)
        self.currentDetailsTimer = kodigui.PropertyTimer(self._winID,5,'show.current','')
        self.seekBarTimer = kodigui.PropertyTimer(self._winID,5,'show.seekbar','')

        self.channelList = kodigui.ManagedControlList(self,201,3)
        self.currentProgress = self.getControl(250)

        #Add item to dummy list - this list allows right click on video to bring up the context menu
        self.getControl(210).addItem(xbmcgui.ListItem(''))

        self.start()
示例#30
0
def updateCore(force=False):
    if not force: return
    import xbmc
    import os, urllib, urllib2
    import tarfile

    util.LOG('Checking for new youtube_dl core version...')

    currentVersion = util.getSetting('core_version')
    try:
        newVersion = urllib2.urlopen(VERSION_URL).read().strip()
        if currentVersion == newVersion:
            util.LOG('Core version up to date')
            return False
    except:
        util.ERROR()
        return False

    util.LOG('Updating youtube_dl core to new version: {0}'.format(newVersion))

    profile = xbmc.translatePath(util.ADDON.getAddonInfo('profile')).decode('utf-8')
    archivePath = os.path.join(profile,'youtube_dl.tar.gz')
    extractedPath = os.path.join(profile,'youtube-dl')

    try:
        if os.path.exists(extractedPath):
            import shutil
            shutil.rmtree(extractedPath, ignore_errors=True)
            util.LOG('Old version removed')

        urllib.urlretrieve(LATEST_URL,filename=archivePath)
        with tarfile.open(archivePath,mode='r:gz') as tf:
            members = [m for m in tf.getmembers() if m.name.startswith('youtube-dl/youtube_dl')] #get just the files from the youtube_dl source directory
            tf.extractall(path=profile,members=members)
    except:
        util.ERROR('Core update FAILED')

    util.LOG('Core update complete')
    return True
示例#31
0
def openWindow(windowClass,xmlFilename,return_window=False,modal=True,theme=None,*args,**kwargs):
	setGlobalSkinProperty('ForumBrowser_hidePNP',util.getSetting('hide_pnp',False) and '1' or '0') #I set the home window, because that's the only way I know to get it to work before the window displays
	if util.getSetting('hide_pnp',False):
		setGlobalSkinProperty('ForumBrowser_slideUpOnVideo','0')
	else:
		setGlobalSkinProperty('ForumBrowser_slideUpOnVideo',util.getSetting('slide_up_on_video',False) and '1' or '0') #I set the home window, because that's the only way I know to get it to work before the window displays
		
	THEME = util.getSavedTheme(get_current=True)
	path = util.__addon__.getAddonInfo('path')
	res = '720p'
	src = os.path.join(path,'resources','skins',THEME,res,xmlFilename)
	src2 = os.path.join(path,'resources','skins',theme or THEME,res,xmlFilename)
	if os.path.exists(src):
		theme = THEME
	elif not os.path.exists(src2):
		theme = 'Sequel'
		res = '720p'
	rightAlign = util.getSetting('current_right_align',False)
	
	if not util.getSetting('use_skin_mods',True) or not util.getSetting('font_installed',True):
		src = os.path.join(path,'resources','skins',theme,res,xmlFilename)
		skin = os.path.join(xbmc.translatePath(path),'resources','skins',theme,res)
		xml = open(src,'r').read()
		xmlFilename = 'script-forumbrowser-current.xml'
		if rightAlign: xml = rightAlignXML(xml)
		open(os.path.join(skin,xmlFilename),'w').write(mods.replaceFonts(xml))
	elif rightAlign:
		src = os.path.join(path,'resources','skins',theme,res,xmlFilename)
		skin = os.path.join(xbmc.translatePath(path),'resources','skins',theme,res)
		xml = open(src,'r').read()
		xmlFilename = 'script-forumbrowser-current.xml'
		open(os.path.join(skin,xmlFilename),'w').write(rightAlignXML(xml))
		
	w = windowClass(xmlFilename,path,theme,*args,**kwargs)
	if modal:
		w.doModal()
	else:
		w.show()
	if return_window: return w
	del w
	return None
示例#32
0
	def __init__( self, *args, **kwargs ):
		self.viewType = kwargs.get('view_type')
		self.startVal = util.getSetting('background_fade_%s' % self.viewType, 50)
		self.slider = None
示例#33
0
def setWindowBackgroundFades():
	for v in VIEW_TYPES:
		f = util.getSetting('background_fade_%s' % v, 50)
		val = hex(int((f/100.0)*255))[2:].upper()
		dialogs.setGlobalSkinProperty('ForumBrowser_window_background_fade_white_%s' % v,val + 'FFFFFF')
		dialogs.setGlobalSkinProperty('ForumBrowser_window_background_fade_black_%s' % v,val + '000000')
示例#34
0
	def onInit(self):
		BaseWindow.onInit(self)
		self.setProperty('loading','1')
		self._winID = xbmcgui.getCurrentWindowId()
		self.pushList = self.getControl(101)
		token = util.getSetting('token')
		if not token: return
		
		loadVideoThumbs = util.getSetting('load_video_thumbs',False)
		kodiDevice = devices.getDefaultKodiDevice(util.getSetting('device_iden'),util.getSetting('device_name'))
		if not kodiDevice: return
		self.pushes = []
		pushes = self.client.pushes()
		if not pushes: return
		items = []
		cacheIDs = []
		self.pushes = []

		for p in pushes: #Keep all IDs cached so that we don't cause a delay when changing view
			if p.get('active'):
				cacheIDs.append(p.get('iden'))

		if self.viewMode == 'SELF':
			self.pushes = [p for p in pushes if p.get('active') and p.get('target_device_iden') == kodiDevice.ID]
		elif self.viewMode == 'ALL':
			self.pushes = [p for p in pushes if p.get('active')]
		elif self.viewMode:
			self.pushes = [p for p in pushes if p.get('active') and p.get('target_device_iden') == self.viewMode]

		for push in self.pushes:
			iden = push.get('iden')

			title = push.get('title',push.get('name',push.get('file_name','')))
			bg = push.get('image_url','')
			info = push.get('url','')
			mediaIcon = ''
			media = ''

			if push.get('type') == 'address':
				bg = maps.Maps().getMap(urllib.quote(push.get('address','')),'None',marker=True,return_url_only=True)
			elif push.get('type') == 'link':
				url = push.get('url')
				if StreamExtractor.mightHaveVideo(url):
					media = 'video'
					if loadVideoThumbs:
						bg = getCachedData(iden)
						if not bg:
							bg = StreamExtractor.getVideoInfo(url).thumbnail
							cacheData(iden,bg)
				else:
					media = pushhandler.getURLMediaType(url)
				if not title:
					title = url.rsplit('/',1)[-1]
			elif push.get('type') == 'file':
				info = urllib.unquote(push.get('file_url',''))
				if push.get('file_type','').startswith('image/'):
					media = 'image'
				elif push.get('file_type','').startswith('audio/'):
					media = 'music'
				elif push.get('file_type','').startswith('video/'):
					media = 'video'
			if media:
				mediaIcon = 'service-pushbullet-com-icon_{0}.png'.format(media)

			item = xbmcgui.ListItem(title,iconImage='service-pushbullet-com-{0}.png'.format(push.get('type','')))

			desc = push.get('body',push.get('address',''))
			if push.get('type') == 'list':
				li = []
				ct = 0
				for i in push.get('items',[]):
					li.append(i.get('text',''))
					ct+=1
					if ct > 50: break
				desc = ', '.join(li)
			desc = '[CR]'.join(desc.splitlines()[:4])
			item.setProperty('description',desc)
			item.setProperty('info',info)
			item.setProperty('sender', push.get('sender_email',''))
			item.setProperty('media_icon',mediaIcon)
			item.setProperty('background',bg)
			#item.setProperty('date',time.strftime('%m-%d-%Y %H:%M',time.localtime(push.get('created',0))))
			item.setProperty('date','{0} {1}'.format(util.durationToShortText(time.time() - push.get('created',0)),T(32053)))
			items.append(item)

		self.setProperty('loading','0')
		self.pushList.reset()
		self.pushList.addItems(items)

		if items: self.setFocusId(101)
		self.reSelect()
		cleanCache(cacheIDs)
示例#35
0
def _export(results=None,category=None):
    util.initAPI()

    if not results:
        try:
            cats = util.getCollectionCategories(int(category))
            results = util.API.getCollection(categories=cats)
            print repr(category),repr(results), repr(cats)
        except util.bluraycomapi.LoginError: #TODO: Implement with notifiacation
            #error = 'Unknown'
            #if e.error == 'userpass': error = 'Bad Blu-ray.com name or password.'
            #xbmcgui.Dialog().ok('Error','Login Error:','',error)
            return

    tag = u'<tag>{0}</tag>'
    genre = u'<genre>{0}</genre>'
    actor = u'    <actor><name>{name}</name><role>{role}</role><thumb>{thumb}</thumb></actor>\n'
    set_ = u'<set>{0}</set>'

    path = util.getSetting('export_path')
    if not path or not xbmcvfs.exists(path):
        path = xbmcgui.Dialog().browse(3,util.T(32054),'files')
        if not path: return
        util.ADDON.setSetting('export_path',path)
    sep = u'/'
    if '\\' in path: sep = u'\\'
    video = os.path.join(xbmc.translatePath(util.ADDON.getAddonInfo('path')).decode('utf-8'),'resources','video.mp4')
    baseTags = tag.format('blu-ray.com')
    if util.getSetting('export_offline_tag',True):
        baseTags += tag.format('offline')

    genreTable = {}
    for g in util.API.genres: genreTable[g[2]] = g[1]
    catTable = {}
    for c in util.API.categories: catTable[c[0]] = c[1]

    total = float(len(results))
    progress = xbmcgui.DialogProgressBG()
    progress.create(util.T(32051))

    import tmdbsimple as tmdb
    tmdb.API_KEY = '99ccac3e0d7fd2c7a076beea141c1057'
    config = tmdb.Configuration()
    config.info()
    tmdbBaseImageURL = config.images['base_url'] + u'original{0}'
    try:
        for idx,r in enumerate(results):
            progress.update(int((idx/total)*100),r.title,' ')
            if canceled() or xbmc.abortRequested: return

            searchTitle = r.titles[0].replace('3D','').strip()

            cleanTitle = cleanFilename(r.title)

            fanart = ''

            #Write .strm file
            f = xbmcvfs.File(path+sep+u'{0}.strm'.format(cleanTitle),'w')
            f.write(video.encode('utf-8'))
            f.close()

            #Write .nfo file
            if util.getSetting('export_write_nfo',True):
                tags = baseTags
                tags += tag.format(catTable.get(r.categoryID,''))
                if r.is3D: tags += tag.format('3D')

                genres = ''
                for i in r.genreIDs:
                    if i in genreTable:
                        genres += genre.format(genreTable[i])

                actors = ''
                collection = ''
                plot = ''
                if util.getSetting('export_get_tmdb',True):
                    from xml.sax.saxutils import escape

                    progress.update(int((idx/total)*100),r.title,u'TMDB: {0}'.format(searchTitle))
                    search = tmdb.Search()
                    tryTwice(search.movie,query=searchTitle,year=r.year)
                    if canceled() or xbmc.abortRequested: return
                    if not search.results:
                        if ':' in searchTitle:
                            searchTitle = searchTitle.split(':',1)[0]
                            progress.update(int((idx/total)*100),r.title,u'TMDB: {0}'.format(searchTitle))
                            tryTwice(search.movie,query=searchTitle,year=r.year or None)
                            if canceled() or xbmc.abortRequested: return
                    if search.results:
                        movie = tmdb.Movies(search.results[0]['id'])
                        tryTwice(movie.info,append_to_response='credits')
                        if canceled() or xbmc.abortRequested: return
                        fanart = movie.backdrop_path and tmdbBaseImageURL.format(movie.backdrop_path) or ''
                        if movie.belongs_to_collection:
                            collection = set_.format(escape(movie.belongs_to_collection['name']))
                            if r.uniqueMovies:
                                bd = movie.belongs_to_collection['backdrop_path']
                                fanart = bd and tmdbBaseImageURL.format(bd) or fanart
                        for c in movie.credits.get('cast',[]):
                            actors += actor.format(name=escape(c['name']),role=escape(c['character']),thumb=escape(tmdbBaseImageURL.format(c['profile_path'])))
                        plot = movie.overview

                f = xbmcvfs.File(path+sep+u'{0}.nfo'.format(cleanTitle),'w')
                f.write(
                    NFO.format(
                        title=escape(r.title),
                        sort=escape(r.sortTitle or r.title),
                        rating=r.rating.split(' ',1)[-1],
                        #plot=r.description or r.info,
                        path=escape(video),
                        runtime=r.runtime,
                        plot=escape(plot),
                        year=r.year,
                        thumb=escape(r.icon.replace('_medium.','_front.')),
                        fanart=escape(fanart),
                        watched=r.watched and '0' or '',
                        collection=collection,
                        genres=genres,
                        actors=actors,
                        tags=tags
                    ).encode('utf-8')
                )
                f.close()

            fanartOutPath = path+sep+u'{0}-fanart.jpg'.format(cleanTitle)
            if util.getSetting('export_get_fanart',True) and fanart and not xbmcvfs.exists(fanartOutPath):
                progress.update(int((idx/total)*100),r.title,u'Getting fanart')
                f = xbmcvfs.File(fanartOutPath,'w')
                try:
                    r = requests.get(fanart, stream=True)
                    if canceled() or xbmc.abortRequested: return
                    if r.status_code == 200:
                        for chunk in r.iter_content(1024):
                            f.write(chunk)
                finally:
                    f.close()

        #Tag existing movies online
        if util.getSetting('export_offline_tag',True) and util.getSetting('export_online_tag',True):
            progress.update(100,util.T(32052))
            response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": {"properties":["tag"]}, "id": 1}')
            try:
                data = json.loads(response)
                if 'result' in data and 'movies' in data['result']:
                    for i in data['result']['movies']:
                        tags = i['tag']
                        if not 'offline' in tags and not 'online' in tags:
                            tags.append('online')
                            xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params":{"movieid":%s,"tag":%s},"id": 1}' % (i['movieid'],json.dumps(tags)))
            except:
                util.ERROR()
    finally:
        progress.close()

    #Trigger library scan of export path
    if util.getSetting('export_trigger_scan',True):
        xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory":"%s"}, "id": 1}' % path)

    xbmcgui.Dialog().ok(util.T(32048),'',util.T(32053).format(int(total)))
示例#36
0
 def getCollectionCategoriesToShow(self):
     cats = []
     for ID,cat in API.categories:
         if util.getSetting('used_cat_%d' % ID,False): cats.append((ID,cat))
     return cats
示例#37
0
def refreshExported():
    path = util.getSetting('export_path')
    if not path: return
    xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory":"%s"}, "id": 1}' % path)
示例#38
0
	def toggleDark(self):
		val = not util.getSetting('window_colors_dark_%s' % self.viewType, False)
		setWindowColorsDark(val,view=self.viewType)
示例#39
0
	def toggleSlideUp(self):
		val = not util.getSetting('window_slide_up_%s' % self.viewType, False)
		setWindowSlideUp(val,view=self.viewType)
示例#40
0
    def setup(self):
        self.setProperty('excludegenre1',self.genre1Exclude and '1' or '')
        self.setProperty('excludegenre2',self.genre2Exclude and '1' or '')
        self.setProperty('excludegenre3',self.genre3Exclude and '1' or '')

        lastLetter = util.getSetting('filter_last_letter','')
        lastGenre1 = util.getSetting('filter_last_genre1','')
        lastGenre2 = util.getSetting('filter_last_genre2','')
        lastGenre3 = util.getSetting('filter_last_genre3','')
        lastTime = util.getSetting('filter_last_time',0)
        lastWatched = util.getSetting('filter_last_watched','')
        letterIDX = 0
        genre1IDX = 0
        genre2IDX = 0
        genre3IDX = 0
        timeIDX = 0
        watchedIDX = 0

        items = []
        ct=0
        letters = ('','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','U','W','X','Y','Z')
        for letter in letters:
            item = xbmcgui.ListItem(label=letter or '-')
            item.setProperty('letter',letter)
            items.append(item)
            if lastLetter == letter: letterIDX = ct
            ct+=1
        self.letterList.addItems(items)

        items = []
        ct = 0
        for name,label,ID in API.genres:
            item = xbmcgui.ListItem(label=label)
            item.setProperty('id',ID)
            item.setProperty('name',name)
            items.append(item)
            if ID == lastGenre1: genre1IDX = ct
            ct+=1
        self.genre1List.addItems(items)

        items = []
        ct = 0
        for name,label,ID in API.genres:
            item = xbmcgui.ListItem(label=label)
            item.setProperty('id',ID)
            item.setProperty('name',name)
            items.append(item)
            if ID == lastGenre2: genre2IDX = ct
            ct+=1
        self.genre2List.addItems(items)

        items = []
        ct = 0
        for name,label,ID in API.genres:
            item = xbmcgui.ListItem(label=label)
            item.setProperty('id',ID)
            item.setProperty('name',name)
            items.append(item)
            if ID == lastGenre3: genre3IDX = ct
            ct+=1
        self.genre3List.addItems(items)

        times = ((0,'-'),(30,'30 mins'),(45,'45 mins'),(60,'1 hr'),(75,u'1\xbc hrs'),(90,u'1\xbd hrs'),(120,'2 hrs'),(150,u'2\xbd hrs'),(180,'3 hrs'))
        items = []
        ct = 0
        for mins,label in times:
            item = xbmcgui.ListItem(label=label)
            item.setProperty('runtume',str(mins))
            items.append(item)
            if mins == lastTime: timeIDX = ct
            ct+=1
        self.timeList.addItems(items)

        wlist = (('','-'),('0','Unwatched'),('1','Watched'))
        items = []
        ct = 0
        for watched,label in wlist:
            item = xbmcgui.ListItem(label=label)
            item.setProperty('watched',watched)
            items.append(item)
            if watched == lastWatched: watchedIDX = ct
            ct+=1
        self.wathcedList.addItems(items)

        self.letterList.selectItem(letterIDX)
        self.genre1List.selectItem(genre1IDX)
        self.genre2List.selectItem(genre2IDX)
        self.genre3List.selectItem(genre3IDX)
        self.timeList.selectItem(timeIDX)
        self.wathcedList.selectItem(watchedIDX)
示例#41
0
def loadAddonsMD5():
    return util.getSetting('addons_MD5')
示例#42
0
    def shouldAbort(self):
        return xbmc.abortRequested


def abortFlag():
    return util.MONITOR.abortRequested()


plexapp.setTimer(PlexTimer)
plexapp.setAbortFlagFunction(abortFlag)

maxVideoRes = plexapp.Res(
    (3840, 2160)
)  # INTERFACE.globals["supports4k"] and plexapp.Res((3840, 2160)) or plexapp.Res((1920, 1080))

CLIENT_ID = util.getSetting('client.ID')
if not CLIENT_ID:
    CLIENT_ID = str(uuid.uuid4())
    util.setSetting('client.ID', CLIENT_ID)


def defaultUserAgent():
    """Return a string representing the default user agent."""
    _implementation = platform.python_implementation()

    if _implementation == 'CPython':
        _implementation_version = platform.python_version()
    elif _implementation == 'PyPy':
        _implementation_version = '%s.%s.%s' % (sys.pypy_version_info.major,
                                                sys.pypy_version_info.minor,
                                                sys.pypy_version_info.micro)
示例#43
0
    def onInit(self):
        BaseWindow.onInit(self)
        self.setProperty('loading', '1')
        self._winID = xbmcgui.getCurrentWindowId()
        self.pushList = self.getControl(101)
        token = util.getSetting('pb_access_token')
        if not token: return

        loadVideoThumbs = util.getSetting('load_video_thumbs', False)
        kodiDevice = devices.getDefaultKodiDevice(
            util.getSetting('pb_client_iden'),
            util.getSetting('pb_client_nickname'))
        if not kodiDevice: return
        self.pushes = []
        pushes = self.client.pushes()
        if not pushes: return
        items = []
        cacheIDs = []
        self.pushes = []

        for p in pushes:  #Keep all IDs cached so that we don't cause a delay when changing view
            if p.get('active'):
                cacheIDs.append(p.get('iden'))

        if self.viewMode == 'SELF':
            self.pushes = [
                p for p in pushes if p.get('active')
                and p.get('target_device_iden') == kodiDevice.ID
            ]
        elif self.viewMode == 'ALL':
            self.pushes = [p for p in pushes if p.get('active')]
        elif self.viewMode:
            self.pushes = [
                p for p in pushes if p.get('active')
                and p.get('target_device_iden') == self.viewMode
            ]

        for push in self.pushes:
            iden = push.get('iden')

            title = push.get('title',
                             push.get('name', push.get('file_name', '')))
            bg = push.get('image_url', '')
            info = push.get('url', '')
            mediaIcon = ''
            media = ''

            if push.get('type') == 'address':
                bg = maps.Maps().getMap(urllib.quote(push.get('address', '')),
                                        'None',
                                        marker=True,
                                        return_url_only=True)
            elif push.get('type') == 'link':
                url = push.get('url')
                if StreamExtractor.mightHaveVideo(url):
                    media = 'video'
                    if loadVideoThumbs:
                        bg = getCachedData(iden)
                        if not bg:
                            bg = StreamExtractor.getVideoInfo(url).thumbnail
                            cacheData(iden, bg)
                else:
                    media = pushhandler.getURLMediaType(url)
                if not title:
                    title = url.rsplit('/', 1)[-1]
            elif push.get('type') == 'file':
                info = urllib.unquote(push.get('file_url', ''))
                if push.get('file_type', '').startswith('image/'):
                    media = 'image'
                elif push.get('file_type', '').startswith('audio/'):
                    media = 'music'
                elif push.get('file_type', '').startswith('video/'):
                    media = 'video'
            if media:
                mediaIcon = 'service-pushbullet-com-icon_{0}.png'.format(media)

            item = xbmcgui.ListItem(
                title,
                iconImage='service-pushbullet-com-{0}.png'.format(
                    push.get('type', '')))

            desc = push.get('body', push.get('address', ''))
            if push.get('type') == 'list':
                li = []
                ct = 0
                for i in push.get('items', []):
                    li.append(i.get('text', ''))
                    ct += 1
                    if ct > 50: break
                desc = ', '.join(li)
            desc = '[CR]'.join(desc.splitlines()[:4])
            item.setProperty('description', desc)
            item.setProperty('info', info)
            item.setProperty(
                'sender', push.get('sender_name', push.get('sender_email',
                                                           '')))
            item.setProperty('media_icon', mediaIcon)
            item.setProperty('background', bg)
            #item.setProperty('date',time.strftime('%m-%d-%Y %H:%M',time.localtime(push.get('created',0))))
            item.setProperty(
                'date', '{0} {1}'.format(
                    util.durationToShortText(time.time() -
                                             push.get('created', 0)),
                    T(32053)))
            items.append(item)

        self.setProperty('loading', '0')
        self.pushList.reset()
        self.pushList.addItems(items)

        if items: self.setFocusId(101)
        self.reSelect()
        cleanCache(cacheIDs)
示例#44
0
def applyNetworkSettings ():

    interface = util.getSetting('interface')
    essid = util.getSetting('essid')
    oldEssid = util.getSetting('old_essid')
    psk = util.getSetting('psk')
    encryption = util.getSetting('encryption')
    useDHCP = util.getSetting('dhcp')
    ipAddress = util.getSetting('ipaddress')
    subnetMask = util.getSetting('subnet')
    gateway = util.getSetting('gateway')

    util.DEBUG('interface={}, essid={}, encryption={}, psk={}, dhcp={}, ipaddress={}, subnetmask={}, gateway={}'.format (interface, essid, encryption, psk, useDHCP, ipAddress, subnetMask, gateway))
    util.DEBUG('old_essid={}, psk_backup={}'.format(oldEssid, util.getSetting('psk_backup')))

    localTempPath = '/tmp/'

    # 0 .. eth0
    # 1 .. wlan0

    interfaceName = ''
    if interface == '0':
        interfaceName = 'eth0'

        networkConfigPath = '/etc/systemd/network/'
        backupConfigPathFilename = '{}_backup_-{}._etwor_.backup'.format (networkConfigPath, interfaceName)
        configFilename = '{}.network'.format (interfaceName)
        localConfigPathFilename = '{}{}'.format (localTempPath, configFilename)
        networkConfigPathFilename = '{}{}'.format (networkConfigPath, configFilename)

        # create new config file...
        file = open (localConfigPathFilename, 'w')
        file.write ('[Match]\n')
        file.write ('Name={}\n'.format(interfaceName))
        file.write ('\n')
        file.write ('[Network]\n')

        # if DHCP -> start dhcp
        # else set fixed route
        if useDHCP.lower() == 'true':
            file.write ('DHCP=both\n')
        else:
            file.write ('DNS={}\n'.format(gateway))
            file.write ('Address={}/{}\n'.format(ipAddress, util.calcNetSize(subnetMask)))
            file.write ('Gateway={}\n'.format(gateway))
            pass

        file.write('\n')
        file.close()

        # backup and replace config file...
        try:
            util.execShell('sudo rm {}'.format (backupConfigPathFilename))
        except:
            util.DEBUG("removing of {} failed...".format(backupConfigPathFilename))

        try:
            util.execShell('sudo mv -v {} {}'.format (networkConfigPathFilename, backupConfigPathFilename))
        except:
            util.DEBUG("backing {} up to {} failed...".format(networkConfigPathFilename, backupConfigPathFilename))

        util.execShell('sudo mv -v {} {}'.format (localConfigPathFilename, networkConfigPathFilename))
        util.execShell('sudo chown -v root:root {}'.format (networkConfigPathFilename))

    else:
        interfaceName = 'wlan0'

        networkConfigPath = '/etc/netctl/'
        backupConfigPathFilename = '{}_backup_-{}-{}._backup'.format (networkConfigPath, interfaceName, essid)
        configFilename = '{}-{}'.format (interfaceName, essid)
        if oldEssid == "":
            oldConfigFilename = ''
        else:
            oldConfigFilename = '{}-{}'.format (interfaceName, oldEssid)
        localConfigPathFilename = '{}{}'.format (localTempPath, configFilename)
        networkConfigPathFilename = '{}{}'.format (networkConfigPath, configFilename)

        # create new config file...
        file = open (localConfigPathFilename, 'w')

        file.write ("Description='Created by script.module.netmgr'\n")
        file.write ("Interface={}\n".format(interfaceName))
        file.write ("Connection=wireless\n")

        security = 'none'
        if encryption == '1':
            security = 'wep'
        elif encryption == '2':
            security = 'wpa'
        file.write ("Security={}\n".format(security))
        file.write ("ESSID={}\n".format (essid))

        ip = 'dhcp'
        if useDHCP == 'false':
            ip = 'static'

        file.write ("IP={}\n".format(ip))

        if useDHCP == 'false':
            file.write("Address='{}/{}'\n".format(ipAddress, util.calcNetSize(subnetMask)))
            file.write("Gateway='{}'\n".format(gateway))
            file.write("DNS=('{}')\n".format(gateway))

        if encryption != '0':
            file.write ("Key={}\n".format(psk))

        file.write('\n')
        file.close()

        # Disable profile (just in case...)
        try:
            util.execShell('sudo systemctl reset-failed')
        except:
            util.DEBUG("call 'systemctl reset-failed' failed...".format(configFilename))

        try:
            util.execShell('sudo netctl disable {}'.format (configFilename))
        except:
            util.DEBUG("disabling of netctl {} failed...".format(configFilename))

        try:
            util.execShell('sudo netctl disable {}'.format (oldConfigFilename))
        except:
            util.DEBUG("disabling of netctl {} failed...".format(oldConfigFilename))

        # backup and replace config file...
        try:
            util.execShell('sudo rm {}'.format (backupConfigPathFilename))
        except:
            util.DEBUG("removing of {} failed...".format(backupConfigPathFilename))

        try:
            util.execShell('sudo mv -v {} {}'.format (networkConfigPathFilename, backupConfigPathFilename))
        except:
            util.DEBUG("backing {} up to {} failed...".format(networkConfigPathFilename, backupConfigPathFilename))

        util.execShell('sudo mv -v {} {}'.format (localConfigPathFilename, networkConfigPathFilename))
        util.execShell('sudo chown -v root:root {}'.format (networkConfigPathFilename))
        util.execShell('sudo chmod -v 600 {}'.format (networkConfigPathFilename))

        # util.execShell('sudo netctl start {}'.format (configFilename))
        util.execShell('sudo netctl enable {}'.format (configFilename))

        # save essid als old_essid
        util.setSetting('old_essid', essid)

    # save password
    util.setSetting("psk_backup", util.getSetting("psk"))
    # remove password from storage...
    util.setSetting("psk", "")

    # reboot the system
    util.execShell('sudo reboot')
示例#45
0
 def getPreference(self, pref, default=None):
     if pref == 'manual_connections':
         return self.getManualConnections()
     else:
         return util.getSetting(pref, default)
示例#46
0
def alignChanged():
	if util.getSetting('current_right_align',False) != util.getSetting('last_right_align',False):
		util.setSetting('last_right_align',util.getSetting('current_right_align',False))
		return True
	return False
示例#47
0
 def getArgs(self):
     transcode = TRANSCODE_PROFILES[util.getSetting('transcode', 0)]
     if not transcode: return ''
     return '?transcode=' + transcode
示例#48
0
文件: main.py 项目: camster1/RTOTV
 def doClose(self):
     self._BASE.doClose(self)
     if util.getSetting('exit.stops.player',True):
         xbmc.executebuiltin('PlayerControl(Stop)') #self.player.stop() will crash kodi (after a guide list reset at least)
     else:
         if xbmc.getCondVisibility('Window.IsActive(fullscreenvideo)'): xbmc.executebuiltin('Action(back)')