Skip to content

Commit

Permalink
bug: fix key error
Browse files Browse the repository at this point in the history
  • Loading branch information
Drazzilb08 committed Feb 16, 2024
1 parent 4d70978 commit 9366551
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions modules/queinatorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def handle_queue(queue_dict, app):
else:
messages_dict[id]['messages'][message] = 1
if error:
if error in messages_dict[torrent]['messages']:
if error in messages_dict[id]['messages']:
messages_dict[id]['messages'][error] += 1
else:
messages_dict[id]['messages'][error] = 1
Expand Down Expand Up @@ -338,6 +338,8 @@ def process_instance(instance_type, url, api, pre_import_category, post_import_c

# Retrieve the queue from Radarr or Sonarr instance
queue = app.get_queue(instance_type)
logger.debug(f"Queue'{instance_type}'\n{json.dumps(queue, indent=4)}\n")

queue_dict = queued_items(queue, instance_type)

logger.debug(f"Queue items for '{instance_type}'\n{json.dumps(queue_dict, indent=4)}\n")
Expand All @@ -360,8 +362,6 @@ def process_instance(instance_type, url, api, pre_import_category, post_import_c
if messages_dict:
output_dict['queue'] = messages_dict

logger.debug(f"Queue items for '{instance_type}'\n{json.dumps(queue_dict, indent=4)}\n")

# Handle moving torrents from the queue to the specified categories in qBittorrent
messages_dict = handle_qbit(queue_dict, qb, post_import_category, pre_import_category, days_to_keep)
if messages_dict:
Expand Down
7 changes: 6 additions & 1 deletion util/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def setup_logger(log_level, script_name, max_logs=9):

# Add the file handler to the logger
logger.addHandler(handler)

# Configure console logging with the specified log level
console_handler = logging.StreamHandler()
if log_level == 'DEBUG':
Expand All @@ -85,5 +85,10 @@ def setup_logger(log_level, script_name, max_logs=9):

# Add the console handler to the logger
logger.addHandler(console_handler)

# Overwrite previous logger if exists
logging.getLogger(script_name).handlers.clear()
logging.getLogger(script_name).addHandler(handler)
logging.getLogger(script_name).addHandler(console_handler)

return logger

0 comments on commit 9366551

Please sign in to comment.