import resources.lib.utils as utils
from service import AutoUpdater

#run the program
utils.log("Update Library Service starting...")
AutoUpdater().runProgram()
import xbmcgui
import resources.lib.utils as utils
from service import AutoUpdater

autoUpdate = AutoUpdater()
runUpdate = False

if(utils.getSetting('disable_manual_prompt') == 'false'):
    nextRun = autoUpdate.showNotify(False)
    #check if we should run updates
    runUpdate = xbmcgui.Dialog().yesno(utils.getString(30000),utils.getString(30060) + nextRun,line2=utils.getString(30061),autoclose=6000)
else:
    #the user has elected to skip the prompt
    runUpdate = True

if(runUpdate):
    #run the program
    utils.log("Update Library Manual Run...")

    #trick the auto updater into resetting the last_run time
    autoUpdate.last_run = 0
    autoUpdate.writeLastRun()

    #update the schedules and evaluate them
    autoUpdate.createSchedules(True)
    autoUpdate.evalSchedules()

    #delete the monitor before exiting
    del autoUpdate.monitor
import xbmc
import xbmcaddon
import xbmcgui
from service import AutoUpdater
addon_id = "service.libraryautoupdate"
Addon = xbmcaddon.Addon(addon_id)

autoUpdate = AutoUpdater()

nextRun = autoUpdate.showNotify(False)
#check if we should run updates
runUpdate = xbmcgui.Dialog().yesno(Addon.getLocalizedString(30010),Addon.getLocalizedString(30011) + nextRun,Addon.getLocalizedString(30012))

if(runUpdate):
    #run the program
    autoUpdate.log("Update Library Manual Run...")

    #trick the auto updater into resetting the last_run time
    autoUpdate.last_run = 0
    autoUpdate.writeLastRun()

    #update the schedules and evaluate them
    autoUpdate.createSchedules(True)
    autoUpdate.evalSchedules()