Esempio n. 1
0
def purgeDb():
    DB = []
    display = []
    for dirpath, dirnames, files in os.walk(HOME):
        for f in fnmatch.filter(files, '*.db'):
            if f != 'Thumbs.db':
                found = os.path.join(dirpath, f)
                DB.append(found)
                dir = found.replace('\\', '/').split('/')
                display.append('(%s) %s' %
                               (dir[len(dir) - 2], dir[len(dir) - 1]))
    if KODIV >= 16:
        choice = DIALOG.multiselect(
            "[COLOR %s]Select DB File to Purge[/COLOR]" % COLOR2, display)
        if choice == None:
            wiz.LogNotify("[COLOR %s]Purge Database[/COLOR]" % COLOR1,
                          "[COLOR %s]Cancelled[/COLOR]" % COLOR2)
        elif len(choice) == 0:
            wiz.LogNotify("[COLOR %s]Purge Database[/COLOR]" % COLOR1,
                          "[COLOR %s]Cancelled[/COLOR]" % COLOR2)
        else:
            for purge in choice:
                wiz.purgeDb(DB[purge])
    else:
        choice = DIALOG.select(
            "[COLOR %s]Select DB File to Purge[/COLOR]" % COLOR2, display)
        if choice == -1:
            wiz.LogNotify("[COLOR %s]Purge Database[/COLOR]" % COLOR1,
                          "[COLOR %s]Cancelled[/COLOR]" % COLOR2)
        else:
            wiz.purgeDb(DB[purge])
Esempio n. 2
0
def viewLogFile():
    mainlog = wiz.Grab_Log(True)
    oldlog = wiz.Grab_Log(True, True)
    which = 0
    logtype = mainlog
    if not oldlog == False and not mainlog == False:
        which = DIALOG.select(ADDONTITLE, [
            "View %s" % mainlog.replace(LOG, ""),
            "View %s" % oldlog.replace(LOG, "")
        ])
        if which == -1:
            wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                          '[COLOR %s]View Log Cancelled![/COLOR]' % COLOR2)
            return
    elif mainlog == False and oldlog == False:
        wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                      '[COLOR %s]No Log File Found![/COLOR]' % COLOR2)
        return
    elif not mainlog == False:
        which = 0
    elif not oldlog == False:
        which = 1

    logtype = mainlog if which == 0 else oldlog
    msg = wiz.Grab_Log(False) if which == 0 else wiz.Grab_Log(False, True)

    wiz.TextBox("%s - %s" % (ADDONTITLE, logtype), msg)
def updateAlluc(do, who):
    file = ALLUCID[who]['file']
    settings = ALLUCID[who]['settings']
    data = ALLUCID[who]['data']
    addonid = wiz.addonId(ALLUCID[who]['plugin'])
    saved = ALLUCID[who]['saved']
    default = ALLUCID[who]['default']
    user = addonid.getSetting(default)
    suser = wiz.getS(saved)
    name = ALLUCID[who]['name']
    icon = ALLUCID[who]['icon']

    if do == 'update':
        if not user == '':
            try:
                with open(file, 'w') as f:
                    for alluc in data:
                        f.write(
                            '<alluc>\n\t<id>%s</id>\n\t<value>%s</value>\n</alluc>\n'
                            % (alluc, addonid.getSetting(alluc)))
                    f.close()
                user = addonid.getSetting(default)
                wiz.setS(saved, user)
                wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                              '[COLOR %s]Alluc Data: Saved![/COLOR]' % COLOR2,
                              2000, icon)
            except Exception, e:
                wiz.log(
                    "[Alluc Data] Unable to Update %s (%s)" % (who, str(e)),
                    xbmc.LOGERROR)
        else:
            wiz.LogNotify(
                "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                '[COLOR %s]Alluc Data: Not Registered![/COLOR]' % COLOR2, 2000,
                icon)
Esempio n. 4
0
def updateDebrid(do, who):
    file = DEBRIDID[who]['file']
    settings = DEBRIDID[who]['settings']
    data = DEBRIDID[who]['data']
    addonid = wiz.addonId(DEBRIDID[who]['plugin'])
    saved = DEBRIDID[who]['saved']
    default = DEBRIDID[who]['default']
    user = addonid.getSetting(default)
    suser = wiz.getS(saved)
    name = DEBRIDID[who]['name']
    icon = DEBRIDID[who]['icon']

    if do == 'update':
        if not user == '':
            try:
                with open(file, 'w') as f:
                    for debrid in data:
                        f.write(
                            '<debrid>\n\t<id>%s</id>\n\t<value>%s</value>\n</debrid>\n'
                            % (debrid, addonid.getSetting(debrid)))
                    f.close()
                user = addonid.getSetting(default)
                wiz.setS(saved, user)
                wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                              '[COLOR %s]Debrid Info: Saved![/COLOR]' % COLOR2,
                              2000, icon)
            except Exception, e:
                wiz.log(
                    "[Debrid Info] Unable to Update %s (%s)" % (who, str(e)),
                    xbmc.LOGERROR)
        else:
            wiz.LogNotify(
                "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                '[COLOR %s]Debrid Info: Not Registered![/COLOR]' % COLOR2,
                2000, icon)
def clearSaved(who):
	if who == 'all':
		for trakt in TRAKTID:
			file = TRAKTID[trakt]['file']
			if os.path.exists(file): os.remove(file)
			wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, TRAKTID[trakt]['name']),'[COLOR %s]Trakt Data: Removed![/COLOR]' % COLOR2, 2000, TRAKTID[trakt]['icon'])
	elif TRAKTID[who]:
		file = TRAKTID[who]['file']
		if os.path.exists(file): os.remove(file)
		wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, TRAKTID[who]['name']),'[COLOR %s]Trakt Data: Removed![/COLOR]' % COLOR2, 2000, TRAKTID[who]['icon'])
	wiz.refresh()
