Skip to content

Commit

Permalink
Fixed subscription import bug
Browse files Browse the repository at this point in the history
  • Loading branch information
j54j6 committed Sep 22, 2024
1 parent df80d08 commit a836848
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/functionality_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
shell: bash
- name: Import subscription
run: |
python3 ./yt_manager.py import-subscriptions ./ytdownloader/subscriptions_export.json True
python3 ./yt_manager.py import-subscriptions ./ytdownloader/subscriptions_export.json --overwrite True
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo "Command succeeded with exit code 0"
Expand Down
3 changes: 2 additions & 1 deletion project_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,12 @@ def import_subscriptions(path="./", delelte_current_subscriptions=False):
error_raised = False
failed_imports = []
for subscription in subscriptions:
format_list = json.loads(subscription["output_format"])
success = add_subscription(subscription["subscription_path"],
subscription["downloaded_content_count"],
subscription["subscription_last_checked"],
subscription["last_subscription_data"],
subscription["output_format"])
format_list)
if not success:
error_raised = True
failed_imports.append(subscription["subscription_name"])
Expand Down
14 changes: 5 additions & 9 deletions yt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,11 @@ def main():
# Execute the command
command_func = commands.get(args.command)
if command_func:
try:
NO_ERROR = command_func()
if NO_ERROR:
sys.exit(0)
else:
logging.error("Command execution failed.")
sys.exit(1)
except Exception as e:
logging.error(f"An error occurred: {str(e)}")
NO_ERROR = command_func()
if NO_ERROR:
sys.exit(0)
else:
logging.error("Command execution failed.")
sys.exit(1)
else:
logging.error("Invalid command. Showing help.")
Expand Down
1 change: 1 addition & 0 deletions ytdownloader/subscriptions_export.json
Original file line number Diff line number Diff line change
@@ -0,0 +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\"]"}]

0 comments on commit a836848

Please sign in to comment.