Fix filename extension leaking to json filename
authorJanez Troha <dz0ny@users.noreply.github.com>
Wed, 13 Nov 2013 17:34:03 +0000 (18:34 +0100)
committerJanez Troha <dz0ny@users.noreply.github.com>
Wed, 13 Nov 2013 17:34:03 +0000 (18:34 +0100)
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

youtube_dl/YoutubeDL.py

index f615911de210620ffebc8d5e9f98a78eefc6c10a..3160d9712a4d1b75d07735f487df046e855e3ace 100644 (file)
@@ -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'])