Esempio n. 6
0
def clearSaved(who):
	if who == 'all':
		for debrid in DEBRIDID:
			file = DEBRIDID[debrid]['file']
			if os.path.exists(file): os.remove(file)
			wiz.LogNotify('[COLOR %s]%s[/COLOR]' % (COLOR1, DEBRIDID[debrid]['name']),'[COLOR %s]Real Debrid Data: Removed![/COLOR]' % COLOR2, 2000, DEBRIDID[debrid]['icon'])
	elif DEBRIDID[who]:
		file = DEBRIDID[who]['file']
		if os.path.exists(file): os.remove(file)
		wiz.LogNotify('[COLOR %s]%s[/COLOR]' % (COLOR1, DEBRIDID[who]['name']),'[COLOR %s]Real Debrid Data: Removed![/COLOR]' % COLOR2, 2000, DEBRIDID[who]['icon'])
	wiz.refresh()
Esempio n. 7
0
def clearSaved(who):
	if who == 'all':
		for trakt in TRAKTID:
			file = TRAKTID[trakt]['file']
			if os.path.exists(file): os.remove(file)
			wiz.LogNotify(TRAKTID[trakt]['name'],'Trakt Data: [COLOR green]Removed![/COLOR]', 2000, TRAKTID[trakt]['icon'])
	elif TRAKTID[who]:
		file = TRAKTID[who]['file']
		if os.path.exists(file): os.remove(file)
		wiz.LogNotify(TRAKTID[who]['name'],'Trakt Data: [COLOR green]Removed![/COLOR]', 2000, TRAKTID[who]['icon'])
	xbmc.executebuiltin('Container.Refresh')
Esempio n. 8
0
def clearSaved(who):
	if who == 'all':
		for login in LOGINID:
			file = LOGINID[login]['file']
			if os.path.exists(file): os.remove(file)
			wiz.LogNotify(LOGINID[login]['name'],'Login Data: [COLOR green]Removed![/COLOR]', 2000, LOGINID[login]['icon'])
	elif LOGINID[who]:
		file = LOGINID[who]['file']
		if os.path.exists(file): os.remove(file)
		wiz.LogNotify(LOGINID[who]['name'],'Login Data: [COLOR green]Removed![/COLOR]', 2000, LOGINID[who]['icon'])
	xbmc.executebuiltin('Container.Refresh')
Esempio n. 9
0
def clearSaved(who):
    if who == 'all':
        for debrid in DEBRIDID:
            file = DEBRIDID[debrid]['file']
            if os.path.exists(file): os.remove(file)
            wiz.LogNotify(DEBRIDID[debrid]['name'],
                          'Real Debrid Data: [COLOR green]Removed![/COLOR]',
                          2000, DEBRIDID[debrid]['icon'])
    elif DEBRIDID[who]:
        file = DEBRIDID[who]['file']
        if os.path.exists(file): os.remove(file)
        wiz.LogNotify(DEBRIDID[who]['name'],
                      'Real Debrid Data: [COLOR green]Removed![/COLOR]', 2000,
                      DEBRIDID[who]['icon'])
    xbmc.executebuiltin('Container.Refresh')
Esempio n. 10
0
def toggleCache(state):
    cachelist = [
        'includevideo', 'includeall', 'includebob', 'includebobp',
        'includephoenix', 'includespecto', 'includespectos', 'includegenesis',
        'includeexodus', 'includeexodusp', 'includeonechan', 'includesalts',
        'includesaltslite'
    ]
    titlelist = [
        'Include Video Addons', 'Include All Addons', 'Include BobP',
        'Include Bob', 'Include Phoenix', 'Include Specto', 'Include SpectoS',
        'Include Genesis', 'Include Exodus', 'Include ExodusP',
        'Include One Channel', 'Include Salts', 'Include Salts Lite HD'
    ]
    if state in ['true', 'false']:
        for item in cachelist:
            wiz.setS(item, state)
    else:
        if not state in ['includevideo', 'includeall'
                         ] and wiz.getS('includeall') == 'true':
            try:
                item = titlelist[cachelist.index(state)]
                DIALOG.ok(
                    ADDONTITLE,
                    "[COLOR %s]You will need to turn off [COLOR %s]Include All Addons[/COLOR] to disable[/COLOR] [COLOR %s]%s[/COLOR]"
                    % (COLOR2, COLOR1, COLOR1, item))
            except:
                wiz.LogNotify(
                    "[COLOR %s]Toggle Cache[/COLOR]" % COLOR1,
                    "[COLOR %s]Invalid id: %s[/COLOR]" % (COLOR2, state))
        else:
            new = 'true' if wiz.getS(state) == 'false' else 'false'
            wiz.setS(state, new)
Esempio n. 11
0
def clearSaved(who):
    if who == 'all':
        for login in LOGINID:
            file = LOGINID[login]['file']
            if os.path.exists(file): os.remove(file)
            wiz.LogNotify(
                '[COLOR %s]%s[/COLOR]' % (COLOR1, LOGINID[login]['name']),
                '[COLOR %s]Login Data: Removed![/COLOR]' % COLOR2, 2000,
                LOGINID[login]['icon'])
    elif LOGINID[who]:
        file = LOGINID[who]['file']
        if os.path.exists(file): os.remove(file)
        wiz.LogNotify('[COLOR %s]%s[/COLOR]' % (COLOR1, LOGINID[who]['name']),
                      '[COLOR %s]Login Data: Removed![/COLOR]' % COLOR2, 2000,
                      LOGINID[who]['icon'])
    wiz.refresh()
