def show(self, view_manager, give_focus=True): #Register the metadata callbacks if needed if self.__metadata_callbacks is None: self.__metadata_callbacks = MetadataUpdateCallbacks() session = view_manager.get_var('session') session.add_callbacks(self.__metadata_callbacks) if not self.is_visible() or not self.__list_rendered: BaseListContainerView.show(self, view_manager, give_focus) elif self.__list_rendered: self._update_metadata(view_manager)
def update_unavailable_tracks(self, view_manager): #Try acquiring the update lock if self.__update_lock.acquire(False): try: wait_time = 10 event = threading.Event() session = view_manager.get_var('session') m_cb = MetadataUpdateCallbacks(event) session.add_callbacks(m_cb) self.__update_unavailable = True while self.__update_unavailable and wait_time > 0: wait_time -= 1 event.wait(1) event.clear() if self._update_metadata(view_manager) == 0: self.__update_unavailable = False finally: session.remove_callbacks(m_cb) self.__update_lock.release()