def _get_complete_show_finished_cb(self, show, error): self.emit(self.GET_FULL_SHOW_COMPLETE_SIGNAL, show, error) async_worker = AsyncWorker(True) async_item = AsyncItem(self._set_show_images, (show,), None,) async_worker.queue.put(async_item) async_worker.start()
def search_shows(self, terms, language = "en"): if not terms: return [] async_worker = AsyncWorker(True) async_item = AsyncItem(self.thetvdb.get_matching_shows, (terms, language,), self._search_finished_callback) async_worker.queue.put(async_item) async_worker.start()
def get_complete_show(self, show_name, language = "en"): show_id = self._cached_tvdb_shows.get(show_name, None) for show_id, show_title in self._cached_tvdb_shows.items(): if show_title == show_name: break if not show_id: return async_worker = AsyncWorker(False) async_item = AsyncItem(self._get_complete_show_from_id, (show_id, language,), self._get_complete_show_finished_cb) async_worker.queue.put(async_item) async_worker.start()
def update_all_shows_episodes(self, show_list = []): show_list = show_list or self.series_list async_worker = AsyncWorker(False) update_images_worker = AsyncWorker(True) i = 0 n_shows = len(show_list) for i in range(n_shows): show = show_list[i] async_item = AsyncItem(self.thetvdb.get_show_and_episodes, (show.thetvdb_id, show.language,), self._set_show_episodes_complete_cb, (show, update_images_worker, i == n_shows - 1)) async_worker.queue.put(async_item) async_item = AsyncItem(self._set_show_images, (show,), None,) update_images_worker.queue.put(async_item) async_worker.start() return async_worker
def _run_non_locking_task(self, method, args=(), name=""): worker = AsyncWorker(name) worker.add_task(method, args) worker.start() self._active_threads.append(worker)
def _run_locking_task(self, method, args=()): worker = AsyncWorker() worker.add_task(self._view.update_async, (self._lock_ui, )) worker.add_task(method, args) worker.add_task(self._view.update_async, (self._unlock_ui, )) worker.start()