Example #1
0
def movieUpdatedNotifications():
    global updatedMovies
    if(addon.getSetting('shownotifications') == 'true'):
        moviesUpdatedCounter= updatedMovies.__len__()
        del updatedMovies[:]
        if(moviesUpdatedCounter > 0):
            xbmc.executebuiltin('Notification(%s,%s,%s,%s)' % (addon.getAddonInfo('name'),"%d movies updated on MMDB" % (moviesUpdatedCounter),7000,addon.getAddonInfo("icon")))
Example #2
0
        debug('--- NO CHANGES DETECTED ---')
    

# Constants
mmdb = MMDB(addon.getSetting('username'),addon.getSetting('password'))
xbmcApp = XBMCApp(xbmc.translatePath('special://database/%s' % addon.getSetting('database')))

# Globals
mmdb_library = []
recentlyFailedMovies = []
updatedMovies = []
# autoexecute addon on startup for older xbmc versions, remove this when xbmc.service goes live
# Auto exec info
AUTOEXEC_PATH = xbmc.translatePath( 'special://home/userdata/autoexec.py' )
AUTOEXEC_FOLDER_PATH = xbmc.translatePath( 'special://home/userdata/' )
AUTOEXEC_SCRIPT = '\nimport time;time.sleep(5);xbmc.executebuiltin("XBMC.RunScript(special://home/addons/%s/default.py)")\n' % addon.getAddonInfo('id')
# See if the autoexec.py file exists
if (os.path.exists(AUTOEXEC_PATH)):
    debug('Found autoexec')
    
    # Var to check if we're in autoexec.py
    found = False
    autostart = addon.getSetting('autostart') == 'true'
    autoexecfile = file(AUTOEXEC_PATH, 'r')
    filecontents = autoexecfile.readlines()
    autoexecfile.close()
    
    # Check if we're in it
    for line in filecontents:
        if line.find(addon.getAddonInfo('id')) > 0:
            debug('Found ourselves in autoexec')
Example #3
0
try:
    # Initial validation / first time run?
    if len(addon.getSetting('username')) == 0:
        raise RuntimeWarning('Addon not configured yet! please add your user-details.')

    # Constants
    mmdb = MMDB(addon.getSetting('username'),addon.getSetting('password'))
    xbmcApp = XBMCApp(xbmc.translatePath('special://database/%s' % addon.getSetting('database')))

    # Globals
    mmdb_library = []
    recentlyFailedMedia = []
    updatedMovies = []

    # Print addon information
    print "[ADDON] '%s: version %s' initialized!" % (addon.getAddonInfo('name'), addon.getAddonInfo('version'))
    if(addon.getSetting('shownotifications') == 'true'):
        xbmc.executebuiltin('Notification(%s,%s,%s,%s)' % (addon.getAddonInfo('name'),'is running!',3000,addon.getAddonInfo("icon")))
    
    # Main logic
    debug('initial import of mmdb library')
    getRemoteLibrary() #initial fetch
            
    syncWithMmdbRunsCounter= 0
    
    while not xbmc.abortRequested:
        debug('Syncing local library with mmdb')
        syncWithMMDB()       
        sleeper(300000) #5minutes
        syncWithMmdbRunsCounter += 1
        if syncWithMmdbRunsCounter % 12 == 0: #60minutes