From 9771cceb2cfab153d0c2a5b0a7dbc923de90f2c1 Mon Sep 17 00:00:00 2001 From: Janez Troha Date: Wed, 13 Nov 2013 18:34:03 +0100 Subject: [PATCH 1/2] 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 --- youtube_dl/YoutubeDL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index f615911de..3160d9712 100644 --- a/youtube_dl/YoutubeDL.py +++ b/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']) From 08bc37cdd02bc861a0b5271abb34623f0ebcd66c Mon Sep 17 00:00:00 2001 From: Janez Troha Date: Wed, 13 Nov 2013 18:55:49 +0100 Subject: [PATCH 2/2] Update test_write_info_json.py --- test/test_write_info_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_write_info_json.py b/test/test_write_info_json.py index a5b6f6972..30c4859fd 100644 --- a/test/test_write_info_json.py +++ b/test/test_write_info_json.py @@ -31,7 +31,7 @@ params = get_params({ TEST_ID = 'BaW_jenozKc' -INFO_JSON_FILE = TEST_ID + '.mp4.info.json' +INFO_JSON_FILE = TEST_ID + '.info.json' DESCRIPTION_FILE = TEST_ID + '.mp4.description' EXPECTED_DESCRIPTION = u'''test chars: "'/\ä↭𝕐