def doStandardInstall(self): wiz.log("[Check Updates] [Installed Version: %s] [Current Version: %s] [User Selected: Standard Install build]" % (BUILDVERSION, LATESTVERSION), xbmc.LOGNOTICE) wiz.log("[Check Updates] [Next Check: %s]" % str(NEXTCHECK), xbmc.LOGNOTICE) wiz.setS('lastbuildcheck', str(NEXTCHECK)) self.close() url = 'plugin://%s/?mode=install&name=%s&url=normal' % (ADDON_ID, urllib.quote_plus(BUILDNAME)) xbmc.executebuiltin('RunPlugin(%s)' % url)
def debridIt(do, who): if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA) if not os.path.exists(REALFOLD): os.makedirs(REALFOLD) if who == 'all': for log in ORDER: if os.path.exists(DEBRIDID[log]['path']): try: addonid = wiz.addonId(DEBRIDID[log]['plugin']) default = DEBRIDID[log]['default'] user = addonid.getSetting(default) if user == '' and do == 'update': continue updateDebrid(do, log) except: pass else: wiz.log( '[Real Debrid Info] %s(%s) is not installed' % (DEBRIDID[log]['name'], DEBRIDID[log]['plugin']), xbmc.LOGERROR) wiz.setS('debridlastsave', str(THREEDAYS)) else: if DEBRIDID[who]: if os.path.exists(DEBRIDID[who]['path']): updateDebrid(do, who) else: wiz.log('[Real Debrid Info] Invalid Entry: %s' % who, xbmc.LOGERROR)
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 Info: Saved![/COLOR]' % COLOR2, 2000, icon) except Exception, e: wiz.log( "[Trakt Info] Unable to Update %s (%s)" % (who, str(e)), xbmc.LOGERROR) else: wiz.LogNotify( "[COLOR %s]%s[/COLOR]" % (COLOR1, name), '[COLOR %s]Trakt Info: Not Registered![/COLOR]' % COLOR2, 2000, icon)
def traktIt(do, who): if not os.path.exists(ADDONDATA): os.makedirs(ADDONDATA) if not os.path.exists(TRAKTFOLD): os.makedirs(TRAKTFOLD) if who == 'all': for log in ORDER: if os.path.exists(TRAKTID[log]['path']): try: addonid = wiz.addonId(TRAKTID[log]['plugin']) default = TRAKTID[log]['default'] user = addonid.getSetting(default) if user == '' and do == 'update': continue updateTrakt(do, log) except: pass else: wiz.log( '[Trakt Info] %s(%s) is not installed' % (TRAKTID[log]['name'], TRAKTID[log]['plugin']), xbmc.LOGERROR) wiz.setS('traktlastsave', str(THREEDAYS)) else: if TRAKTID[who]: if os.path.exists(TRAKTID[who]['path']): updateTrakt(do, who) else: wiz.log('[Trakt Info] Invalid Entry: %s' % who, xbmc.LOGERROR)
def onClick(self, controlId): if controlId == self.okbutton: self.close() for item in self.controllist: at = self.controllist.index(item) if self.getControl(item).isSelected(): wiz.setS(self.controlsettings[at], 'true') else: wiz.setS(self.controlsettings[at], 'false') if self.getControl(self.whitelist).isSelected() and not self.whitelistcurrent == 'true': wiz.whiteList('edit')
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 Info: Removed![/COLOR]' % COLOR2, 2000, DEBRIDID[who]['icon']) wiz.setS(DEBRIDID[who]['saved'], '') if over == False: wiz.refresh()
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 Info: Removed![/COLOR]' % COLOR2, 2000, TRAKTID[who]['icon']) wiz.setS(TRAKTID[who]['saved'], '') if over == False: wiz.refresh()
def importlist(who): if who == 'all': for log in DEBRIDID: if os.path.exists(DEBRIDID[log]['file']): importlist(log) elif DEBRIDID[who]: if os.path.exists(DEBRIDID[who]['file']): d = DEBRIDID[who]['default'] sa = DEBRIDID[who]['saved'] su = wiz.getS(sa) n = DEBRIDID[who]['name'] f = open(DEBRIDID[who]['file'], mode='r') g = f.read().replace('\n', '').replace('\r', '').replace('\t', '') f.close() m = re.compile('<debrid><id>%s</id><value>(.+?)</value></debrid>' % d).findall(g) if len(m) > 0: if not m[0] == su: if DIALOG.yesno( "[COLOR %s]%s[/COLOR]" % (COLOR1, ADDONTITLE), "[COLOR %s]Would you like to import the [COLOR %s]Real Debrid[/COLOR] Info for [COLOR %s]%s[/COLOR]?" % (COLOR2, COLOR1, COLOR1, n), "File: [COLOR green][B]%s[/B][/COLOR]" % m[0], "Saved:[/COLOR] [COLOR red][B]%s[/B][/COLOR]" % su if not su == '' else 'Saved:[/COLOR] [COLOR red][B]None[/B][/COLOR]', yeslabel="[B][COLOR %s]Import Debrid[/COLOR][/B]" % COLOR2, nolabel="[B][COLOR %s]No, Cancel[/COLOR][/B]" % COLOR1): wiz.setS(sa, m[0]) wiz.log('[Import Data] %s: %s' % (who, str(m)), xbmc.LOGNOTICE) else: wiz.log( '[Import Data] Declined Import(%s): %s' % (who, str(m)), xbmc.LOGNOTICE) else: wiz.log('[Import Data] Duplicate Entry(%s): %s' % (who, str(m))), xbmc.LOGNOTICE else: wiz.log('[Import Data] No Match(%s): %s' % (who, str(m)), xbmc.LOGNOTICE)
'[COLOR %s]Real Debrid Info: 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 Info: Restored![/COLOR]' % COLOR2, 2000, icon) except Exception, e: wiz.log( "[Real 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()
def doIgnore(self): wiz.log("[Check Updates] [Installed Version: %s] [Current Version: %s] [User Selected: Ignore 3 Days]" % (BUILDVERSION, LATESTVERSION), xbmc.LOGNOTICE) wiz.log("[Check Updates] [Next Check: %s]" % str(THREEDAYS), xbmc.LOGNOTICE) wiz.setS('lastbuildcheck', str(THREEDAYS)) self.close()
def doDismiss(self): if not test == True: wiz.setS("notedismiss","true") wiz.log("[Notification] NotifyID %s Dismissed" % wiz.getS('noteid'), xbmc.LOGNOTICE) self.close()
def doRemindMeLater(self): if not test == True: wiz.setS("notedismiss","false") wiz.log("[Notification] NotifyID %s Remind Me Later" % wiz.getS('noteid'), xbmc.LOGNOTICE) self.close()
def doIgnore(self): self.close() wiz.log("[First Run] [User Selected: Ignore Build Menu] [Next Check: %s]" % str(NEXTCHECK), xbmc.LOGNOTICE) wiz.setS('lastbuildcheck', str(NEXTCHECK))
def doBuildMenu(self): wiz.log("[Check Updates] [User Selected: Open Build Menu] [Next Check: %s]" % str(NEXTCHECK), xbmc.LOGNOTICE) wiz.setS('lastbuildcheck', str(NEXTCHECK)) self.close() url = 'plugin://%s/?mode=builds' % ADDON_ID xbmc.executebuiltin('ActivateWindow(10025, "%s", return)' % url)
xbmc.executebuiltin("Dialog.Close(busydialog)") sys.exit(1) # Sleeper added before the maintenance functions due to the updating of addons. ####################################################################### # AUTO CLEANUP ####################################################################### wiz.log("[Auto Cleanup] Started", xbmc.LOGNOTICE) if AUTOCLEANUP == 'true': service = False days = [TODAY, TOMORROW, THREEDAYS, ONEWEEK] freq = int(float(AUTOFREQ)) if AUTONEXTRUN <= str(TODAY) or freq == 0: service = True next_run = days[freq] wiz.setS('nextautocleanup', str(next_run)) else: wiz.log("[Auto Cleanup] Next Cleanup %s" % AUTONEXTRUN, xbmc.LOGNOTICE) if service == True: #AUTOCACHE = wiz.getS('clearcache') #AUTOPACKAGES = wiz.getS('clearpackages') #AUTOTHUMBS = wiz.getS('clearthumbs') if AUTOCACHE == 'true': wiz.log('[Auto Cleanup] Cache: On', xbmc.LOGNOTICE) wiz.clearCache(True) else: wiz.log('[Auto Cleanup] Cache: Off', xbmc.LOGNOTICE) if AUTOTHUMBS == 'true': wiz.log('[Auto Cleanup] Old Thumbs: On', xbmc.LOGNOTICE) wiz.oldThumbs() else: