def Update(): # Update channels-lists files common.UpdateChList(forceUpdate=False) # Update EPG files for selected LiveTV channels first isGuideUpdated = False if Addon.getSetting("useEPG") == "true": epg = common.ReadList(fullGuideFile) if len(epg) > 0: isGuideUpdated = True fullCategoriesList = [] selectedCategoriesList = [] categoriesList = [] iptvList = Addon.getSetting("iptvList") if iptvList == "0": # Favourites categoriesList = [{"id": "Favourites"}] elif iptvList == "1": # No filter categoriesList = fullCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "categories.list")) elif iptvList == "2": # Selected categories categoriesList = selectedCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "selectedCategories.list")) common.MakeCatGuides(categoriesList, epg) useIPTV = common.getUseIPTV() # Update LiveTV channels and EPG if useIPTV: import myIPTV myIPTV.makeIPTVlist(iptvChannelsFile) myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile) myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir) # Update EPG files for non-selected LiveTV channels if isGuideUpdated: if fullCategoriesList == []: fullCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "categories.list")) if iptvList == "0": # Favourites categoriesList = fullCategoriesList elif iptvList == "1": # No filter categoriesList = [{"id": "Favourites"}] elif iptvList == "2": # Selected categories categoriesList = common.GetUnSelectedList(fullCategoriesList, selectedCategoriesList) categoriesList.append({"id": "Favourites"}) common.MakeCatGuides(categoriesList, epg) # Update channels-logos files if useIPTV and myIPTV.GetIptvType() < 2: myIPTV.SaveChannelsLogos(iptvLogosDir) checkInterval = 720 # 12 hours = 720 minutes xbmc.executebuiltin( "XBMC.AlarmClock({0},XBMC.RunPlugin(plugin://plugin.video.israelive/default.py?mode=100&url=checkUpdates),{1},silent)" .format("IsraeLiveUpdates", checkInterval))
def SaveGuide(): try: xbmc.executebuiltin( "XBMC.Notification({0}, Saving Guide..., {1}, {2})".format( AddonName, 300000, icon)) if common.UpdateZipedFile(fullGuideFile, "fullGuide", remoteSettings, forceUpdate=True): xbmc.executebuiltin( "XBMC.Notification({0}, Guide saved., {1}, {2})".format( AddonName, 5000, icon)) epg = common.ReadList(fullGuideFile) fullCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "categories.list")) fullCategoriesList.append({"id": "Favourites"}) common.MakeCatGuides(fullCategoriesList, epg) else: xbmc.executebuiltin( "XBMC.Notification({0}, Guide is up to date., {1}, {2})". format(AddonName, 5000, icon)) return True except Exception as ex: print ex xbmc.executebuiltin( "XBMC.Notification({0}, Guide NOT saved!, {1}, {2})".format( AddonName, 5000, icon)) return False
def SaveGuide(): try: xbmc.executebuiltin( "XBMC.Notification({0}, Saving Guide..., {1}, {2})".format( AddonName, 300000, icon)) if common.UpdateFile(fullGuideFile, "fullGuide", remoteSettings, zip=True, forceUpdate=True): xbmc.executebuiltin( "XBMC.Notification({0}, Guide saved., {1}, {2})".format( AddonName, 5000, icon)) epg = common.ReadList(fullGuideFile) fullCategoriesList = common.ReadList(categoriesFile) fullCategoriesList.append({"id": "Favourites"}) common.MakeCatGuides(fullCategoriesList, epg) else: xbmc.executebuiltin( "XBMC.Notification({0}, Guide is up to date., {1}, {2})". format(AddonName, 5000, icon)) return True except Exception as ex: xbmc.log("{0}".format(ex), 3) xbmc.executebuiltin( "XBMC.Notification({0}, Guide NOT saved!, {1}, {2})".format( AddonName, 5000, icon)) return False
def SaveGuide(): try: epg = common.ReadList(fullGuideFile) if len(epg) > 0: fullCategoriesList = common.ReadList(categoriesFile) fullCategoriesList.append({"id": "Favourites"}) common.MakeCatGuides(fullCategoriesList, epg) return True except Exception as ex: xbmc.log("{0}".format(ex), 3) xbmc.executebuiltin( "XBMC.Notification({0}, Guide NOT saved!, {1}, {2})".format( AddonName, 5000, icon)) return False
def Update(): remoteSettings = common.GetRemoteSettings() refresh = common.GetSubKeyValue(remoteSettings, "remoteSettingsZip", "refresh") forceUpdate = True if refresh is None or common.isFileOld(remoteSettingsFile, refresh * 3600) else False common.UpdateFile(remoteSettingsFile, "remoteSettingsZip", remoteSettings, zip=True, forceUpdate=forceUpdate) remoteSettings = common.ReadList(remoteSettingsFile) if remoteSettings == []: xbmc.executebuiltin('StartPVRManager') else: common.CheckNewVersion(remoteSettings) # Update channels-lists files refresh = common.GetSubKeyValue(remoteSettings, "lists", "refresh") if not refresh is None: common.UpdateChList(remoteSettings, refreshInterval = refresh * 3600, forceUpdate = False) # Update EPG files for selected LiveTV channels first isGuideUpdated = False if Addon.getSetting("useEPG") == "true": refresh = common.GetSubKeyValue(remoteSettings, "fullGuide", "refresh") if refresh is not None and common.isFileOld(fullGuideFile, refresh * 3600) and common.UpdateFile(fullGuideFile, "fullGuide", remoteSettings, zip=True): isGuideUpdated = True epg = common.ReadList(fullGuideFile) fullCategoriesList = [] selectedCategoriesList = [] categoriesList = [] iptvList = Addon.getSetting("iptvList") if iptvList == "0": # Favourites categoriesList = [{"id": "Favourites"}] elif iptvList == "1": # No filter categoriesList = fullCategoriesList = common.ReadList(os.path.join(user_dataDir, "lists", "categories.list")) elif iptvList == "2": # Selected categories categoriesList = selectedCategoriesList = common.ReadList(os.path.join(user_dataDir, "lists", "selectedCategories.list")) common.MakeCatGuides(categoriesList, epg) useIPTV = common.getUseIPTV() # Update LiveTV channels and EPG if useIPTV: import myIPTV myIPTV.makeIPTVlist(iptvChannelsFile) myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile) myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir) # Update EPG files for non-selected LiveTV channels if isGuideUpdated: if fullCategoriesList == []: fullCategoriesList = common.ReadList(os.path.join(user_dataDir, "lists", "categories.list")) if iptvList == "0": # Favourites categoriesList = fullCategoriesList elif iptvList == "1": # No filter categoriesList = [{"id": "Favourites"}] elif iptvList == "2": # Selected categories categoriesList = common.GetUnSelectedList(fullCategoriesList, selectedCategoriesList) categoriesList.append({"id": "Favourites"}) common.MakeCatGuides(categoriesList, epg) # Update channels-logos files if useIPTV and myIPTV.GetIptvType() < 2: myIPTV.SaveChannelsLogos(iptvLogosDir) checkInterval = 720 # 12 hours = 720 minutes try: checkInterval = remoteSettings["checkInterval"] * 60 # hours to minutes except: pass xbmc.executebuiltin("XBMC.AlarmClock({0},XBMC.RunPlugin(plugin://plugin.video.israelive/default.py?mode=100&url=checkUpdates),{1},silent)".format("IsraeLiveUpdates", checkInterval))
fullCategoriesList = [] selectedCategoriesList = [] categoriesList = [] iptvList = Addon.getSetting("iptvList") if iptvList == "0": # Favourites categoriesList = [{"id": "Favourites"}] elif iptvList == "1": # No filter categoriesList = fullCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "categories.list")) elif iptvList == "2": # Selected categories categoriesList = selectedCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "selectedCategories.list")) common.MakeCatGuides(categoriesList, epg) if Addon.getSetting("useIPTV") == "true": import myIPTV myIPTV.makeIPTVlist(iptvChannelsFile) if isGuideUpdated: myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile) myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir) if isGuideUpdated: if fullCategoriesList == []: fullCategoriesList = common.ReadList( os.path.join(user_dataDir, "lists", "categories.list")) if iptvList == "0": # Favourites categoriesList = fullCategoriesList elif iptvList == "1": # No filter