Просмотр исходного кода

[YoutubeDL] Improve JSON info file naming

Sergey M․ 10 лет назад
Родитель
Сommit
b29e0000e6
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      youtube_dl/YoutubeDL.py

+ 2 - 1
youtube_dl/YoutubeDL.py

@@ -71,6 +71,7 @@ from .utils import (
     write_string,
     write_string,
     YoutubeDLHandler,
     YoutubeDLHandler,
     prepend_extension,
     prepend_extension,
+    replace_extension,
     args_to_str,
     args_to_str,
     age_restricted,
     age_restricted,
 )
 )
@@ -1332,7 +1333,7 @@ class YoutubeDL(object):
                     return
                     return
 
 
         if self.params.get('writeinfojson', False):
         if self.params.get('writeinfojson', False):
-            infofn = os.path.splitext(filename)[0] + '.info.json'
+            infofn = replace_extension(filename, 'info.json', info_dict.get('ext'))
             if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(infofn)):
             if self.params.get('nooverwrites', False) and os.path.exists(encodeFilename(infofn)):
                 self.to_screen('[info] Video description metadata is already present')
                 self.to_screen('[info] Video description metadata is already present')
             else:
             else: