Example #1
0
def MakeIPTVlists():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Making IPTV channels list..., {1}, {2})".
        format(AddonName, 300000, icon))
    portNum = 65007
    try:
        portNum = int(Addon.getSetting("LiveStreamerPort"))
    except:
        pass
    import myIPTV
    if not os.path.isfile(plxFile):
        common.UpdatePlx(package["url"], plxFile)
    myIPTV.makeIPTVlist(user_dataDir, "israelive.plx", "Main",
                        os.path.join(user_dataDir, "iptv.m3u"), portNum)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Making IPTV TV-guide..., {1}, {2})".format(
            AddonName, 300000, icon))
    myIPTV.MakeChannelsGuide(globalGuideFile,
                             remoteSettings["globalGuide"]["url"],
                             filmonGuideFile, package["guide"],
                             os.path.join(user_dataDir, "guide.xml"))
    myIPTV.RefreshPVR(os.path.join(user_dataDir, "iptv.m3u"),
                      os.path.join(user_dataDir, "guide.xml"),
                      os.path.join(user_dataDir, "logos"))
    xbmc.executebuiltin(
        "XBMC.Notification({0}, IPTV channels list and TV-guide created., {1}, {2})"
        .format(AddonName, 5000, icon))
Example #2
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
Example #3
0
def DownloadLogos():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Downloading channels logos..., {1}, {2})".
        format(AddonName, 300000, icon))
    if not os.path.isfile(plxFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)
    myIPTV.SaveChannelsLogos(iptvLogosDir)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Channels logos saved., {1}, {2})".format(
            AddonName, 5000, icon))
Example #4
0
def DownloadLogos():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Downloading channels logos..., {1}, {2})".
        format(AddonName, 300000, icon))
    import myIPTV
    if not os.path.isfile(plxFile):
        common.UpdatePlx(remoteSettings["plxUrl"], plxFile)
    myIPTV.SaveChannelsLogos(iptvLogosDir)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Channels logos saved., {1}, {2})".format(
            AddonName, 5000, icon))
Example #5
0
def DownloadLogos():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Downloading channels logos..., {1}, {2})".
        format(AddonName, 300000, icon))
    import myIPTV
    if not os.path.isfile(plxFile):
        common.UpdatePlx(package["url"], plxFile)
    myIPTV.SaveChannelsLogos(user_dataDir, "israelive.plx", "Main",
                             os.path.join(user_dataDir, "logos"))
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Chhannels logos saved., {1}, {2})".format(
            AddonName, 5000, icon))
Example #6
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
Example #7
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)
Example #8
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"))
Example #9
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 #10
0
def MakeIPTVlists():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Making IPTV channels list..., {1}, {2})".
        format(AddonName, 300000, icon))
    if not os.path.isfile(plxFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)
    myIPTV.makeIPTVlist(iptvChannelsFile)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Making IPTV TV-guide..., {1}, {2})".format(
            AddonName, 300000, icon))
    myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
    myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, IPTV channels list and TV-guide created., {1}, {2})"
        .format(AddonName, 5000, icon))
Example #11
0
def UpdateChannelsLists():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Updating Channels Lists..., {1}, {2})".format(
            AddonName, 300000, icon))
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           remoteSettingsUrl)
    if remoteSettings == []:
        xbmc.executebuiltin(
            'Notification({0}, Cannot load settings, {1}, {2})'.format(
                AddonName, 5000, icon))
        sys.exit()
    package = remoteSettings["packages"]["full"]
    common.UpdatePlx(package["url"], plxFile)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Channels Lists updated., {1}, {2})".format(
            AddonName, 5000, icon))
Example #12
0
def AddCategories():
    if not os.path.isfile(categoriesFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)
    allCatList = common.ReadList(categoriesFile)
    selectedCatList = common.ReadList(selectedCategoriesFile)
    categories = common.GetUnSelectedList(allCatList, selectedCatList)
    categoriesNames = [
        u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"),
                                                  item["name"])
        for item in categories
    ]
    selected = common.GetMultiChoiceSelected(
        localizedString(30503).encode('utf-8'), categoriesNames)
    if len(selected) < 1:
        return
    selectedList = [categories[item] for item in selected]
    common.WriteList(selectedCategoriesFile, selectedCatList + selectedList)
Example #13
0
def UpdateChannelsLists():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Updating Channels Lists..., {1}, {2})".format(
            AddonName, 300000, icon))
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           "remoteSettings",
                                           forceUpdate=True)
    if remoteSettings == []:
        xbmc.executebuiltin(
            'Notification({0}, Cannot load settings, {1}, {2})'.format(
                AddonName, 5000, icon))
        sys.exit()

    common.UpdatePlx(plxFile, "plx", remoteSettings, forceUpdate=True)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Channels Lists updated., {1}, {2})".format(
            AddonName, 5000, icon))
