make playlist_index works

This commit is contained in:
arabcoders 2025-08-14 11:46:58 +03:00
parent a81657b1ef
commit a05568f44c
2 changed files with 20 additions and 14 deletions

View file

@ -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}")

View file

@ -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,
}