Example #1
0
def CheckUpdates():
    common.CheckNewVersion()
    global remoteSettings
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           "remoteSettings",
                                           remoteSettings,
                                           forceUpdate=True)
    if remoteSettings == []:
        global pvrStoped
        if pvrStoped:
            xbmc.executebuiltin('StartPVRManager')
        return

    global checkInterval
    try:
        checkInterval = remoteSettings["remoteSettings"][
            "refresh"] * 3600  # in hours
    except:
        pass

    refresh = common.GetSubKeyValue(remoteSettings, "plx", "refresh")
    if not refresh is None:
        common.UpdatePlx(plxFile,
                         "plx",
                         remoteSettings,
                         refreshInterval=refresh * 3600)

    if Addon.getSetting("useEPG") == "true":
        refresh = common.GetSubKeyValue(remoteSettings, "globalGuide",
                                        "refresh")
        if not refresh is None:
            common.isFileOld(
                globalGuideFile, refresh * 3600) and common.UpdateZipedFile(
                    globalGuideFile, "globalGuide", remoteSettings)

        refresh = common.GetSubKeyValue(remoteSettings, "filmonGuide",
                                        "refresh")
        if not refresh is None:
            common.isFileOld(
                filmonGuideFile, refresh * 3600) and common.UpdateZipedFile(
                    filmonGuideFile, "filmonGuide", remoteSettings)

        common.MergeGuides(globalGuideFile, filmonGuideFile, fullGuideFile)

        if Addon.getSetting("useIPTV") == "true":
            myIPTV.makeIPTVlist(iptvChannelsFile, portNum)
            myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
            myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)
            myIPTV.SaveChannelsLogos(iptvLogosDir)
Example #2
0
def CheckUA():
    response = None
    try:
        remoteSettings = common.ReadList(remoteSettingsFile)
        if remoteSettings == []:
            return False
        urls = common.GetSubKeyValue(remoteSettings, "UA", "urls")
        if urls is None or len(urls) == 0:
            return False

        random.seed()
        random.shuffle(UAs)

        #text = OpenURL(common.Decode('sefm0Z97eL-1e9ag0NezeMk='), user_agent=UAs[0])
        #country = text.split(';')
        #if country[0] == '1' and country[2].upper() == 'ISR':
        #	print "------- From Israel! ----------"
        #else:
        #	print '------- Come to Israel -----------'

        random.shuffle(urls)
        req = urllib2.Request(common.Decode(urls[0]))
        req.add_header('User-Agent', UAs[0])
        response = urllib2.urlopen(req)
        response.read()
        response.close()
    except Exception as ex:
        #print ex
        if not response is None:
            response.close()
Example #3
0
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))
Example #4
0
remoteSettingsFile = os.path.join(user_dataDir, "remoteSettings.txt")
plxFile = os.path.join(user_dataDir, "israelive.plx")
fullGuideFile = os.path.join(user_dataDir, 'fullGuide.txt')
iptvChannelsFile = os.path.join(user_dataDir, "iptv.m3u")
iptvGuideFile = os.path.join(user_dataDir, "guide.xml")
iptvLogosDir = os.path.join(user_dataDir, "logos")
remoteSettings = common.GetRemoteSettings()
remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                       "remoteSettings",
                                       remoteSettings,
                                       forceUpdate=True)
if remoteSettings == []:
    xbmc.executebuiltin('StartPVRManager')
else:
    xbmc.executebuiltin("XBMC.CancelAlarm({0},silent)".format("IsraeLiveM3U"))
    refresh = common.GetSubKeyValue(remoteSettings, "plx", "refresh")
    if not refresh is None:
        common.UpdatePlx(plxFile,
                         "plx",
                         remoteSettings,
                         refreshInterval=refresh * 3600)

    if Addon.getSetting("useEPG") == "true":
        refresh = common.GetSubKeyValue(remoteSettings, "fullGuide", "refresh")
        isGuideUpdated = False
        if not refresh is None and common.isFileOld(
                fullGuideFile, refresh * 3600) and common.UpdateZipedFile(
                    fullGuideFile, "fullGuide", remoteSettings):
            isGuideUpdated = True
            epg = common.ReadList(fullGuideFile)
            fullCategoriesList = []