Example #14
0
def RemoveCategories():
    if not os.path.isfile(categoriesFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)

    selectedCatList = common.ReadList(selectedCategoriesFile)
    categories = [
        u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"),
                                                  item["name"])
        for item in selectedCatList
    ]
    selected = common.GetMultiChoiceSelected(
        localizedString(30503).encode('utf-8'), categories)
    if len(selected) < 1:
        return
    for ind in range(len(selected) - 1, -1, -1):
        selectedCatList.remove(selectedCatList[selected[ind]])

    common.WriteList(selectedCategoriesFile, selectedCatList)
Example #15
0
def MakeIPTVlists():
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Making IPTV channels list..., {1}, {2})".
        format(AddonName, 300000, icon))
    portNum = 65007
    try:
        portNum = int(Addon.getSetting("LiveStreamerPort"))
    except:
        pass
    if not os.path.isfile(plxFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)
    myIPTV.makeIPTVlist(iptvChannelsFile, portNum)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, Making IPTV TV-guide..., {1}, {2})".format(
            AddonName, 300000, icon))
    myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
    myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)
    xbmc.executebuiltin(
        "XBMC.Notification({0}, IPTV channels list and TV-guide created., {1}, {2})"
        .format(AddonName, 5000, icon))
Example #16
0
def AddCategories():
    if not os.path.isfile(categoriesFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)

    allCatList = common.ReadList(categoriesFile)
    selectedCatList = common.ReadList(selectedCategoriesFile)
    showCat = []
    for index, cat in enumerate(allCatList):
        if not any(f["id"] == cat.get("id", "") for f in selectedCatList):
            showCat.append(cat)

    categories = [
        u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"),
                                                  item["name"])
        for item in showCat
    ]
    selected = common.GetMultiChoiceSelected(
        localizedString(30503).encode('utf-8'), categories)
    if len(selected) < 1:
        return

    selectedList = [showCat[item] for item in selected]
    common.WriteList(selectedCategoriesFile, selectedCatList + selectedList)
Example #17
0
    remoteSettings = common.ReadList(remoteSettingsFile)
else:
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           remoteSettingsUrl)

if remoteSettings == []:
    xbmc.executebuiltin(
        'Notification({0}, Cannot load settings, {1}, {2})'.format(
            AddonName, 5000, icon))
    sys.exit()

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

plxFile = os.path.join(user_dataDir, "israelive.plx")
if not os.path.isfile(plxFile):
    common.UpdatePlx(package["url"], plxFile)

globalGuideFile = os.path.join(user_dataDir, "guide.txt")
filmonGuideFile = os.path.join(user_dataDir, 'filmonFullGuide.txt')
epgGlobal = None
epgFilmon = None

useEPG = Addon.getSetting("useEPG") == "true"


def CATEGORIES():
    repoCheck.UpdateRepo()
    addDir(
        "[COLOR green][B][{0}][/B][/COLOR]".format(
            localizedString(30000).encode('utf-8')), 'favorits', 16,
        'http://cdn3.tnwcdn.com/files/2010/07/bright_yellow_star.png', '')
Example #18
0
remoteSettingsFile = os.path.join(user_dataDir, "remoteSettings.txt")
if not os.path.isfile(remoteSettingsFile):
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           "remoteSettings",
                                           remoteSettings,
                                           forceUpdate=True)

if remoteSettings == []:
    xbmc.executebuiltin(
        'Notification({0}, Cannot load settings, {1}, {2})'.format(
            AddonName, 5000, icon))
    sys.exit()

plxFile = os.path.join(user_dataDir, "israelive.plx")
if not os.path.isfile(plxFile):
    common.UpdatePlx(plxFile, "plx", remoteSettings, forceUpdate=True)

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")
listsDir = os.path.join(user_dataDir, 'lists')
categoriesFile = os.path.join(listsDir, 'categories.list')
selectedCategoriesFile = os.path.join(listsDir, 'selectedCategories.list')

useCategories = Addon.getSetting("useCategories") == "true"
useRtmp = Addon.getSetting("StreramProtocol") == "1"
useIPTV = Addon.getSetting("useIPTV") == "true"
useEPG = Addon.getSetting("useEPG") == "true"
epg = None
Example #19
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:
    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")
Example #20
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))
Example #21
0
remoteSettingsUrl = Addon.getSetting("remoteSettingsUrl")
if os.path.isfile(remoteSettingsFile):
    remoteSettings = common.ReadList(remoteSettingsFile)