Esempio n. 12
0
def updateTrakt(do, who):
	file      = TRAKTID[who]['file']
	settings  = TRAKTID[who]['settings']
	data      = TRAKTID[who]['data']
	addonid   = wiz.addonId(TRAKTID[who]['plugin'])
	saved     = TRAKTID[who]['saved']
	default   = TRAKTID[who]['default']
	user      = addonid.getSetting(default)
	suser     = wiz.getS(saved)
	name      = TRAKTID[who]['name']
	icon      = TRAKTID[who]['icon']

	if do == 'update':
		if not user == '':
			with open(file, 'w') as f:
				for trakt in data: f.write('<trakt>\n\t<id>%s</id>\n\t<value>%s</value>\n</trakt>\n' % (trakt, addonid.getSetting(trakt)))
			f.close()
			user = addonid.getSetting(default)
			wiz.setS(saved, user)
			wiz.LogNotify(name,'Trakt Data: [COLOR green]Saved![/COLOR]', 2000, icon)
		else: wiz.LogNotify(name,'Trakt Data: [COLOR red]Not Registered![/COLOR]', 2000, icon)
	elif do == 'restore':
		if os.path.exists(file):
			f = open(file,mode='r'); g = f.read().replace('\n','').replace('\r','').replace('\t',''); f.close();
			match = re.compile('<trakt><id>(.+?)</id><value>(.+?)</value></trakt>').findall(g)
			if len(match) > 0:
				for trakt, value in match:
					addonid.setSetting(trakt, value)
			user = addonid.getSetting(default)
			wiz.setS(saved, user)
			wiz.LogNotify(name,'Trakt: [COLOR green]Restored![/COLOR]', 2000, icon)
		#else: wiz.LogNotify(name,'Trakt Data: [COLOR red]Not Found![/COLOR]', 2000, icon)
	elif do == 'clearaddon':
		wiz.log('%s SETTINGS: %s' % (name, settings))
		if os.path.exists(settings):
			f = open(set,"r"); lines = f.readlines(); f.close()
			f = open(settings,"w")
			for line in lines:
				match = re.compile('<setting.+?id="(.+?)".+?/>').findall(line)
				if len(match) == 0: f.write(line)
				elif match[0] not in data: f.write(line)
				else: wiz.log('Removing Line: %s' % line)
			f.close()
			wiz.LogNotify(name,'Addon Data: [COLOR green]Cleared![/COLOR]', 2000, icon)
		else: wiz.LogNotify(name,'Addon Data: [COLOR red]Clear Failed![/COLOR]', 2000, icon)
	xbmc.executebuiltin('Container.Refresh')
Esempio n. 13
0
def updateDebrid(do, who):
	file      = DEBRIDID[who]['file']
	settings  = DEBRIDID[who]['settings']
	data      = DEBRIDID[who]['data']
	addonid   = wiz.addonId(DEBRIDID[who]['plugin'])
	saved     = DEBRIDID[who]['saved']
	default   = DEBRIDID[who]['default']
	user      = addonid.getSetting(default)
	suser     = wiz.getS(saved)
	name      = DEBRIDID[who]['name']
	icon      = DEBRIDID[who]['icon']

	if do == 'update':
		if not user == '':
			with open(file, 'w') as f:
				for debrid in data: f.write('<debrid>\n\t<id>%s</id>\n\t<value>%s</value>\n</debrid>\n' % (debrid, addonid.getSetting(debrid)))
			f.close()
			user = addonid.getSetting(default)
			wiz.setS(saved, user)
			wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Real Debrid Data: Saved![/COLOR]' % COLOR2, 2000, icon)
		else: wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Real Debrid Data: Not Registered![/COLOR]' % COLOR2, 2000, icon)
	elif do == 'restore':
		if os.path.exists(file):
			f = open(file,mode='r'); g = f.read().replace('\n','').replace('\r','').replace('\t',''); f.close();
			match = re.compile('<debrid><id>(.+?)</id><value>(.+?)</value></debrid>').findall(g)
			if len(match) > 0:
				for debrid, value in match:
					addonid.setSetting(debrid, value)
			user = addonid.getSetting(default)
			wiz.setS(saved, user)
			wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Real Debrid: Restored![/COLOR]' % COLOR2, 2000, icon)
		#else: wiz.LogNotify(name,'Real Debrid Data: [COLOR red]Not Found![/COLOR]', 2000, icon)
	elif do == 'clearaddon':
		wiz.log('%s SETTINGS: %s' % (name, settings), xbmc.LOGDEBUG)
		if os.path.exists(settings):
			f = open(settings,"r"); lines = f.readlines(); f.close()
			f = open(settings,"w")
			for line in lines:
				match = re.compile('<setting.+?id="(.+?)".+?/>').findall(line)
				if len(match) == 0: f.write(line)
				elif match[0] not in data: f.write(line)
				else: wiz.log('[Debrid Clear Addon] Removing Line: %s' % line, xbmc.LOGNOTICE)
			f.close()
			wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Addon Data: Cleared![/COLOR]' % COLOR2, 2000, icon)
		else: wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Addon Data: Clear Failed![/COLOR]' % COLOR2, 2000, icon)
	wiz.refresh()
