Beispiel #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
Beispiel #2
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
Beispiel #3
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 #4
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))