Merge pull request #104 from arabcoders/dev

Fixed parsing custom yt-dlp config.
This commit is contained in:
Abdulmohsen 2024-07-06 19:35:03 +03:00 committed by GitHub
commit b24dc89822
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

6
Pipfile.lock generated
View file

@ -253,11 +253,11 @@
}, },
"certifi": { "certifi": {
"hashes": [ "hashes": [
"sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516", "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b",
"sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56" "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"
], ],
"markers": "python_version >= '3.6'", "markers": "python_version >= '3.6'",
"version": "==2024.6.2" "version": "==2024.7.4"
}, },
"charset-normalizer": { "charset-normalizer": {
"hashes": [ "hashes": [

View file

@ -1,5 +1,6 @@
import asyncio import asyncio
from email.utils import formatdate from email.utils import formatdate
import json
import logging import logging
import os import os
import time import time
@ -211,6 +212,12 @@ class DownloadQueue:
ytdlp_config = ytdlp_config if ytdlp_config else {} ytdlp_config = ytdlp_config if ytdlp_config else {}
LOG.info(f'Adding {url=} {quality=} {format=} {folder=} {output_template=} {ytdlp_cookies=} {ytdlp_config=}') LOG.info(f'Adding {url=} {quality=} {format=} {folder=} {output_template=} {ytdlp_cookies=} {ytdlp_config=}')
if isinstance(ytdlp_config, str):
try:
ytdlp_config = json.loads(ytdlp_config)
except Exception as e:
LOG.error(f"Unable to load '{ytdlp_config=}'. {str(e)}")
return {'status': 'error', 'msg': f"Failed to parse json yt-dlp config. {str(e)}"}
already = set() if already is None else already already = set() if already is None else already