def mark_season_collected(self, show_id, season, collected): cursor = self._get_cursor() cursor.execute('UPDATE episodes SET collected=? WHERE show_id=? AND season=?', (collected, show_id, season)) cursor.connection.commit() cursor.close() from activities import TraktSyncDatabase as activities_database sync_thread = threading.Thread(target=activities_database()._sync_collection_shows()) sync_thread.run()
def _update_watched(self, show_id): from activities import TraktSyncDatabase as activities_database progress = trakt.TraktAPI().json_response('shows/{}/progress/watched?' 'specials=true&extended=full'.format(show_id)) progress = [(show_id, season['number'], episode['number']) for season in progress['seasons'] for episode in season['episodes'] if episode['completed']] sync_thread = threading.Thread(target=activities_database()._mill_episodes, args=(progress, 1)) sync_thread.run()
def mark_show_watched(self, show_id, watched): cursor = self._get_cursor() cursor.execute('UPDATE episodes SET watched=? WHERE show_id=?', (watched, show_id,)) cursor.connection.commit() cursor.close() from activities import TraktSyncDatabase as activities_database sync_thread = threading.Thread(target=activities_database()._sync_watched_episodes()) sync_thread.run()
def mark_show_collected(self, show_id, collected): tools.traktSyncDB_lock.acquire() cursor = self._get_cursor() cursor.execute('UPDATE episodes SET collected=? WHERE show_id=?', (collected, show_id,)) cursor.connection.commit() cursor.close() tools.try_release_lock(tools.traktSyncDB_lock) from activities import TraktSyncDatabase as activities_database sync_thread = threading.Thread(target=activities_database()._sync_collection_shows()) sync_thread.run()