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

Fix filename extension leaking to json filename

Makes writeinfojson behaving exactly as writethumbnail in case where filename contains mediafile extension.

Case:

video.mp4 converted to music.mp3 would yield music.mp4.info.json instead music.mp3.info.json or music.info.json
Janez Troha 11 лет назад
Родитель
Сommit
9771cceb2c
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      youtube_dl/YoutubeDL.py

+ 1 - 1
youtube_dl/YoutubeDL.py

@@ -655,7 +655,7 @@ class YoutubeDL(object):
                     return
 
         if self.params.get('writeinfojson', False):
-            infofn = filename + u'.info.json'
+            infofn = os.path.splitext(filename)[0] + u'.info.json'
             self.report_writeinfojson(infofn)
             try:
                 json_info_dict = dict((k, v) for k, v in info_dict.items() if not k in ['urlhandle'])