MCPcopy
hub / github.com/scdl-org/scdl / _convert_v2_name_format

Function _convert_v2_name_format

scdl/scdl.py:311–337  ·  view source on GitHub ↗
(s: str)

Source from the content-addressed store, hash-verified

309
310
311def _convert_v2_name_format(s: str) -> str:
312 replacements = {
313 "{id}": "%(id)s",
314 "{user[username]}": "%(uploader)s",
315 "{user[id]}": "%(uploader_id)s",
316 "{user[permalink_url]}": "%(uploader_url)s",
317 "{timestamp}": "%(timestamp)s",
318 "{title}": "%(title)s",
319 "{description}": "%(description)s",
320 "{duration}": "%(duration)s",
321 "{permalink_url}": "%(webpage_url)s",
322 "{license}": "%(license)s",
323 "{playback_count}": "%(view_count)s",
324 "{likes_count}": "%(like_count)s",
325 "{comment_count}": "%(comment_count)s",
326 "{reposts_count}": "%(respost_count)s",
327 "{playlist[author]}": "%(playlist_uploader)s",
328 "{playlist[title]}": "%(playlist)s",
329 "{playlist[id]}": "%(playlist_id)s",
330 "{playlist[tracknumber]}": "%(playlist_index)s",
331 "{playlist[tracknumber_total]}": "%(playlist_count)s",
332 }
333 for old, new in replacements.items():
334 s = s.replace(old, new)
335 if not s.endswith(".%(ext)s"):
336 s += ".%(ext)s"
337 return s
338
339
340def _build_ytdl_output_filename(scdl_args: SCDLArgs, in_playlist: bool, force_suffix: str | None = None) -> str:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected