Beispiel #1
0
def RefreshEPG():
    epgFile = os.path.join(addon_data_dir, 'guide.xml')
    #epgUrl = "http://thewiz.info/XBMC/_STATIC/guide.xml"
    epgUrl = "https://dl.dropboxusercontent.com/u/84359548/guide.xml"
    isNewEPG = common.UpdateFile(epgFile, epgUrl)
    UpdateIPTVSimpleSettings()
    return isNewEPG
Beispiel #2
0
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
Beispiel #3
0
def RefreshUserdataFolder():
	xbmc.executebuiltin("XBMC.Notification({0}, Cleaning addon profile folder..., {1}, {2})".format(AddonName, 300000 ,icon))
	settingsFile = os.path.join(user_dataDir, 'settings.xml')
	for the_file in os.listdir(user_dataDir):
		file_path = os.path.join(user_dataDir, the_file)
		try:
			if os.path.isfile(file_path) and file_path != FAV and file_path != settingsFile:
				os.unlink(file_path)
		except Exception as ex:
			xbmc.log("{0}".format(ex), 3)
	listsDir =  os.path.join(user_dataDir, 'lists')
	for the_file in os.listdir(listsDir):
		file_path = os.path.join(listsDir, the_file)
		try:
			if os.path.isfile(file_path) and file_path != selectedCategoriesFile:
				os.unlink(file_path)
		except Exception as ex:
			xbmc.log("{0}".format(ex), 3)
	xbmc.executebuiltin("XBMC.Notification({0}, Addon profile folder cleaned., {1}, {2})".format(AddonName, 5000 ,icon))
	CleanLogosFolder()
	remoteSettings = common.GetRemoteSettings()
	if not os.path.isfile(remoteSettingsFile):
		common.UpdateFile(remoteSettingsFile, "remoteSettingsZip", remoteSettings, zip=True, forceUpdate=True)
		remoteSettings = common.ReadList(remoteSettingsFile)
	if remoteSettings == []:
		xbmc.executebuiltin('Notification({0}, Cannot load settings, {1}, {2})'.format(AddonName, 5000, icon))
		return
	UpdateChannelsAndGuides()
Beispiel #4
0
def UpdateChannelsLists():
	xbmc.executebuiltin("XBMC.Notification({0}, Updating Channels Lists..., {1}, {2})".format(AddonName, 300000 ,icon))
	common.UpdateFile(remoteSettingsFile, "remoteSettingsZip", zip=True, forceUpdate=True)
	remoteSettings = common.ReadList(remoteSettingsFile)
	if remoteSettings == []:
		xbmc.executebuiltin('Notification({0}, Cannot load settings, {1}, {2})'.format(AddonName, 5000, icon))
		sys.exit()

	common.UpdateChList(remoteSettings)
	xbmc.executebuiltin("XBMC.Notification({0}, Channels Lists updated., {1}, {2})".format(AddonName, 5000 ,icon))
Beispiel #5
0
def SaveGuide(forceManual=False):
    try:
        xbmc.executebuiltin(
            "XBMC.Notification({0}, Making and saving Filmon's guide..., {1}, {2})"
            .format(AddonName, 300000, icon))
        plxList = common.ReadPlxList(plxListFile, plxListFileUrl)
        if forceManual == False:
            isNewGuideFile = common.UpdateFile(guideFile,
                                               plxList[PlxPlaylist]["guide"])
            if isNewGuideFile:
                xbmc.executebuiltin(
                    "XBMC.Notification({0}, Filmon's guide saved., {1}, {2})".
                    format(AddonName, 5000, icon))
                return
        myFilmon.MakePLXguide(plxList[PlxPlaylist]["url"], guideFile)
        xbmc.executebuiltin(
            "XBMC.Notification({0}, Filmon's guide saved., {1}, {2})".format(
                AddonName, 5000, icon))
    except:
        xbmc.executebuiltin(
            "XBMC.Notification({0}, Filmon's guide NOT saved!, {1}, {2})".
            format(AddonName, 5000, icon))
Beispiel #6
0
def CheckUpdates():
    if Addon.getSetting("saveFilmonEPG") == "false":
        return

    plxType = int(Addon.getSetting("PlxPlaylist"))
    if plxType == 0:
        PlxPlaylist = "zip"
        guideFile = os.path.join(user_dataDir, 'filmonZipGuide.txt')
    elif plxType == 1:
        PlxPlaylist = "light"
        guideFile = os.path.join(user_dataDir, 'filmonLightGuide.txt')
    else:
        PlxPlaylist = "full"
        guideFile = os.path.join(user_dataDir, 'filmonFullGuide.txt')

    plxList = common.ReadPlxList(plxListFile, plxListFileUrl)

    isNewGuideFile = common.UpdateFile(guideFile,
                                       plxList[PlxPlaylist]["guide"])
    if isNewGuideFile:
        return

    print "{0}: Updating filmonGuide localy.".format(AddonName)
    isGuideFileOld = common.isFileOld(guideFile, 24 * 3600)  # 24 hours
    if isGuideFileOld:
        try:
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Making and saving Filmon's guide..., {1}, {2})"
                .format(AddonName, 300000, icon))
            myFilmon.MakePLXguide(plxList[PlxPlaylist]["url"], guideFile)
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Filmon's guide saved., {1}, {2})".
                format(AddonName, 5000, icon))
        except:
            xbmc.executebuiltin(
                "XBMC.Notification({0}, Filmon's guide NOT saved!, {1}, {2})".
                format(AddonName, 5000, icon))
Beispiel #7
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))
Beispiel #8
0
__icon__ = os.path.join(artDir, "check2.png")
__icon2__ = os.path.join(artDir, "signQuestionMark.png")

user_dataDir = xbmc.translatePath(
    Addon.getAddonInfo("profile")).decode("utf-8")
if not os.path.exists(user_dataDir):
    os.makedirs(user_dataDir)
FAV = os.path.join(user_dataDir, 'favorites.txt')
if not (os.path.isfile(FAV)):
    common.WriteList(FAV, [])
remoteSettings = common.GetRemoteSettings()
remoteSettingsFile = os.path.join(user_dataDir, "remoteSettings.txt")
if not os.path.isfile(remoteSettingsFile):
    common.UpdateFile(remoteSettingsFile,
                      "remoteSettingsZip",
                      remoteSettings,
                      zip=True,
                      forceUpdate=True)
    remoteSettings = common.ReadList(remoteSettingsFile)
if remoteSettings == []:
    xbmc.executebuiltin(
        'Notification({0}, Cannot load settings, {1}, {2})'.format(
            AddonName, 5000, icon))
    sys.exit()
listsFile = os.path.join(user_dataDir, "israelive.list")
if not os.path.isfile(listsFile):
    common.UpdateChList(remoteSettings)
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")