else:
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           remoteSettingsUrl)

if remoteSettings == []:
    xbmc.executebuiltin(
        'Notification({0}, Cannot load settings, {1}, {2})'.format(
            AddonName, 5000, icon))
    sys.exit()

plxFile = os.path.join(user_dataDir, "pallive.plx")
if not os.path.isfile(plxFile):
    common.UpdatePlx(remoteSettings["plxUrl"], plxFile)

globalGuideFile = os.path.join(user_dataDir, "guide.txt")
filmonGuideFile = os.path.join(user_dataDir, 'filmonGuide.txt')
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")

useIPTV = Addon.getSetting("useIPTV") == "true"
useEPG = Addon.getSetting("useEPG") == "true"
epg = None


def CATEGORIES():
    repoCheck.UpdateRepo()
Example #22
0
def AddUserChannelToFavorites():
    chName = common.GetKeyboardText(
        localizedString(30225).encode('utf-8')).strip()
    if len(chName) < 1:
        return
    chUrl = common.GetKeyboardText(
        localizedString(30226).encode('utf-8')).strip()
    if len(chUrl) < 1:
        return

    if not os.path.isfile(categoriesFile):
        common.UpdatePlx(plxFile, "plx", forceUpdate=True)
    categories = common.ReadList(categoriesFile)
    categoriesNames = [
        u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"),
                                                  item["name"])
        for item in categories
    ]
    categoryInd = common.GetMenuSelected(
        localizedString(30227).encode('utf-8'), categoriesNames)
    if categoryInd == -1:
        return
    group = categories[categoryInd]["id"]
    chTypeInd = common.GetMenuSelected(
        localizedString(30232).encode('utf-8'), [
            localizedString(30233).encode('utf-8'),
            localizedString(30234).encode('utf-8')
        ])
    if chTypeInd == 0:
        chType = "video"
    elif chTypeInd == 1:
        chType = "audio"
    else:
        return
    logoInd = common.GetMenuSelected(
        localizedString(30228).encode('utf-8'), [
            localizedString(30229).encode('utf-8'),
            localizedString(30230).encode('utf-8'),
            localizedString(30231).encode('utf-8')
        ])
    if logoInd == 0:
        logoFile = common.GetKeyboardText(
            localizedString(30229).encode('utf-8')).strip()
        if len(logoFile) < 1:
            return
    elif logoInd == 1:
        logoFile = xbmcgui.Dialog().browse(
            int(1),
            localizedString(30230).encode('utf-8'), 'myprograms')
        if logoFile is None or len(logoFile) < 1:
            return
    elif logoInd == 2:
        logoFile = ""
    else:
        return

    favsList = common.ReadList(FAV)
    for channel in favsList:
        if channel["url"].lower() == chUrl.lower():
            xbmc.executebuiltin(
                'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  Already in favourites, {3}, {4})'
                .format(AddonName, Addon.getSetting("chColor"), chName, 5000,
                        __icon2__))
            return

    data = {
        "url": chUrl.decode("utf-8"),
        "group": group,
        "image": logoFile.decode("utf-8"),
        "type": chType,
        "name": chName.decode("utf-8")
    }

    favsList.append(data)
    if common.WriteList(FAV, favsList):
        xbmc.executebuiltin(
            'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  added to favourites, {3}, {4})'
            .format(AddonName, Addon.getSetting("chColor"), chName, 5000,
                    __icon__))
Example #23
0
if os.path.isfile(remoteSettingsFile):
    remoteSettings = common.ReadList(remoteSettingsFile)
else:
    remoteSettings = common.GetUpdatedList(remoteSettingsFile,
                                           remoteSettingsUrl,
                                           forceUpdate=True)

if remoteSettings == []:
    xbmc.executebuiltin(
        'Notification({0}, Cannot load settings, {1}, {2})'.format(
            AddonName, 5000, icon))
    sys.exit()

plxFile = os.path.join(user_dataDir, "israelive.plx")
if not os.path.isfile(plxFile):
    common.UpdatePlx(remoteSettings["plxUrl"], plxFile, forceUpdate=True)

globalGuideFile = os.path.join(user_dataDir, "guide.txt")
filmonGuideFile = os.path.join(user_dataDir, 'filmonGuide.txt')
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")
listsDir = os.path.join(user_dataDir, 'lists')

useCategories = Addon.getSetting("useCategories") == "true"
categoriesFile = os.path.join(listsDir, 'categories.list')
selectedCategoriesFile = os.path.join(listsDir, 'selectedCategories.list')

useIPTV = Addon.getSetting("useIPTV") == "true"
useEPG = Addon.getSetting("useEPG") == "true"