diff --git a/src/onthespot/gui/mainui.py b/src/onthespot/gui/mainui.py index 622fede..3b54cfe 100644 --- a/src/onthespot/gui/mainui.py +++ b/src/onthespot/gui/mainui.py @@ -30,15 +30,20 @@ def __init__(self): def run(self): while True: if pending: - item_id = next(iter(pending)) # Get the first key - item = pending.pop(item_id) - token = get_account_token() - item_metadata = globals()[f"{item['item_service']}_get_{item['item_type']}_metadata"](token, item['item_id']) - self.add_item_to_download_list.emit(item, item_metadata) - continue + try: + item_id = next(iter(pending)) + item = pending.pop(item_id) + token = get_account_token() + item_metadata = globals()[f"{item['item_service']}_get_{item['item_type']}_metadata"](token, item['item_id']) + self.add_item_to_download_list.emit(item, item_metadata) + continue + except Exception as e: + logger.error(f"Unknown Exception for {item}: {str(e)}") + pending[item_id] = item else: time.sleep(4) + class MainWindow(QMainWindow): # Remove Later