Make it possible to override the pictures backends urls.
This commit is contained in:
parent
581442d235
commit
fa73e817a6
3 changed files with 15 additions and 8 deletions
|
|
@ -111,6 +111,7 @@ Certain configuration values can be set via environment variables, using the `-e
|
|||
| YTP_PIP_PACKAGES | A space separated list of pip packages to install | `empty string` |
|
||||
| YTP_PIP_IGNORE_UPDATES | Do not update the custom pip packages | `false` |
|
||||
| YTP_BASIC_MODE | Whether to run WebUI in basic mode | `false` |
|
||||
| YTP_PICTURES_BACKENDS | A comma separated list of pictures urls to use. | `empty string` |
|
||||
|
||||
# Browser extensions & bookmarklets
|
||||
|
||||
|
|
|
|||
|
|
@ -1401,16 +1401,10 @@ class HttpAPI(Common):
|
|||
Response: The response object.
|
||||
|
||||
"""
|
||||
backends: list[str] = [
|
||||
"https://unsplash.it/1920/1080?random",
|
||||
"https://picsum.photos/1920/1080",
|
||||
"https://spaceholder.cc/i/1920x1080",
|
||||
"https://imageipsum.com/1920x1080",
|
||||
"https://placedog.net/1920/1080",
|
||||
]
|
||||
backend = random.choice(backends) # noqa: S311
|
||||
backend = None
|
||||
|
||||
try:
|
||||
backend = random.choice(self.config.pictures_backends) # noqa: S311
|
||||
CACHE_KEY = "random_background"
|
||||
|
||||
if self.cache.has(CACHE_KEY) and not request.query.get("force", False):
|
||||
|
|
|
|||
|
|
@ -146,6 +146,15 @@ class Config:
|
|||
console_enabled: bool = False
|
||||
"Enable direct access to yt-dlp console."
|
||||
|
||||
pictures_backends: list[str] = [
|
||||
"https://unsplash.it/1920/1080?random",
|
||||
"https://picsum.photos/1920/1080",
|
||||
"https://spaceholder.cc/i/1920x1080",
|
||||
"https://imageipsum.com/1920x1080",
|
||||
"https://placedog.net/1920/1080",
|
||||
]
|
||||
"The list of picture backends to use for the background."
|
||||
|
||||
_manual_vars: tuple = (
|
||||
"temp_path",
|
||||
"config_path",
|
||||
|
|
@ -282,6 +291,9 @@ class Config:
|
|||
if k in self._int_vars:
|
||||
setattr(self, k, int(v))
|
||||
|
||||
if isinstance(self.pictures_backends, str) and self.pictures_backends:
|
||||
self.pictures_backends = self.pictures_backends.split(",")
|
||||
|
||||
numeric_level = getattr(logging, self.log_level.upper(), None)
|
||||
if not isinstance(numeric_level, int):
|
||||
msg = f"Invalid log level '{self.log_level}' specified."
|
||||
|
|
|
|||
Loading…
Reference in a new issue