Exemplo n.º 1
0
def SaveGuide(forceManual=False, showNotification=True):
    try:
        if showNotification:
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Saving Guide..., {1}, {2})".format(
                    AddonName, 300000, icon))
        common.UpdateZipedFile(globalGuideFile,
                               remoteSettings["globalGuide"]["url"])
        if forceManual:
            common.UpdatePlx(package["url"], plxFile)
            myFilmon.MakePLXguide(filmonGuideFile)
            if showNotification:
                xbmc.executebuiltin(
                    "XBMC.Notification({0}, Guide saved., {1}, {2})".format(
                        AddonName, 5000, icon))
        else:
            if common.UpdateZipedFile(filmonGuideFile, package["guide"]):
                if showNotification:
                    xbmc.executebuiltin(
                        "XBMC.Notification({0}, Guide saved., {1}, {2})".
                        format(AddonName, 5000, icon))
            else:
                if showNotification:
                    xbmc.executebuiltin(
                        "XBMC.Notification({0}, Guide is up to date., {1}, {2})"
                        .format(AddonName, 5000, icon))
        return True
    except:
        if showNotification:
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Guide NOT saved!, {1}, {2})".format(
                    AddonName, 5000, icon))
        return False
Exemplo n.º 2
0
def CheckUpdates():
    common.CheckNewVersion()
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           remoteSettingsUrl)
    if remoteSettings == []:
        return

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

    isPlxUpdated = False
    #if common.UpdatePlx(remoteSettings["plxUrl"], plxFile, refreshInterval=remoteSettings["plxRefresh"] * 3600):
    #	isPlxUpdated = True
    common.UpdatePlx(remoteSettings["plxUrl"],
                     plxFile,
                     refreshInterval=remoteSettings["plxRefresh"] * 3600)

    if Addon.getSetting("useEPG") == "true":
        '''
		#isGuideUpdated = False
		#if common.isFileOld(globalGuideFile, remoteSettings["globalGuideRefresh"] * 3600) and common.UpdateZipedFile(globalGuideFile, remoteSettings["globalGuideUrl"]):
		#	isGuideUpdated = True
		#if common.isFileOld(filmonGuideFile, remoteSettings["filmonGuideRefresh"] * 3600) and common.UpdateZipedFile(filmonGuideFile, remoteSettings["filmonGuideUrl"]):
		#	isGuideUpdated = True
		#if isGuideUpdated:
		#	common.MergeGuides(globalGuideFile, filmonGuideFile, fullGuideFile)
		'''
        common.isFileOld(globalGuideFile,
                         remoteSettings["globalGuideRefresh"] *
                         3600) and common.UpdateZipedFile(
                             globalGuideFile, remoteSettings["globalGuideUrl"])
        common.isFileOld(filmonGuideFile,
                         remoteSettings["filmonGuideRefresh"] *
                         3600) and common.UpdateZipedFile(
                             filmonGuideFile, remoteSettings["filmonGuideUrl"])
        common.MergeGuides(globalGuideFile, filmonGuideFile, fullGuideFile)

        if Addon.getSetting("useIPTV") == "true":
            '''
			if isPlxUpdated:
				myIPTV.makeIPTVlist(iptvChannelsFile, portNum)
			if isGuideUpdated:
				myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
			if isPlxUpdated or isGuideUpdated:
				myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)
			'''
            myIPTV.makeIPTVlist(iptvChannelsFile, portNum)
            myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
            myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)
            myIPTV.SaveChannelsLogos(iptvLogosDir)
Exemplo n.º 3
0
def SaveGuide(forceManual=False, showNotification=True):
    try:
        if showNotification:
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Saving Guide..., {1}, {2})".format(
                    AddonName, 300000, icon))
        isGuideUpdated = False
        if common.UpdateZipedFile(globalGuideFile,
                                  "globalGuide",
                                  remoteSettings,
                                  forceUpdate=True):
            isGuideUpdated = True
        if forceManual:
            common.UpdatePlx(plxFile, "plx", remoteSettings, forceUpdate=True)
            if myFilmon.MakePLXguide(filmonGuideFile):
                if showNotification:
                    xbmc.executebuiltin(
                        "XBMC.Notification({0}, Guide saved., {1}, {2})".
                        format(AddonName, 5000, icon))
                isGuideUpdated = True
            else:
                errMsg = "Can't create filmon's guide."
                print "{0} -> {1}".format(AddonName, errMsg)
                if showNotification:
                    xbmc.executebuiltin(
                        "XBMC.Notification({0}, {1}, {2}, {3})".format(
                            AddonName, errMsg, 5000, icon))
        else:
            if common.UpdateZipedFile(filmonGuideFile,
                                      "filmonGuide",
                                      remoteSettings,
                                      forceUpdate=True):
                if showNotification:
                    xbmc.executebuiltin(
                        "XBMC.Notification({0}, Guide saved., {1}, {2})".
                        format(AddonName, 5000, icon))
                isGuideUpdated = True
            else:
                if showNotification and not isGuideUpdated:
                    xbmc.executebuiltin(
                        "XBMC.Notification({0}, Guide is up to date., {1}, {2})"
                        .format(AddonName, 5000, icon))

        if isGuideUpdated:
            common.MergeGuides(globalGuideFile, filmonGuideFile, fullGuideFile)
        return True
    except Exception as ex:
        print ex
        if showNotification:
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Guide NOT saved!, {1}, {2})".format(
                    AddonName, 5000, icon))
        return False
