changed logging_level to LOG_LEVEL

This commit is contained in:
ArabCoders 2024-02-26 17:36:49 +03:00
parent e20365a8e6
commit 0548e5e73a
3 changed files with 9 additions and 8 deletions

5
.vscode/launch.json vendored
View file

@ -23,7 +23,7 @@
}, },
{ {
"name": "Python: main.py", "name": "Python: main.py",
"type": "python", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "app/main.py", "program": "app/main.py",
"console": "internalConsole", "console": "internalConsole",
@ -31,7 +31,8 @@
"YTP_CONFIG_PATH": "${workspaceFolder}/var/config", "YTP_CONFIG_PATH": "${workspaceFolder}/var/config",
"YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads", "YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads",
"YTP_TEMP_PATH": "${workspaceFolder}/var/tmp", "YTP_TEMP_PATH": "${workspaceFolder}/var/tmp",
"YTP_URL_HOST": "http://localhost:8081" "YTP_URL_HOST": "http://localhost:8081",
"YTP_LOG_LEVEL": "DEBUG"
} }
} }
] ]

View file

@ -71,9 +71,9 @@ Certain values can be set via environment variables, using the `-e` parameter on
* __YTP_KEEP_ARCHIVE__: Whether to keep history of downloaded videos to prevent downloading same file multiple times. Defaults to `true`. * __YTP_KEEP_ARCHIVE__: Whether to keep history of downloaded videos to prevent downloading same file multiple times. Defaults to `true`.
* __YTP_YTDL_DEBUG__: Whether to turn debug logging for the internal `yt-dlp` package. Defaults to `false`. * __YTP_YTDL_DEBUG__: Whether to turn debug logging for the internal `yt-dlp` package. Defaults to `false`.
* __YTP_ALLOW_MANIFESTLESS__: Allow `yt-dlp` to download live streams videos which are yet to be processed by YouTube. Defaults to `false` * __YTP_ALLOW_MANIFESTLESS__: Allow `yt-dlp` to download live streams videos which are yet to be processed by YouTube. Defaults to `false`
* __YTP_HOST__: Which ip address to bind to. Defaults to `0.0.0.0`. * __YTP_HOST__: Which IP address to bind to. Defaults to `0.0.0.0`.
* __YTP_PORT__: Which port to bind to. Defaults to `8081`. * __YTP_PORT__: Which port to bind to. Defaults to `8081`.
* __YTP_LOGGING_LEVEL__: Logging level. Defaults to `info`. * __YTP_LOG_LEVEL__: Log level. Defaults to `info`.
* __YTP_MAX_WORKERS__: How many works to use for downloads. Defaults to `1`. * __YTP_MAX_WORKERS__: How many works to use for downloads. Defaults to `1`.
## Running behind a reverse proxy ## Running behind a reverse proxy
@ -130,7 +130,7 @@ Once there, you can use the yt-dlp command freely.
## Building and running locally ## Building and running locally
Make sure you have node.js and Python 3.11 installed. Make sure you have `node.js` and Python `3.11+` installed.
```bash ```bash
cd ytptube/frontend cd ytptube/frontend

View file

@ -33,7 +33,7 @@ class Config:
base_path: str = '' base_path: str = ''
logging_level: str = 'info' log_level: str = 'info'
allow_manifestless: bool = False allow_manifestless: bool = False
@ -110,9 +110,9 @@ class Config:
if not self.url_prefix.endswith('/'): if not self.url_prefix.endswith('/'):
self.url_prefix += '/' self.url_prefix += '/'
numeric_level = getattr(logging, self.logging_level.upper(), None) numeric_level = getattr(logging, self.log_level.upper(), None)
if not isinstance(numeric_level, int): if not isinstance(numeric_level, int):
raise ValueError(f"Invalid log level: {self.logging_level}") raise ValueError(f"Invalid log level: {self.log_level}")
coloredlogs.install( coloredlogs.install(
level=numeric_level, level=numeric_level,