Beispiel #1
0
def update_library():
    is_updating = get_property("updating_library")
    is_syncing = get_property("syncing_library")
    now = time.time()
    if is_syncing and now - int(is_syncing) < plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60:
        plugin.log.info("Skipping library sync")
    else:
        if plugin.get_setting(SETTING_LIBRARY_SYNC_COLLECTION, bool) == True or plugin.get_setting(
                SETTING_LIBRARY_SYNC_WATCHLIST, bool) == True:
            try:
                set_property("syncing_library", int(now))
                if plugin.get_setting(SETTING_LIBRARY_SYNC_COLLECTION, bool) == True:
                    meta.library.tvshows.sync_trakt_collection()
                    meta.library.movies.sync_trakt_collection()
                if plugin.get_setting(SETTING_LIBRARY_SYNC_WATCHLIST, bool) == True:
                    meta.library.tvshows.sync_trakt_watchlist()
                    meta.library.movies.sync_trakt_watchlist()
            except: plugin.log.info("something went wrong")
            finally: clear_property("syncing_library")
        else: clear_property("syncing_library")
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return
    if plugin.get_setting(SETTING_LIBRARY_UPDATES, bool) == True:
        try:
            set_property("updating_library", int(now))
            meta.library.tvshows.update_library()
            meta.library.movies.update_library()
            meta.library.music.update_library()
        finally: clear_property("updating_library")
    else: clear_property("updating_library")
Beispiel #2
0
def update_library():
    import_tvdb()
    folder_path = plugin.get_setting(SETTING_TV_LIBRARY_FOLDER, unicode)
    if not xbmcvfs.exists(folder_path):
        return
    # get library folder
    library_folder = setup_library(folder_path)
    # get shows in library
    try:
        shows = xbmcvfs.listdir(library_folder)[0]
    except:
        shows = []
    # update each show
    clean_needed = False
    updated = 0
    for id in shows:
        id = int(id)
        # add to library
        with tvdb.session.cache_disabled():
            if add_tvshow_to_library(library_folder, tvdb[id]):
                clean_needed = True
        updated += 1
    if clean_needed:
        set_property("clean_library", 1)
    # start scan
    if updated > 0:
        if int(time.time()) - int(get_property("updating_library")) < plugin.get_setting(SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60:
            scan_library(type="video")
            set_property("updating_library", int(time.time()))
Beispiel #3
0
 def currently_playing(self):
     video_data = get_property("data")
     if video_data:
         try:
             video_data = json.loads(video_data)
             return self.get_episode_id(video_data.get("dbid"), video_data['tvdb'], video_data['season'], video_data['episode'])
         except KeyError: pass
     return None
Beispiel #4
0
 def onDatabaseUpdated(self, database):
     if database == "video":
         if get_property("clean_library"):
             xbmc.executebuiltin("XBMC.CleanLibrary(video, false)")
             clear_property("clean_library")
     if database == "music":
         # need to manualy change the database file to add strm files to it
         music_directory = plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER, unicode)
         self.add_folder_to_music_database(music_directory)
Beispiel #5
0
 def onDatabaseUpdated(self, database):
     if database == "video":
         if get_property("clean_library"):
             xbmc.executebuiltin("XBMC.CleanLibrary(video, false)")
             clear_property("clean_library")
     if database == "music":
         # need to manualy change the database file to add strm files to it
         music_directory = plugin.get_setting(SETTING_MUSIC_LIBRARY_FOLDER, unicode)
         self.add_folder_to_music_database(music_directory)