Esempio n. 14
0
def clearSaved(who, over=False):
	if who == 'all':
		for login in LOGINID:
			clearSaved(login,  True)
	elif LOGINID[who]:
		file = LOGINID[who]['file']
		if os.path.exists(file):
			os.remove(file)
			wiz.LogNotify('[COLOR %s]%s[/COLOR]' % (COLOR1, LOGINID[who]['name']), '[COLOR %s]API Key: Removed![/COLOR]' % COLOR2, 2000, LOGINID[who]['icon'])
		wiz.setS(LOGINID[who]['saved'], '')
	if over == False: wiz.refresh()
Esempio n. 15
0
def clearSaved(who, over=False):
	if who == 'all':
		for alluc in ALLUCID:
			clearSaved(alluc,  True)
	elif ALLUCID[who]:
		file = ALLUCID[who]['file']
		if os.path.exists(file):
			os.remove(file)
			wiz.LogNotify('[COLOR %s]%s[/COLOR]' % (COLOR1, ALLUCID[who]['name']),'[COLOR %s]Alluc Data: Removed![/COLOR]' % COLOR2, 2000, ALLUCID[who]['icon'])
		wiz.setS(ALLUCID[who]['saved'], '')
	if over == False: wiz.refresh()
Esempio n. 16
0
def clearSaved(who, over=False):
	if who == 'all':
		for debrid in DEBRIDID:
			clearSaved(debrid,  True)
	elif DEBRIDID[who]:
		file = DEBRIDID[who]['file']
		if os.path.exists(file):
			os.remove(file)
			wiz.LogNotify('[COLOR %s]%s[/COLOR]' % (COLOR1, DEBRIDID[who]['name']),'[COLOR %s]Real Debrid Data: Removed![/COLOR]' % COLOR2, 2000, DEBRIDID[who]['icon'])
		wiz.setS(DEBRIDID[who]['saved'], '')
	if over == False: wiz.refresh()
def checkSkin():
	wiz.log("[Build Check] Invalid Skin Check Start")
	DEFAULTSKIN   = wiz.getS('defaultskin')
	DEFAULTNAME   = wiz.getS('defaultskinname')
	DEFAULTIGNORE = wiz.getS('defaultskinignore')
	gotoskin = False
	if not DEFAULTSKIN == '':
		if os.path.exists(os.path.join(ADDONS, DEFAULTSKIN)):
			if DIALOG.yesno(ADDONTITLE, "[COLOR %s]It seems that the skin has been set back to [COLOR %s]%s[/COLOR]" % (COLOR2, COLOR1, SKIN[5:].title()), "Would you like to set the skin back to:[/COLOR]", '[COLOR %s]%s[/COLOR]' % (COLOR1, DEFAULTNAME)):
				gotoskin = DEFAULTSKIN
				gotoname = DEFAULTNAME
			else: wiz.log("Skin was not reset", xbmc.LOGNOTICE); wiz.setS('defaultskinignore', 'true'); gotoskin = False
		else: wiz.setS('defaultskin', ''); wiz.setS('defaultskinname', ''); DEFAULTSKIN = ''; DEFAULTNAME = ''
	if DEFAULTSKIN == '':
		skinname = []
		skinlist = []
		for folder in glob.glob(os.path.join(ADDONS, 'skin.*/')):
			xml = "%s/addon.xml" % folder
			if os.path.exists(xml):
				f  = open(xml,mode='r'); g = f.read().replace('\n','').replace('\r','').replace('\t',''); f.close();
				match  = wiz.parseDOM(g, 'addon', ret='id')
				match2 = wiz.parseDOM(g, 'addon', ret='name')
				wiz.log("%s: %s" % (folder, str(match[0])), xbmc.LOGNOTICE)
				if len(match) > 0: skinlist.append(str(match[0])); skinname.append(str(match2[0]))
				else: wiz.log("ID not found for %s" % folder, xbmc.LOGNOTICE)
			else: wiz.log("ID not found for %s" % folder, xbmc.LOGNOTICE)
		if len(skinlist) > 0:
			if len(skinlist) > 1:
				if DIALOG.yesno(ADDONTITLE, "[COLOR %s]It seems that the skin has been set back to [COLOR %s]%s[/COLOR]" % (COLOR2, COLOR1, SKIN[5:].title()), "Would you like to view a list of avaliable skins?[/COLOR]"):
					choice = DIALOG.select("Select skin to switch to!", skinname)
					if choice == -1: wiz.log("Skin was not reset", xbmc.LOGNOTICE); wiz.setS('defaultskinignore', 'true')
					else: 
						gotoskin = skinlist[choice]
						gotoname = skinname[choice]
				else: wiz.log("Skin was not reset", xbmc.LOGNOTICE); wiz.setS('defaultskinignore', 'true')
			else:
				if DIALOG.yesno(ADDONTITLE, "[COLOR %s]It seems that the skin has been set back to [COLOR %s]%s[/COLOR]" % (COLOR2, COLOR1, SKIN[5:].title()), "Would you like to set the skin back to:[/COLOR]", '[COLOR %s]%s[/COLOR]' % (COLOR1, skinname[0])):
					gotoskin = skinlist[0]
					gotoname = skinname[0]
				else: wiz.log("Skin was not reset", xbmc.LOGNOTICE); wiz.setS('defaultskinignore', 'true')
		else: wiz.log("No skins found in addons folder.", xbmc.LOGNOTICE); wiz.setS('defaultskinignore', 'true'); gotoskin = False
	if gotoskin:
		skinSwitch.swapSkins(gotoskin)
		x = 0
		xbmc.sleep(1000)
		while not xbmc.getCondVisibility("Window.isVisible(yesnodialog)") and x < 150:
			x += 1
			xbmc.sleep(200)

		if xbmc.getCondVisibility("Window.isVisible(yesnodialog)"):
			wiz.ebi('SendClick(11)')
			wiz.lookandFeelData('restore')
		else: wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE),'[COLOR %s]Skin Swap Timed Out![/COLOR]' % COLOR2)
	wiz.log("[Build Check] Invalid Skin Check End", xbmc.LOGNOTICE)
