def supports_playready(): ia_addon = get_ia_addon() return bool(ia_addon and get_kodi_version() > 17 and xbmc.getCondVisibility('system.platform.android'))
def install_widevine(reinstall=False): ia_addon = get_ia_addon(required=True) system, arch = _get_system_arch() kodi_version = get_kodi_version() if kodi_version < 18: raise InputStreamError(_(_.IA_KODI18_REQUIRED, system=system)) elif system == 'Android': return True elif system == 'UWP': raise InputStreamError(_.IA_UWP_ERROR) elif 'aarch64' in arch or 'arm64' in arch: raise InputStreamError(_.IA_AARCH64_ERROR) last_check = int(ia_addon.getSetting('_last_check') or 0) ver_slug = system + arch + str(kodi_version) + ia_addon.getAddonInfo( 'version') if ver_slug != ia_addon.getSetting(IA_VERSION_KEY): reinstall = True if not reinstall and time.time() - last_check < 86400: return True ia_addon.setSetting(IA_VERSION_KEY, '') ia_addon.setSetting('_last_check', str(int(time.time()))) r = api_get_widevine() widevine = r['widevine'] wv_platform = widevine['platforms'].get(system + arch, None) if not wv_platform: raise InputStreamError( _(_.IA_NOT_SUPPORTED, system=system, arch=arch, kodi_version=kodi_version)) decryptpath = xbmc.translatePath(ia_addon.getSetting('DECRYPTERPATH')) if sys.version_info < (3, 0): decryptpath = decryptpath.decode("utf-8") if 'arm' in arch: url = wv_platform['zip'] else: url = widevine['base_url'] + wv_platform['zip'] wv_path = os.path.join(decryptpath, wv_platform['dst']) if not os.path.isdir(decryptpath): os.makedirs(decryptpath) if not os.path.isdir(ADDON_PROFILE + "tmp"): os.makedirs(ADDON_PROFILE + "tmp") if not _download(url, wv_platform['dst'], wv_path, arch, wv_platform['md5']): return False ia_addon.setSetting(IA_VERSION_KEY, ver_slug) if reinstall: gui.ok(_.IA_WV_INSTALL_OK) return True
def _set_settings_iptv(**kwargs): _close() try: IPTV_SIMPLE_ADDON_ID = "pvr.iptvsimple" try: IPTV_SIMPLE = xbmcaddon.Addon(id=IPTV_SIMPLE_ADDON_ID) except: xbmc.executebuiltin( 'InstallAddon({})'.format(IPTV_SIMPLE_ADDON_ID), True) if IPTV_SIMPLE.getSettingBool("epgCache") != True: IPTV_SIMPLE.setSettingBool("epgCache", True) if IPTV_SIMPLE.getSettingInt("epgPathType") != 0: IPTV_SIMPLE.setSettingInt("epgPathType", 0) if IPTV_SIMPLE.getSetting("epgPath") != ADDON_PROFILE + "epg.xml": IPTV_SIMPLE.setSetting("epgPath", ADDON_PROFILE + "epg.xml") if IPTV_SIMPLE.getSetting("epgTimeShift") != "0": IPTV_SIMPLE.setSetting("epgTimeShift", "0") if IPTV_SIMPLE.getSettingBool("epgTSOverride") != False: IPTV_SIMPLE.setSettingBool("epgTSOverride", False) if get_kodi_version() > 18: if IPTV_SIMPLE.getSettingInt("m3uRefreshMode") != 2: IPTV_SIMPLE.setSettingInt("m3uRefreshMode", 2) if IPTV_SIMPLE.getSettingInt("m3uRefreshIntervalMins") != 60: IPTV_SIMPLE.setSettingInt("m3uRefreshIntervalMins", 60) if IPTV_SIMPLE.getSettingInt("m3uRefreshHour") != 4: IPTV_SIMPLE.setSettingInt("m3uRefreshHour", 4) if IPTV_SIMPLE.getSettingBool("catchupEnabled") != True: IPTV_SIMPLE.setSettingBool("catchupEnabled", True) if IPTV_SIMPLE.getSetting( "catchupQueryFormat" ) != 'plugin://' + ADDON_ID + '/?_=play_video&type=program&id={catchup-id}': IPTV_SIMPLE.setSetting( "catchupQueryFormat", 'plugin://' + ADDON_ID + '/?_=play_video&type=program&id={catchup-id}') if IPTV_SIMPLE.getSettingInt("catchupDays") != 7: IPTV_SIMPLE.setSettingInt("catchupDays", 7) if IPTV_SIMPLE.getSettingInt("allChannelsCatchupMode") != 1: IPTV_SIMPLE.setSettingInt("allChannelsCatchupMode", 1) if IPTV_SIMPLE.getSettingBool("catchupPlayEpgAsLive") != True: IPTV_SIMPLE.setSettingBool("catchupPlayEpgAsLive", True) if IPTV_SIMPLE.getSettingInt( "catchupWatchEpgBeginBufferMins") != 5: IPTV_SIMPLE.setSettingInt("catchupWatchEpgBeginBufferMins", 5) if IPTV_SIMPLE.getSettingInt("catchupWatchEpgEndBufferMins") != 15: IPTV_SIMPLE.setSettingInt("catchupWatchEpgEndBufferMins", 15) if IPTV_SIMPLE.getSettingBool( "catchupOnlyOnFinishedProgrammes") != True: IPTV_SIMPLE.setSettingBool("catchupOnlyOnFinishedProgrammes", True) if IPTV_SIMPLE.getSettingBool("m3uCache") != True: IPTV_SIMPLE.setSettingBool("m3uCache", True) if IPTV_SIMPLE.getSettingInt("m3uPathType") != 0: IPTV_SIMPLE.setSettingInt("m3uPathType", 0) if IPTV_SIMPLE.getSetting( "m3uPath") != ADDON_PROFILE + "playlist.m3u8": IPTV_SIMPLE.setSetting("m3uPath", ADDON_PROFILE + "playlist.m3u8") profile_settings = load_profile(profile_id=1) if IPTV_SIMPLE.getSetting( "userAgent") != profile_settings['user_agent']: IPTV_SIMPLE.setSetting("userAgent", profile_settings['user_agent']) xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":false}}}}' .format(IPTV_SIMPLE_ADDON_ID)) xbmc.sleep(2000) xbmc.executeJSONRPC( '{{"jsonrpc":"2.0","id":1,"method":"Addons.SetAddonEnabled","params":{{"addonid":"{}","enabled":true}}}}' .format(IPTV_SIMPLE_ADDON_ID)) settings.setBool('enable_simple_iptv', True) gui.notification(_.DONE_REBOOT) except: pass