Beispiel #6
0
def update_library():
    # setup library folder
    library_folder = plugin.get_setting(SETTING_MOVIES_LIBRARY_FOLDER, unicode)
    if not xbmcvfs.exists(library_folder):
        return
    if int(time.time()) - int(
            get_property("updating_library")) < plugin.get_setting(
                SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60:
        scan_library(type="video")
        set_property("updating_library", int(time.time()))
Beispiel #7
0
def update_library():
    is_updating = get_property("updating_library")
    is_syncing = get_property("syncing_library")
    now = time.time()
    if is_syncing and now - int(is_syncing) < plugin.get_setting(
            SETTING_UPDATE_LIBRARY_INTERVAL, int) * 60:
        plugin.log.info("Skipping library sync")
    else:
        if plugin.get_setting(SETTING_LIBRARY_SYNC_COLLECTION,
                              bool) == True or plugin.get_setting(
                                  SETTING_LIBRARY_SYNC_WATCHLIST,
                                  bool) == True:
            try:
                set_property("syncing_library", int(now))
                if plugin.get_setting(SETTING_LIBRARY_SYNC_COLLECTION,
                                      bool) == True:
                    meta.library.tvshows.sync_trakt_collection()
                    meta.library.movies.sync_trakt_collection()
                if plugin.get_setting(SETTING_LIBRARY_SYNC_WATCHLIST,
                                      bool) == True:
                    meta.library.tvshows.sync_trakt_watchlist()
                    meta.library.movies.sync_trakt_watchlist()
            except:
                plugin.log.info("something went wrong")
            finally:
                clear_property("syncing_library")
        else:
            clear_property("syncing_library")
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return
    if plugin.get_setting(SETTING_LIBRARY_UPDATES, bool) == True:
        try:
            set_property("updating_library", int(now))
            meta.library.tvshows.update_library()
            meta.library.movies.update_library()
            meta.library.music.update_library()
        finally:
            clear_property("updating_library")
    else:
        clear_property("updating_library")
 def currently_playing(self):
     video_data = get_property("data")
     if video_data:
         try:
             video_data = json.loads(video_data)
             return self.get_episode_id(video_data.get("dbid"),
                                        video_data['tvdb'],
                                        video_data['season'],
                                        video_data['episode'])
         except KeyError:
             pass
     return None
Beispiel #9
0
def update_library():
    is_updating = get_property("updating_library")
    now = time.time()
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return
    if plugin.get_setting(SETTING_LIBRARY_UPDATES, bool) == True:
        try:
            set_property("updating_library", int(now))
            meta.library.tvshows.update_library()
            meta.library.movies.update_library()
            meta.library.music.update_library()
        finally: clear_property("updating_library")
    else: clear_property("updating_library")
Beispiel #10
0
def update_library():
    is_updating = get_property("updating_library")
    
    now = time.time()
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return
        
    try:
        set_property("updating_library", int(now))
        meta.library.tvshows.update_library()
        meta.library.movies.update_library()
    finally:
        clear_property("updating_library")
Beispiel #11
0
def update_library():
    is_updating = get_property("updating_library")

    now = time.time()
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return

    try:
        set_property("updating_library", int(now))
        meta.library.tvshows.update_library()
        meta.library.movies.update_library()
    finally:
        clear_property("updating_library")
Beispiel #12
0
def update_library():
    is_updating = get_property("updating_library")
    now = time.time()
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return
    if plugin.get_setting(SETTING_LIBRARY_UPDATES, converter=bool) == True:
        #plugin.notify(msg=_('Library'), title=_('Updating'), delay=5000, image=get_icon_path("metalliq"))
        try:
            set_property("updating_library", int(now))
            meta.library.tvshows.update_library()
            meta.library.movies.update_library()
            meta.library.music.update_library()
        finally:
            clear_property("updating_library")
    else:
        #plugin.notify(msg=_('Library'), title=_('Not updating'), delay=5000, image=get_icon_path("metalliq"))
        clear_property("updating_library")
Beispiel #13
0
def update_library():
    is_updating = get_property("updating_library")
    now = time.time()
    if is_updating and now - int(is_updating) < 120:
        plugin.log.debug("Skipping library update")
        return
    if plugin.get_setting(SETTING_LIBRARY_UPDATES, converter=bool) == True:
        # plugin.notify(msg=_('Library'), title=_('Updating'), delay=5000, image=get_icon_path("metalliq"))
        try:
            set_property("updating_library", int(now))
            meta.library.tvshows.update_library()
            meta.library.movies.update_library()
            meta.library.music.update_library()
        finally:
            clear_property("updating_library")
    else:
        # plugin.notify(msg=_('Library'), title=_('Not updating'), delay=5000, image=get_icon_path("metalliq"))
        clear_property("updating_library")
Beispiel #14
0
 def onDatabaseUpdated(self, database):
     if database == "video":
         if get_property("clean_library"):
             xbmc.executebuiltin("XBMC.CleanLibrary(video, false)")
             clear_property("clean_library")
Beispiel #15
0
 def onDatabaseUpdated(self, database):
     if database == "video":
         if get_property("clean_library"):
             xbmc.executebuiltin("XBMC.CleanLibrary(video, false)")
             clear_property("clean_library")