Esempio n. 18
0
def clearSaved(who, over=False):
	if who == 'all':
		for trakt in TRAKTID:
			clearSaved(trakt,  True)
	elif TRAKTID[who]:
		file = TRAKTID[who]['file']
		if os.path.exists(file):
			os.remove(file)
			wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, TRAKTID[who]['name']),'[COLOR %s]Trakt Data: Removed![/COLOR]' % COLOR2, 2000, TRAKTID[who]['icon'])
		wiz.setS(TRAKTID[who]['saved'], '')
	if over == False: wiz.refresh()
Esempio n. 19
0
def changeFeq():
    feq = [
        'Every Startup', 'Every Day', 'Every Three Days', 'Every Weekly',
        'Monthly'
    ]
    change = DIALOG.select(
        "[COLOR %s]How often would you list to Auto Clean on Startup?[/COLOR]"
        % COLOR2, feq)
    if not change == -1:
        wiz.setS('autocleanfeq', str(change))
        wiz.LogNotify(
            '[COLOR %s]Auto Clean Up[/COLOR]' % COLOR1,
            '[COLOR %s]Fequency Now %s[/COLOR]' % (COLOR2, feq[change]))
Esempio n. 20
0
def updateTrakt(do, who):
    file = TRAKTID[who]['file']
    settings = TRAKTID[who]['settings']
    data = TRAKTID[who]['data']
    addonid = wiz.addonId(TRAKTID[who]['plugin'])
    saved = TRAKTID[who]['saved']
    default = TRAKTID[who]['default']
    user = addonid.getSetting(default)
    suser = wiz.getS(saved)
    name = TRAKTID[who]['name']
    icon = TRAKTID[who]['icon']

    if do == 'update':
        if not user == '':
            try:
                with open(file, 'w') as f:
                    for trakt in data:
                        f.write(
                            '<trakt>\n\t<id>%s</id>\n\t<value>%s</value>\n</trakt>\n'
                            % (trakt, addonid.getSetting(trakt)))
                    f.close()
                user = addonid.getSetting(default)
                wiz.setS(saved, user)
                wiz.LogNotify(
                    "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                    '[COLOR %s]Trakt Daten: Gespeichert![/COLOR]' % COLOR2,
                    2000, icon)
            except Exception, e:
                wiz.log(
                    "[Trakt Data] Unable to Update %s (%s)" % (who, str(e)),
                    xbmc.LOGERROR)
        else:
            wiz.LogNotify(
                "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                '[COLOR %s]Trakt Daten: Nicht registriert![/COLOR]' % COLOR2,
                2000, icon)
