Merge pull request #374 from arabcoders/dev
Some checks failed
Build WebView wrappers / build (amd64, ubuntu-latest) (push) Has been cancelled
Build WebView wrappers / build (amd64, windows-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, macos-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, ubuntu-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, windows-latest) (push) Has been cancelled
Some checks failed
Build WebView wrappers / build (amd64, ubuntu-latest) (push) Has been cancelled
Build WebView wrappers / build (amd64, windows-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, macos-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, ubuntu-latest) (push) Has been cancelled
Build WebView wrappers / build (arm64, windows-latest) (push) Has been cancelled
Make playlist_index works
This commit is contained in:
commit
286d8ce818
7 changed files with 1632 additions and 1554 deletions
|
|
@ -291,11 +291,10 @@ class Download:
|
|||
|
||||
if isinstance(self.info_dict, dict) and len(self.info_dict) > 1:
|
||||
self.logger.debug(f"Downloading '{self.info.url}' using pre-info.")
|
||||
cls.process_ie_result(
|
||||
ie_result=self.info_dict,
|
||||
download=True,
|
||||
extra_info={k: v for k, v in self.info.extras.items() if k not in self.info_dict},
|
||||
)
|
||||
_dct: dict = self.info_dict.copy()
|
||||
_dct.update([{k: v for k, v in self.info.extras.items() if k not in _dct or not _dct.get(k)}])
|
||||
|
||||
cls.process_ie_result(ie_result=_dct, download=True)
|
||||
ret: int = cls._download_retcode
|
||||
else:
|
||||
self.logger.debug(f"Downloading using url: {self.info.url}")
|
||||
|
|
|
|||
|
|
@ -310,6 +310,20 @@ class DownloadQueue(metaclass=Singleton):
|
|||
playlistCount = int(entry.get("playlist_count", len(entries)))
|
||||
results = []
|
||||
|
||||
playlist_keys = {
|
||||
"playlist_count": playlistCount,
|
||||
"playlist": entry.get("title") or entry.get("id"),
|
||||
"playlist_id": entry.get("id"),
|
||||
"playlist_title": entry.get("title"),
|
||||
"playlist_uploader": entry.get("uploader"),
|
||||
"playlist_uploader_id": entry.get("uploader_id"),
|
||||
"playlist_channel": entry.get("channel"),
|
||||
"playlist_channel_id": entry.get("channel_id"),
|
||||
"playlist_webpage_url": entry.get("webpage_url"),
|
||||
"__last_playlist_index": playlistCount - 1,
|
||||
"n_entries": len(entries),
|
||||
}
|
||||
|
||||
async def playlist_processor(i: int, etr: dict):
|
||||
await self.processors.acquire()
|
||||
try:
|
||||
|
|
@ -322,16 +336,9 @@ class DownloadQueue(metaclass=Singleton):
|
|||
return {"status": "error", "msg": _msg}
|
||||
|
||||
extras = {
|
||||
"playlist": entry.get("title") or entry.get("id"),
|
||||
"playlist_count": playlistCount,
|
||||
"playlist_id": entry.get("id"),
|
||||
"playlist_title": entry.get("title"),
|
||||
"playlist_uploader": entry.get("uploader"),
|
||||
"playlist_uploader_id": entry.get("uploader_id"),
|
||||
"playlist_channel": entry.get("channel"),
|
||||
"playlist_channel_id": entry.get("channel_id"),
|
||||
"playlist_webpage_url": entry.get("webpage_url"),
|
||||
**playlist_keys,
|
||||
"playlist_index": i,
|
||||
"playlist_index_number": i,
|
||||
"playlist_autonumber": i,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from urllib.parse import urlparse
|
|||
import httpx
|
||||
from aiohttp import web
|
||||
from aiohttp.web import Request, Response
|
||||
from yt_dlp.utils.networking import random_user_agent
|
||||
|
||||
from app.library.ag_utils import ag
|
||||
from app.library.cache import Cache
|
||||
|
|
@ -47,7 +48,7 @@ async def get_thumbnail(request: Request, config: Config) -> Response:
|
|||
"proxy": ytdlp_args.get("proxy", None),
|
||||
"headers": {
|
||||
"User-Agent": ytdlp_args.get(
|
||||
"user_agent", request.headers.get("User-Agent", f"YTPTube/{config.app_version}")
|
||||
"user_agent", request.headers.get("User-Agent", random_user_agent())
|
||||
),
|
||||
},
|
||||
}
|
||||
|
|
@ -118,7 +119,7 @@ async def get_background(request: Request, config: Config, cache: Cache) -> Resp
|
|||
opts = {
|
||||
"proxy": ytdlp_args.get("proxy", None),
|
||||
"headers": {
|
||||
"User-Agent": ytdlp_args.get("user_agent", f"YTPTube/{config.app_version}"),
|
||||
"User-Agent": ytdlp_args.get("user_agent", random_user_agent()),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from aiohttp.web import Request, Response
|
|||
|
||||
from app.library.cache import Cache
|
||||
from app.library.config import Config
|
||||
from app.library.Presets import Preset, Presets
|
||||
from app.library.Presets import Presets
|
||||
from app.library.router import route
|
||||
from app.library.Utils import REMOVE_KEYS, arg_converter, extract_info, validate_url
|
||||
from app.library.YTDLPOpts import YTDLPOpts
|
||||
|
|
@ -105,17 +105,18 @@ async def get_info(request: Request, cache: Cache, config: Config) -> Response:
|
|||
status=web.HTTPBadRequest.status_code,
|
||||
)
|
||||
|
||||
opts = YTDLPOpts.get_instance()
|
||||
opts: YTDLPOpts = YTDLPOpts.get_instance()
|
||||
|
||||
preset: str = request.query.get("preset", config.default_preset)
|
||||
exists: Preset | None = Presets.get_instance().get(preset)
|
||||
if not exists:
|
||||
if not Presets.get_instance().get(preset):
|
||||
msg: str = f"Preset '{preset}' does not exist."
|
||||
return web.json_response(
|
||||
data={"status": False, "message": msg, "error": msg},
|
||||
status=web.HTTPBadRequest.status_code,
|
||||
)
|
||||
|
||||
opts = opts.preset(preset)
|
||||
|
||||
if cli_args := request.query.get("args", None):
|
||||
try:
|
||||
arg_converter(cli_args, dumps=True)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
"web-types": "./web-types.json",
|
||||
"dependencies": {
|
||||
"@pinia/nuxt": "^0.11.2",
|
||||
"@sentry/nuxt": "^10.0.0",
|
||||
"@sentry/nuxt": "^10.5.0",
|
||||
"@vueuse/core": "^13.6.0",
|
||||
"@vueuse/nuxt": "^13.6.0",
|
||||
"@xterm/addon-fit": "^0.10.0",
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
"cron-parser": "^5.3.0",
|
||||
"cronstrue": "^3.2.0",
|
||||
"floating-vue": "^5.2.2",
|
||||
"hls.js": "^1.6.7",
|
||||
"hls.js": "^1.6.9",
|
||||
"moment": "^2.30.1",
|
||||
"nuxt": "^4.0.2",
|
||||
"nuxt": "^4.0.3",
|
||||
"pinia": "^3.0.3",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"vue": "^3.5.18",
|
||||
|
|
|
|||
1486
ui/pnpm-lock.yaml
1486
ui/pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue