Skip to content

Commit

Permalink
Fixed bug when no data given as output format
Browse files Browse the repository at this point in the history
  • Loading branch information
j54j6 committed Sep 22, 2024
1 parent a836848 commit ef41be4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion project_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,15 @@ def import_subscriptions(path="./", delelte_current_subscriptions=False):
error_raised = False
failed_imports = []
for subscription in subscriptions:
format_list = json.loads(subscription["output_format"])
try:
if subscription["output_format"] is not None and len(subscription["output_format"]) > 0:
format_list = json.loads(subscription["output_format"])
else:
format_list = None
except json.JSONDecodeError:
logger.error("Error while inserting output format for subscription! - Use NONE!")
format_list = None

success = add_subscription(subscription["subscription_path"],
subscription["downloaded_content_count"],
subscription["subscription_last_checked"],
Expand Down
2 changes: 1 addition & 1 deletion ytdownloader/subscriptions_export.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"subscription_path": "https://www.youtube.com/@homedecorideas3017/videos", "subscription_last_checked": "2024-09-22 18:39:16", "downloaded_content_count": 0, "last_subscription_data": null, "subscription_name": "@homedecorideas3017", "output_format": "[\"m4a\"]"}]
[{"subscription_path": "https://www.youtube.com/@homedecorideas3017/videos", "subscription_last_checked": "2024-09-22 18:39:16", "downloaded_content_count": 0, "last_subscription_data": null, "subscription_name": "@homedecorideas3017", "output_format": ""}]

0 comments on commit ef41be4

Please sign in to comment.