Esempio n. 21
0
		def doWrite(self):
			#self.currentVideo = int((self.videomax-20)*self.videoCacheSize.getPercent()/100+20)*1024*1024
			#self.currentCurl = int((self.curlmax)*self.CURLTimeout.getPercent()/100)
			#self.currentRead = int((self.readmax)*self.readBufferFactor.getPercent()/100)
			if   self.Button0.isSelected(): buffermode = 0
			elif self.Button1.isSelected(): buffermode = 1
			elif self.Button2.isSelected(): buffermode = 2
			elif self.Button3.isSelected(): buffermode = 3
			if os.path.exists(ADVANCED):
				choice = DIALOG.yesno("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), "[COLOR %s]There is currently an active [COLOR %s]advancedSettings.xml[/COLOR] file, would you like to overwrite it?[/COLOR]" % (COLOR2, COLOR1), yeslabel="[B][COLOR %s]Overwrite[/COLOR][/B]" % COLOR2, nolabel="[B][COLOR %s]Cancel[/COLOR][/B]" % COLOR1)
				if choice == 0:
					wiz.LogNotify('[COLOR %s]Advanced Settings[/COLOR]' % COLOR1, "[COLOR %s]Overwrite Cancelled![/COLOR]" % COLOR2)
					self.CloseWindow()
					return
				try: os.remove(ADVANCED)
				except: f = open(ADVANCED, 'w'); f.close()
			if KODIV < 17:
				with open(ADVANCED, 'w+') as f:
					f.write('<advancedsettings>\n')
					f.write('	<network>\n')
					f.write('		<buffermode>%s</buffermode>\n' % buffermode)
					f.write('		<cachemembuffersize>%s</cachemembuffersize>\n' % int(self.currentVideo*1024*1024))
					f.write('		<readbufferfactor>%s</readbufferfactor>\n' % self.currentRead)
					f.write('		<curlclienttimeout>%s</curlclienttimeout>\n' % self.currentCurl)
					f.write('		<curllowspeedtime>%s</curllowspeedtime>\n' % self.currentCurl)
					f.write('	</network>\n')
					f.write('</advancedsettings>\n')
				f.close()
			else:
				with open(ADVANCED, 'w+') as f:
					f.write('<advancedsettings>\n')
					f.write('	<cache>\n')
					f.write('		<buffermode>%s</buffermode>\n' % buffermode)
					f.write('		<memorysize>%s</memorysize>\n' % int(self.currentVideo*1024*1024))
					f.write('		<readfactor>%s</readfactor>\n' % self.currentRead)
					f.write('	</cache>\n')
					f.write('	<network>\n')
					f.write('		<curlclienttimeout>%s</curlclienttimeout>\n' % self.currentCurl)
					f.write('		<curllowspeedtime>%s</curllowspeedtime>\n' % self.currentCurl)
					f.write('	</network>\n')
					f.write('</advancedsettings>\n')
				f.close()
			self.CloseWindow()
Esempio n. 22
0
		def doWrite(self):
			#self.currentVideo = int((self.videomax-20)*self.videoCacheSize.getPercent()/100+20)*1024*1024
			#self.currentCurl = int((self.curlmax)*self.CURLTimeout.getPercent()/100)
			#self.currentRead = int((self.readmax)*self.readBufferFactor.getPercent()/100)
			if   self.Button0.isSelected(): buffermode = 0
			elif self.Button1.isSelected(): buffermode = 1
			elif self.Button2.isSelected(): buffermode = 2
			elif self.Button3.isSelected(): buffermode = 3
			if os.path.exists(ADVANCED):
				choice = DIALOG.yesno(ADDONTITLE, "[COLOR lime]Trenutno je aktivan[/COLOR] [COLOR white]AdvancedSettings.xml[/COLOR][COLOR lime], zelite li ukloniti i nastaviti?[/COLOR]"  , yeslabel="[B][COLOR white]Nastavi[/COLOR][/B]", nolabel="[B][COLOR white]Odustani[/COLOR][/B]")
				if choice == 0: return
				try: os.remove(ADVANCED)
				except: f = open(ADVANCED, 'w'); f.close()
			if KODIV < 17:
				with open(ADVANCED, 'w+') as f:
					f.write('<advancedsettings>\n')
					f.write('	<network>\n')
					f.write('		<buffermode>%s</buffermode>\n' % buffermode)
					f.write('		<cachemembuffersize>%s</cachemembuffersize>\n' % int(self.currentVideo*1024*1024))
					f.write('		<readbufferfactor>%s</readbufferfactor>\n' % self.currentRead)
					f.write('		<curlclienttimeout>%s</curlclienttimeout>\n' % self.currentCurl)
					f.write('		<curllowspeedtime>%s</curllowspeedtime>\n' % self.currentCurl)
					f.write('	</network>\n')
					f.write('</advancedsettings>\n')
				f.close()
			else:
				with open(ADVANCED, 'w+') as f:
					f.write('<advancedsettings>\n')
					f.write('	<cache>\n')
					f.write('		<buffermode>%s</buffermode>\n' % buffermode)
					f.write('		<memorysize>%s</memorysize>\n' % int(self.currentVideo*1024*1024))
					f.write('		<readfactor>%s</readfactor>\n' % self.currentRead)
					f.write('	</cache>\n')
					f.write('	<network>\n')
					f.write('		<curlclienttimeout>%s</curlclienttimeout>\n' % self.currentCurl)
					f.write('		<curllowspeedtime>%s</curllowspeedtime>\n' % self.currentCurl)
					f.write('	</network>\n')
					f.write('</advancedsettings>\n')
				f.close()
				wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), '[COLOR %s]AdvancedSettings.xml have been written[/COLOR]' % COLOR2)
			self.CloseWindow()
Esempio n. 23
0
		def doWrite(self):

			buffermode = 2

			if os.path.exists(ADVANCED):
				choice = DIALOG.yesno(ADDONTITLE, "[COLOR %s]There is currently an active [COLOR %s]AdvancedSettings.xml[/COLOR], would you like to remove it and continue?[/COLOR]" % (COLOR2, COLOR1), yeslabel="[B][COLOR green]Remove Settings[/COLOR][/B]", nolabel="[B][COLOR red]Cancel Write[/COLOR][/B]")
				if choice == 0: return
				try: os.remove(ADVANCED)
				except: f = open(ADVANCED, 'w'); f.close()
			if KODIV < 17:
				with open(ADVANCED, 'w+') as f:
					f.write('<advancedsettings>\n')
					f.write('	<network>\n')
					f.write('		<buffermode>%s</buffermode>\n' % buffermode)
					f.write('		<cachemembuffersize>%s</cachemembuffersize>\n' % int(self.currentVideo*1024*1024))
					f.write('		<readbufferfactor>%s</readbufferfactor>\n' % self.currentRead)
					f.write('		<curlclienttimeout>%s</curlclienttimeout>\n' % self.currentCurl)
					f.write('		<curllowspeedtime>%s</curllowspeedtime>\n' % self.currentCurl)
					f.write('	</network>\n')
					f.write('</advancedsettings>\n')
				f.close()
			else:
				with open(ADVANCED, 'w+') as f:
					f.write('<advancedsettings>\n')
					f.write('	<cache>\n')
					f.write('		<buffermode>%s</buffermode>\n' % buffermode)
					f.write('		<memorysize>%s</memorysize>\n' % int(self.currentVideo*1024*1024))
					f.write('		<readfactor>%s</readfactor>\n' % self.currentRead)
					f.write('	</cache>\n')
					f.write('	<network>\n')
					f.write('		<curlclienttimeout>%s</curlclienttimeout>\n' % self.currentCurl)
					f.write('		<curllowspeedtime>%s</curllowspeedtime>\n' % self.currentCurl)
					f.write('	</network>\n')
					f.write('</advancedsettings>\n')
				f.close()
				wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), '[COLOR %s]AdvancedSettings.xml have been written[/COLOR]' % COLOR2)
			self.CloseWindow()
