def onSettingsChanged( self): # Kodi callback when the addon settings are changed window.clearProperty('fenomscrapers_settings') control.sleep(50) refreshed = control.make_settings_dict() control.setUndesirables() control.refresh_debugReversed()
def run(self): xbmc.log( '[ script.module.fenomscrapers ] Addon checking available updates', LOGNOTICE) try: import re import requests repo_xml = requests.get( 'https://raw.githubusercontent.com/mr-kodi/repository.fenomscrapers/master/zips/addons.xml' ) if not repo_xml.status_code == 200: return xbmc.log( '[ script.module.fenomscrapers ] Could not connect to remote repo XML: status code = %s' % repo_xml.status_code, LOGNOTICE) repo_version = re.search( r'<addon id=\"script.module.fenomscrapers\".*version=\"(\d*.\d*.\d*)\"', repo_xml.text, re.I).group(1) local_version = control.addonVersion( )[: 5] # 5 char max so pre-releases do try to compare more chars than github version def check_version_numbers( current, new ): # Compares version numbers and return True if github version is newer current = current.split('.') new = new.split('.') step = 0 for i in current: if int(new[step]) > int(i): return True if int(i) > int(new[step]): return False if int(i) == int(new[step]): step += 1 continue return False if check_version_numbers(local_version, repo_version): while control.condVisibility('Library.IsScanningVideo'): control.sleep(10000) xbmc.log( '[ script.module.fenomscrapers ] A newer version is available. Installed Version: v%s, Repo Version: v%s' % (local_version, repo_version), LOGNOTICE) control.notification(message=control.lang(32037) % repo_version, time=5000) return xbmc.log( '[ script.module.fenomscrapers ] Addon update check complete', LOGNOTICE) except: import traceback traceback.print_exc()
for i in sourceList: source_setting = 'provider.' + i control.setSetting(source_setting, params['setting']) elif action == "toggleAllTorrent": sourceList = [] sourceList = sources_fenomscrapers.torrent_providers for i in sourceList: source_setting = 'provider.' + i control.setSetting(source_setting, params['setting']) elif action == "toggleAllPackTorrent": control.execute( 'RunPlugin(plugin://script.module.fenomscrapers/?action=toggleAllTorrent&setting=false)' ) control.sleep(500) sourceList = [] from fenomscrapers import pack_sources sourceList = pack_sources() for i in sourceList: source_setting = 'provider.' + i control.setSetting(source_setting, params['setting']) elif action == 'openMyAccount': from myaccounts import openMASettings openMASettings('0.0') control.sleep(500) while control.condVisibility('Window.IsVisible(addonsettings)' ) or control.homeWindow.getProperty( 'myaccounts.active') == 'true': control.sleep(500)