Exemplo n.º 4
0
def CheckUpdates():
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           remoteSettingsUrl)
    if remoteSettings == []:
        return

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

    useIPTV = True if Addon.getSetting("useIPTV") == "true" else False

    package = remoteSettings["packages"]["full"]

    isM3uUpdated = False
    if common.UpdatePlx(
            package["url"], plxFile,
            refreshInterval=package["plxRefresh"] * 3600) and useIPTV:
        myIPTV.makeIPTVlist(os.path.join(user_dataDir, 'lists'),
                            "israelive.plx", "Main",
                            os.path.join(user_dataDir, "iptv.m3u"), portNum)
        isM3uUpdated = True

    if Addon.getSetting("useEPG") == "false":
        return

    isGuideUpdated = False
    if common.isFileOld(
            globalGuideFile, remoteSettings["globalGuide"]["refresh"] *
            3600) and common.UpdateZipedFile(
                globalGuideFile, remoteSettings["globalGuide"]["url"]):
        isGuideUpdated = True

    if common.isFileOld(filmonGuideFile,
                        package["refresh"] * 3600) and common.UpdateZipedFile(
                            filmonGuideFile, package["guide"]):
        isGuideUpdated = True

    if isGuideUpdated and useIPTV:
        myIPTV.MakeChannelsGuide(globalGuideFile,
                                 remoteSettings["globalGuide"]["url"],
                                 filmonGuideFile, package["guide"],
                                 os.path.join(user_dataDir, "guide.xml"))

    if isM3uUpdated or isGuideUpdated:
        myIPTV.RefreshPVR(os.path.join(user_dataDir, "iptv.m3u"),
                          os.path.join(user_dataDir, "guide.xml"),
                          os.path.join(user_dataDir, "logos"))
Exemplo n.º 5
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)
Exemplo n.º 6
0
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
Exemplo n.º 7
0
def MakeChannelsGuide(guideFile, guideUrl, filmonGuideFile, filmonGuideUrl,
                      xmlFile):
    guideList = common.ReadList(guideFile)
    if len(guideList) == 0:
        common.UpdateZipedFile(guideFile, guideUrl)
        guideList = common.ReadList(guideFile)
    filmonGuideList = common.ReadList(filmonGuideFile)
    if len(filmonGuideList) == 0:
        common.UpdateZipedFile(filmonGuideFile, filmonGuideUrl)
        filmonGuideList = common.ReadList(filmonGuideFile)

    FullGuideList = guideList + filmonGuideList
    if len(FullGuideList) == 0:
        return

    tz = GetTZ()

    channelsList = ""
    programmeList = ""
    for channel in FullGuideList:
        if type(channel["channel"]) is int:
            chName = "fil-{0}".format(channel["channel"])
        else:
            item = re.compile('^\[COLOR yellow\]\[B\](.*?)\[/B\]\[/COLOR\]$',
                              re.I + re.M + re.U + re.S).findall(
                                  channel["channel"].encode("utf-8"))
            chName = item[0] if item != [] else None
        channelsList += "\t<channel id=\"{0}\">\n\t\t<display-name>{0}</display-name>\n\t</channel>\n".format(
            chName)

        for programme in channel["tvGuide"]:
            start = time.localtime(programme["start"])
            end = time.localtime(programme["end"])
            name = EscapeXML(programme["name"].encode(
                "utf-8")) if programme["name"] != None else ""
            description = EscapeXML(programme["description"].encode(
                "utf-8")) if programme["description"] != None else ""
            programmeList += "\t<programme start=\"{0} {5}\" stop=\"{1} {5}\" channel=\"{2}\">\n\t\t<title>{3}</title>\n\t\t<desc>{4}</desc>\n\t</programme>\n".format(
                time.strftime("%Y%m%d%H%M%S", start),
                time.strftime("%Y%m%d%H%M%S", end), chName, name, description,
                tz)

    xmlList = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tv>\n{0}{1}</tv>".format(
        channelsList, programmeList)
    f = open(xmlFile, 'w')
    f.write(xmlList)
    f.close()
Exemplo n.º 8
0
def Update():
	remoteSettings = common.GetRemoteSettings()
	remoteSettings = common.GetUpdatedList(remoteSettingsFile, "remoteSettings", remoteSettings, forceUpdate=True)
	if remoteSettings == []:
		xbmc.executebuiltin('StartPVRManager')
	else:
		common.CheckNewVersion()
		#UA.CheckUA()
		# Update channels-lists files
		refresh = common.GetSubKeyValue(remoteSettings, "plx", "refresh")
		if not refresh is None:
			common.UpdatePlx(plxFile, "plx", remoteSettings, refreshInterval = refresh * 3600)

		# Update EPG files for LiveTV selected channels first
		isGuideUpdated = False
		if Addon.getSetting("useEPG") == "true":
			refresh = common.GetSubKeyValue(remoteSettings, "fullGuide", "refresh")
			if not refresh is None and common.isFileOld(fullGuideFile, refresh * 3600) and common.UpdateZipedFile(fullGuideFile, "fullGuide", remoteSettings):
				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)
				
		# Update LiveTV channels and EPG
		if Addon.getSetting("useIPTV") == "true":
			import myIPTV
			myIPTV.makeIPTVlist(iptvChannelsFile)
			if isGuideUpdated:
				myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
			myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)
		
		# Update EPG files for LiveTV non-sSelected 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 Addon.getSetting("useIPTV") == "true":
			myIPTV.SaveChannelsLogos(iptvLogosDir)

		checkInterval = 720 # 12 hours = 720 minutes
		try:
			checkInterval = remoteSettings["remoteSettings"]["refresh"] * 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))
Exemplo n.º 9
0
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 = []
            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",
Exemplo n.º 10
0
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:
	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 = []
			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)