Esempio n. 24
0
         if workingrepo == True:
             DP.create(ADDONTITLE, 'Downloading Repo...', '', 'Please Wait')
             if not os.path.exists(PACKAGES): os.makedirs(PACKAGES)
             lib = os.path.join(PACKAGES, installzip)
             try:
                 os.remove(lib)
             except:
                 pass
             downloader.download(REPOZIPURL + installzip, lib, DP)
             extract.all(lib, ADDONS, DP)
             f = open(os.path.join(ADDONS, REPOID, 'addon.xml'),
                      mode='r').read()
             match = re.compile('<addon.+?id="%s".+?ame="(.+?)".+?>' %
                                REPOID).findall(f)
             wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, match[0]),
                           "[COLOR %s]Add-on updated[/COLOR]" % COLOR2,
                           icon=os.path.join(ADDONS, REPOID, 'icon.png'))
             DP.close()
             xbmc.sleep(500)
             wiz.forceUpdate(True)
             wiz.log("[Auto Install Repo] Successfully Installed",
                     xbmc.LOGNOTICE)
         else:
             wiz.LogNotify(
                 "[COLOR %s]Repo Install Error[/COLOR]" % COLOR1,
                 "[COLOR %s]Invalid url for zip![/COLOR]" % COLOR2)
             wiz.log(
                 "[Auto Install Repo] Was unable to create a working url for repository. %s"
                 % workingrepo, xbmc.LOGERROR)
 else:
     wiz.LogNotify("[COLOR %s]Repo Install Error[/COLOR]" % COLOR1,
Esempio n. 25
0
 elif do == 'restore':
     if os.path.exists(file):
         f = open(file, mode='r')
         g = f.read().replace('\n', '').replace('\r', '').replace('\t', '')
         f.close()
         match = re.compile(
             '<debrid><id>(.+?)</id><value>(.+?)</value></debrid>').findall(
                 g)
         try:
             if len(match) > 0:
                 for debrid, value in match:
                     addonid.setSetting(debrid, value)
             user = addonid.getSetting(default)
             wiz.setS(saved, user)
             wiz.LogNotify(
                 "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                 '[COLOR %s]Debrid Info: Restored![/COLOR]' % COLOR2, 2000,
                 icon)
         except Exception, e:
             wiz.log(
                 "[Debrid Info] Unable to Restore %s (%s)" % (who, str(e)),
                 xbmc.LOGERROR)
     #else: wiz.LogNotify(name,'Real Debrid Info: [COLOR red]Not Found![/COLOR]', 2000, icon)
 elif do == 'clearaddon':
     wiz.log('%s SETTINGS: %s' % (name, settings), xbmc.LOGDEBUG)
     if os.path.exists(settings):
         try:
             f = open(settings, "r")
             lines = f.readlines()
             f.close()
             f = open(settings, "w")
             for line in lines:
         os.remove(lib)
     except:
         pass
     downloader.download(REPOZIPURL + installzip, lib, DP)
     extract.all(lib, ADDONS, DP)
     try:
         f = open(os.path.join(ADDONS, REPOID, 'addon.xml'),
                  mode='r')
         g = f.read()
         f.close()
         name = wiz.parseDOM(g,
                             'addon',
                             ret='name',
                             attrs={'id': REPOID})
         wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name[0]),
                       "[COLOR %s]Add-on updated[/COLOR]" % COLOR2,
                       icon=os.path.join(ADDONS, REPOID,
                                         'icon.png'))
     except:
         pass
     if KODIV >= 17: wiz.addonDatabase(REPOID, 1)
     DP.close()
     xbmc.sleep(500)
     wiz.forceUpdate(True)
     wiz.log("[Repo Auto Instalar] Instalado com sucesso",
             xbmc.LOGNOTICE)
 else:
     wiz.LogNotify(
         "[COLOR %s]Erro de instalação do Repo[/COLOR]" % COLOR1,
         "[COLOR %s]Invalid url for zip![/COLOR]" % COLOR2)
     wiz.log(
         "[Repo Auto Instalar] Não foi possível criar uma url de trabalho para repositório. %s"
Esempio n. 27
0
             icon)
 elif do == 'restore':
     if os.path.exists(file):
         f = open(file, mode='r')
         g = f.read().replace('\n', '').replace('\r', '').replace('\t', '')
         f.close()
         match = re.compile(
             '<login><id>(.+?)</id><value>(.+?)</value></login>').findall(g)
         try:
             if len(match) > 0:
                 for login, value in match:
                     addonid.setSetting(login, value)
             user = addonid.getSetting(default)
             wiz.setS(saved, user)
             wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                           '[COLOR %s]Login: Restored![/COLOR]' % COLOR2,
                           2000, icon)
         except Exception, e:
             wiz.log(
                 "[Login Data] Unable to Restore %s (%s)" % (who, str(e)),
                 xbmc.LOGERROR)
     #else: wiz.LogNotify(name,'login Data: [COLOR red]Not Found![/COLOR]', 2000, icon)
 elif do == 'clearaddon':
     wiz.log('%s SETTINGS: %s' % (name, settings), xbmc.LOGDEBUG)
     if os.path.exists(settings):
         try:
             f = open(set, "r")
             lines = f.readlines()
             f.close()
             f = open(settings, "w")
             for line in lines:
