mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-22 02:15:12 +00:00
[cleanup] Misc
Closes #5471, Closes #5312 Authored by: pukkandan, Alienmaster
This commit is contained in:
parent
8522226d2f
commit
7aaf4cd2a8
8 changed files with 19 additions and 19 deletions
|
@ -1204,6 +1204,10 @@ # OUTPUT TEMPLATE
|
||||||
|
|
||||||
Additionally, you can set different output templates for the various metadata files separately from the general output template by specifying the type of file followed by the template separated by a colon `:`. The different file types supported are `subtitle`, `thumbnail`, `description`, `annotation` (deprecated), `infojson`, `link`, `pl_thumbnail`, `pl_description`, `pl_infojson`, `chapter`, `pl_video`. E.g. `-o "%(title)s.%(ext)s" -o "thumbnail:%(title)s\%(title)s.%(ext)s"` will put the thumbnails in a folder with the same name as the video. If any of the templates is empty, that type of file will not be written. E.g. `--write-thumbnail -o "thumbnail:"` will write thumbnails only for playlists and not for video.
|
Additionally, you can set different output templates for the various metadata files separately from the general output template by specifying the type of file followed by the template separated by a colon `:`. The different file types supported are `subtitle`, `thumbnail`, `description`, `annotation` (deprecated), `infojson`, `link`, `pl_thumbnail`, `pl_description`, `pl_infojson`, `chapter`, `pl_video`. E.g. `-o "%(title)s.%(ext)s" -o "thumbnail:%(title)s\%(title)s.%(ext)s"` will put the thumbnails in a folder with the same name as the video. If any of the templates is empty, that type of file will not be written. E.g. `--write-thumbnail -o "thumbnail:"` will write thumbnails only for playlists and not for video.
|
||||||
|
|
||||||
|
<a id="outtmpl-postprocess-note"></a>
|
||||||
|
|
||||||
|
Note: Due to post-processing (i.e. merging etc.), the actual output filename might differ. Use `--print after_move:filepath` to get the name after all post-processing is complete.
|
||||||
|
|
||||||
The available fields are:
|
The available fields are:
|
||||||
|
|
||||||
- `id` (string): Video identifier
|
- `id` (string): Video identifier
|
||||||
|
@ -1304,7 +1308,7 @@ # OUTPUT TEMPLATE
|
||||||
Available only when used in `--print`:
|
Available only when used in `--print`:
|
||||||
|
|
||||||
- `urls` (string): The URLs of all requested formats, one in each line
|
- `urls` (string): The URLs of all requested formats, one in each line
|
||||||
- `filename` (string): Name of the video file. Note that the actual filename may be different due to post-processing. Use `--exec echo` to get the name after all postprocessing is complete
|
- `filename` (string): Name of the video file. Note that the [actual filename may differ](#outtmpl-postprocess-note)
|
||||||
- `formats_table` (table): The video format table as printed by `--list-formats`
|
- `formats_table` (table): The video format table as printed by `--list-formats`
|
||||||
- `thumbnails_table` (table): The thumbnail format table as printed by `--list-thumbnails`
|
- `thumbnails_table` (table): The thumbnail format table as printed by `--list-thumbnails`
|
||||||
- `subtitles_table` (table): The subtitle format table as printed by `--list-subs`
|
- `subtitles_table` (table): The subtitle format table as printed by `--list-subs`
|
||||||
|
|
|
@ -254,14 +254,11 @@ def _repr(v):
|
||||||
return v.__name__
|
return v.__name__
|
||||||
else:
|
else:
|
||||||
return repr(v)
|
return repr(v)
|
||||||
info_dict_str = ''
|
info_dict_str = ''.join(
|
||||||
if len(missing_keys) != len(expected_dict):
|
f' {_repr(k)}: {_repr(v)},\n'
|
||||||
info_dict_str += ''.join(
|
for k, v in test_info_dict.items() if k not in missing_keys)
|
||||||
f' {_repr(k)}: {_repr(v)},\n'
|
if info_dict_str:
|
||||||
for k, v in test_info_dict.items() if k not in missing_keys)
|
info_dict_str += '\n'
|
||||||
|
|
||||||
if info_dict_str:
|
|
||||||
info_dict_str += '\n'
|
|
||||||
info_dict_str += ''.join(
|
info_dict_str += ''.join(
|
||||||
f' {_repr(k)}: {_repr(test_info_dict[k])},\n'
|
f' {_repr(k)}: {_repr(test_info_dict[k])},\n'
|
||||||
for k in missing_keys)
|
for k in missing_keys)
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __package__ is None and not hasattr(sys, 'frozen'):
|
if __package__ is None and not getattr(sys, 'frozen', False):
|
||||||
# direct call of __main__.py
|
# direct call of __main__.py
|
||||||
import os.path
|
import os.path
|
||||||
path = os.path.realpath(os.path.abspath(__file__))
|
path = os.path.realpath(os.path.abspath(__file__))
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
class SlidesLiveIE(InfoExtractor):
|
class SlidesLiveIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://slideslive\.com/(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://slideslive\.com/(?P<id>[0-9]+)'
|
||||||
|
_WORKING = False
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# video_service_name = YOUTUBE
|
# video_service_name = YOUTUBE
|
||||||
'url': 'https://slideslive.com/38902413/gcc-ia16-backend',
|
'url': 'https://slideslive.com/38902413/gcc-ia16-backend',
|
||||||
|
|
|
@ -21,7 +21,7 @@ def _real_extract(self, url):
|
||||||
matching_extractors = [e for e in gen_extractor_classes() if rex.search(e.IE_NAME)]
|
matching_extractors = [e for e in gen_extractor_classes() if rex.search(e.IE_NAME)]
|
||||||
|
|
||||||
if len(matching_extractors) == 0:
|
if len(matching_extractors) == 0:
|
||||||
raise ExtractorError('No extractors matching {extractor_id!r} found', expected=True)
|
raise ExtractorError(f'No extractors matching {extractor_id!r} found', expected=True)
|
||||||
elif len(matching_extractors) > 1:
|
elif len(matching_extractors) > 1:
|
||||||
try: # Check for exact match
|
try: # Check for exact match
|
||||||
extractor = next(
|
extractor = next(
|
||||||
|
|
|
@ -137,7 +137,7 @@ def _get_ffmpeg_version(self, prog):
|
||||||
path = self._paths.get(prog)
|
path = self._paths.get(prog)
|
||||||
if path in self._version_cache:
|
if path in self._version_cache:
|
||||||
return self._version_cache[path], self._features_cache.get(path, {})
|
return self._version_cache[path], self._features_cache.get(path, {})
|
||||||
out = _get_exe_version_output(path, ['-bsfs'], to_screen=self.write_debug)
|
out = _get_exe_version_output(path, ['-bsfs'])
|
||||||
ver = detect_exe_version(out) if out else False
|
ver = detect_exe_version(out) if out else False
|
||||||
if ver:
|
if ver:
|
||||||
regexs = [
|
regexs = [
|
||||||
|
|
|
@ -30,13 +30,13 @@
|
||||||
@functools.cache
|
@functools.cache
|
||||||
def _get_variant_and_executable_path():
|
def _get_variant_and_executable_path():
|
||||||
"""@returns (variant, executable_path)"""
|
"""@returns (variant, executable_path)"""
|
||||||
if hasattr(sys, 'frozen'):
|
if getattr(sys, 'frozen', False):
|
||||||
path = sys.executable
|
path = sys.executable
|
||||||
if not hasattr(sys, '_MEIPASS'):
|
if not hasattr(sys, '_MEIPASS'):
|
||||||
return 'py2exe', path
|
return 'py2exe', path
|
||||||
if sys._MEIPASS == os.path.dirname(path):
|
elif sys._MEIPASS == os.path.dirname(path):
|
||||||
return f'{sys.platform}_dir', path
|
return f'{sys.platform}_dir', path
|
||||||
if sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
machine = '_legacy' if version_tuple(platform.mac_ver()[0]) < (10, 15) else ''
|
machine = '_legacy' if version_tuple(platform.mac_ver()[0]) < (10, 15) else ''
|
||||||
else:
|
else:
|
||||||
machine = f'_{platform.machine().lower()}'
|
machine = f'_{platform.machine().lower()}'
|
||||||
|
@ -288,7 +288,7 @@ def cmd(self):
|
||||||
# There is no sys.orig_argv in py < 3.10. Also, it can be [] when frozen
|
# There is no sys.orig_argv in py < 3.10. Also, it can be [] when frozen
|
||||||
if getattr(sys, 'orig_argv', None):
|
if getattr(sys, 'orig_argv', None):
|
||||||
return sys.orig_argv
|
return sys.orig_argv
|
||||||
elif hasattr(sys, 'frozen'):
|
elif getattr(sys, 'frozen', False):
|
||||||
return sys.argv
|
return sys.argv
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
|
|
|
@ -2698,9 +2698,7 @@ def check_executable(exe, args=[]):
|
||||||
return exe
|
return exe
|
||||||
|
|
||||||
|
|
||||||
def _get_exe_version_output(exe, args, *, to_screen=None):
|
def _get_exe_version_output(exe, args):
|
||||||
if to_screen:
|
|
||||||
to_screen(f'Checking exe version: {shell_quote([exe] + args)}')
|
|
||||||
try:
|
try:
|
||||||
# STDIN should be redirected too. On UNIX-like systems, ffmpeg triggers
|
# STDIN should be redirected too. On UNIX-like systems, ffmpeg triggers
|
||||||
# SIGTTOU if yt-dlp is run in the background.
|
# SIGTTOU if yt-dlp is run in the background.
|
||||||
|
|
Loading…
Reference in a new issue