]> jfr.im git - yt-dlp.git/commitdiff
[cleanup] Minor fixes
authorpukkandan <redacted>
Sun, 10 Jul 2022 19:47:48 +0000 (01:17 +0530)
committerpukkandan <redacted>
Sun, 10 Jul 2022 20:54:36 +0000 (02:24 +0530)
README.md
test/test_utils.py
yt_dlp/YoutubeDL.py
yt_dlp/downloader/common.py

index 47f589c49ee348f271fcf02eb8f2789b3d2c4a7d..af5fb46ae8fb401fb23206691e28cd244697c2ed 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1207,7 +1207,7 @@ # OUTPUT TEMPLATE
 
 1. **Default**: A literal default value can be specified for when the field is empty using a `|` separator. This overrides `--output-na-template`. Eg: `%(uploader|Unknown)s`
 
-1. **More Conversions**: In addition to the normal format types `diouxXeEfFgGcrs`, yt-dlp additionally supports converting to `B` = **B**ytes, `j` = **j**son (flag `#` for pretty-printing), `l` = a comma separated **l**ist (flag `#` for `\n` newline-separated), `q` = a string **q**uoted for the terminal (flag `#` to split a list into different arguments), `D` = add **D**ecimal suffixes (Eg: 10M) (flag `#` to use 1024 as factor), and `S` = **S**anitize as filename (flag `#` for restricted)
+1. **More Conversions**: In addition to the normal format types `diouxXeEfFgGcrs`, yt-dlp additionally supports converting to `B` = **B**ytes, `j` = **j**son (flag `#` for pretty-printing), `h` = HTML escaping, `l` = a comma separated **l**ist (flag `#` for `\n` newline-separated), `q` = a string **q**uoted for the terminal (flag `#` to split a list into different arguments), `D` = add **D**ecimal suffixes (Eg: 10M) (flag `#` to use 1024 as factor), and `S` = **S**anitize as filename (flag `#` for restricted)
 
 1. **Unicode normalization**: The format type `U` can be used for NFC [unicode normalization](https://docs.python.org/3/library/unicodedata.html#unicodedata.normalize). The alternate form flag (`#`) changes the normalization to NFD and the conversion flag `+` can be used for NFKC/NFKD compatibility equivalence normalization. Eg: `%(title)+.100U` is NFKC
 
index 8024a8e7c8da7977af90fdf578751adc60b66e79..948d5d0596ca0d056693ed5675560fc566b2270b 100644 (file)
@@ -895,7 +895,7 @@ def test_parse_codecs(self):
             'dynamic_range': 'HDR10',
         })
         self.assertEqual(parse_codecs('av01.0.12M.10.0.110.09.16.09.0'), {
-            'vcodec': 'av01.0.12M.10',
+            'vcodec': 'av01.0.12M.10.0.110.09.16.09.0',
             'acodec': 'none',
             'dynamic_range': 'HDR10',
         })
index 7e9c0949b2a7cb043a04007a7433e3b5a6e80b8a..e812f47750efa41118d138f993651e99074394eb 100644 (file)
@@ -1685,6 +1685,8 @@ def _playlist_infodict(ie_result, **kwargs):
 
     def __process_playlist(self, ie_result, download):
         """Process each entry in the playlist"""
+        assert ie_result['_type'] in ('playlist', 'multi_video')
+
         title = ie_result.get('title') or ie_result.get('id') or '<Untitled>'
         self.to_screen(f'[download] Downloading playlist: {title}')
 
@@ -3540,7 +3542,9 @@ def render_formats_table(self, info_dict):
         def simplified_codec(f, field):
             assert field in ('acodec', 'vcodec')
             codec = f.get(field, 'unknown')
-            if codec != 'none':
+            if not codec:
+                return 'unknown'
+            elif codec != 'none':
                 return '.'.join(codec.split('.')[:4])
 
             if field == 'vcodec' and f.get('acodec') == 'none':
index 3a0a014ef772a2d3f098d5f883c1d9711300e2d3..f502253bf18a6341412c8a75cba5f6be3cdc72a8 100644 (file)
@@ -450,8 +450,7 @@ def real_download(self, filename, info_dict):
         raise NotImplementedError('This method must be implemented by subclasses')
 
     def _hook_progress(self, status, info_dict):
-        if not self._progress_hooks:
-            return
+        # Ideally we want to make a copy of the dict, but that is too slow
         status['info_dict'] = info_dict
         # youtube-dl passes the same status object to all the hooks.
         # Some third party scripts seems to be relying on this.