Esempio n. 28
0
             2000, icon)
 elif do == 'restore':
     if os.path.exists(file):
         f = open(file, mode='r')
         g = f.read().replace('\n', '').replace('\r', '').replace('\t', '')
         f.close()
         match = re.compile(
             '<trakt><id>(.+?)</id><value>(.+?)</value></trakt>').findall(g)
         try:
             if len(match) > 0:
                 for trakt, value in match:
                     addonid.setSetting(trakt, value)
             user = addonid.getSetting(default)
             wiz.setS(saved, user)
             wiz.LogNotify(
                 "[COLOR %s]%s[/COLOR]" % (COLOR1, name),
                 '[COLOR %s]Trakt: Wiederhergestellt![/COLOR]' % COLOR2,
                 2000, icon)
         except Exception, e:
             wiz.log(
                 "[Trakt Data] Unable to Restore %s (%s)" % (who, str(e)),
                 xbmc.LOGERROR)
     #else: wiz.LogNotify(name,'Trakt Data: [COLOR red]Not Found![/COLOR]', 2000, icon)
 elif do == 'clearaddon':
     wiz.log('%s SETTINGS: %s' % (name, settings), xbmc.LOGDEBUG)
     if os.path.exists(settings):
         try:
             f = open(settings, "r")
             lines = f.readlines()
             f.close()
             f = open(settings, "w")
             for line in lines:
Esempio n. 29
0
				wiz.setS(saved, user)
				wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Real Debrid Data: Saved![/COLOR]' % COLOR2, 2000, icon)
			except Exception, e:
				wiz.log("[Real Debrid Data] Unable to Update %s (%s)" % (who, str(e)), xbmc.LOGERROR)
		else: wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Real Debrid Data: Not Registered![/COLOR]' % COLOR2, 2000, icon)
	elif do == 'restore':
		if os.path.exists(file):
			f = open(file,mode='r'); g = f.read().replace('\n','').replace('\r','').replace('\t',''); f.close();
			match = re.compile('<debrid><id>(.+?)</id><value>(.+?)</value></debrid>').findall(g)
			try:
				if len(match) > 0:
					for debrid, value in match:
						addonid.setSetting(debrid, value)
				user = addonid.getSetting(default)
				wiz.setS(saved, user)
				wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Real Debrid: Restored![/COLOR]' % COLOR2, 2000, icon)
			except Exception, e:
				wiz.log("[Real Debrid Data] Unable to Restore %s (%s)" % (who, str(e)), xbmc.LOGERROR)
		#else: wiz.LogNotify(name,'Real Debrid Data: [COLOR red]Not Found![/COLOR]', 2000, icon)
	elif do == 'clearaddon':
		wiz.log('%s SETTINGS: %s' % (name, settings), xbmc.LOGDEBUG)
		if os.path.exists(settings):
			try:
				f = open(settings,"r"); lines = f.readlines(); f.close()
				f = open(settings,"w")
				for line in lines:
					match = re.compile('<setting.+?id="(.+?)".+?/>').findall(line)
					if len(match) == 0: f.write(line)
					elif match[0] not in data: f.write(line)
					else: wiz.log('[Debrid Clear Addon] Removing Line: %s' % line, xbmc.LOGNOTICE)
				f.close()
Esempio n. 30
0
def errorChecking(log=None, count=None, all=None):
    if log == None:
        mainlog = wiz.Grab_Log(True)
        oldlog = wiz.Grab_Log(True, True)
        if not oldlog == False and not mainlog == False:
            which = DIALOG.select(ADDONTITLE, [
                "View %s: %s error(s)" %
                (mainlog.replace(LOG, ""), errorChecking(mainlog, True, True)),
                "View %s: %s error(s)" %
                (oldlog.replace(LOG, ""), errorChecking(oldlog, True, True))
            ])
            if which == -1:
                wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                              '[COLOR %s]View Log Cancelled![/COLOR]' % COLOR2)
                return
        elif mainlog == False and oldlog == False:
            wiz.LogNotify('[COLOR %s]View Log[/COLOR]' % COLOR1,
                          '[COLOR %s]No Log File Found![/COLOR]' % COLOR2)
            return
        elif not mainlog == False:
            which = 0
        elif not oldlog == False:
            which = 1
        log = mainlog if which == 0 else oldlog
    if log == False:
        if count == None:
            wiz.LogNotify("[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE),
                          "[COLOR %s]Log File not Found[/COLOR]" % COLOR2)
            return False
        else:
            return 0
    else:
        if os.path.exists(log):
            f = open(log, mode='r')
            a = f.read().replace('\n', '').replace('\r', '')
            f.close()
            match = re.compile(
                "-->Python callback/script returned the following error<--(.+?)-->End of Python script error report<--"
            ).findall(a)
            if not count == None:
                if all == None:
                    x = 0
                    for item in match:
                        if ADDON_ID in item: x += 1
                    return x
                else:
                    return len(match)
            if len(match) > 0:
                x = 0
                msg = ""
                for item in match:
                    if all == None and not ADDON_ID in item: continue
                    else:
                        x += 1
                        msg += "[COLOR red]Error Number %s[/COLOR]\n(PythonToCppException) : -->Python callback/script returned the following error<--%s-->End of Python script error report<--\n\n" % (
                            x,
                            item.replace(
                                '                                          ',
                                '\n').replace('\\\\', '\\').replace(HOME, ''))
                if x > 0:
                    wiz.TextBox(ADDONTITLE, msg)
                else:
                    wiz.LogNotify(ADDONTITLE, "No Errors Found in Log")
            else:
                wiz.LogNotify(ADDONTITLE, "No Errors Found in Log")
        else:
            wiz.LogNotify(ADDONTITLE, "Log File not Found")