In tests.json file and md5 join in a 'files' list to handle multiple-file IEs

pull/2/head
Filippo Valsorda 12 years ago
parent 60c7520a51
commit 6535e9511f

@ -54,8 +54,9 @@ class TestDownload(unittest.TestCase):
self.tearDown() self.tearDown()
def tearDown(self): def tearDown(self):
for fn in [ test.get('file', False) for test in self.defs ]: for files in [ test['files'] for test in self.defs ]:
if fn and os.path.exists(fn): for fn, md5 in files:
if os.path.exists(fn):
os.remove(fn) os.remove(fn)
@ -67,9 +68,6 @@ def generator(test_case):
if not ie._WORKING: if not ie._WORKING:
print('Skipping: IE marked as not _WORKING') print('Skipping: IE marked as not _WORKING')
return return
if not test_case['file']:
print('Skipping: No output file specified')
return
if 'skip' in test_case: if 'skip' in test_case:
print('Skipping: {0}'.format(test_case['skip'])) print('Skipping: {0}'.format(test_case['skip']))
return return
@ -84,10 +82,11 @@ def generator(test_case):
fd.add_info_extractor(getattr(youtube_dl.InfoExtractors, ien + 'IE')()) fd.add_info_extractor(getattr(youtube_dl.InfoExtractors, ien + 'IE')())
fd.download([test_case['url']]) fd.download([test_case['url']])
self.assertTrue(os.path.exists(test_case['file'])) for filename, md5 in test_case['files']:
if 'md5' in test_case: self.assertTrue(os.path.exists(filename))
md5_for_file = _file_md5(test_case['file']) if md5:
self.assertEqual(md5_for_file, test_case['md5']) md5_for_file = _file_md5(filename)
self.assertEqual(md5_for_file, md5)
info_dict = fd.processed_info_dicts[0] info_dict = fd.processed_info_dicts[0]
for (info_field, value) in test_case.get('info_dict', {}).items(): for (info_field, value) in test_case.get('info_dict', {}).items():
if value.startswith('md5:'): if value.startswith('md5:'):

@ -2,7 +2,7 @@
{ {
"name": "Youtube", "name": "Youtube",
"url": "http://www.youtube.com/watch?v=BaW_jenozKc", "url": "http://www.youtube.com/watch?v=BaW_jenozKc",
"file": "BaW_jenozKc.mp4", "files": [[ "BaW_jenozKc.mp4", false ]],
"info_dict": { "info_dict": {
"title": "youtube-dl test video \"'/\\ä↭𝕐", "title": "youtube-dl test video \"'/\\ä↭𝕐",
"uploader": "Philipp Hagemeister", "uploader": "Philipp Hagemeister",
@ -13,33 +13,29 @@
}, },
{ {
"name": "Dailymotion", "name": "Dailymotion",
"md5": "392c4b85a60a90dc4792da41ce3144eb",
"url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech", "url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech",
"file": "x33vw9.mp4" "files": [[ "x33vw9.mp4", "392c4b85a60a90dc4792da41ce3144eb" ]]
}, },
{ {
"name": "Metacafe", "name": "Metacafe",
"add_ie": ["Youtube"], "add_ie": [ "Youtube" ],
"url": "http://metacafe.com/watch/yt-_aUehQsCQtM/the_electric_company_short_i_pbs_kids_go/", "url": "http://metacafe.com/watch/yt-_aUehQsCQtM/the_electric_company_short_i_pbs_kids_go/",
"file": "_aUehQsCQtM.flv" "files": [[ "_aUehQsCQtM.flv", false ]]
}, },
{ {
"name": "BlipTV", "name": "BlipTV",
"md5": "b2d849efcf7ee18917e4b4d9ff37cafe",
"url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352", "url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352",
"file": "5779306.m4v" "files": [[ "5779306.m4v", "b2d849efcf7ee18917e4b4d9ff37cafe" ]]
}, },
{ {
"name": "XVideos", "name": "XVideos",
"md5": "1d0c835822f0a71a7bf011855db929d0",
"url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1", "url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1",
"file": "939581.flv" "files": [[ "939581.flv", "1d0c835822f0a71a7bf011855db929d0" ]]
}, },
{ {
"name": "Vimeo", "name": "Vimeo",
"md5": "8879b6cc097e987f02484baf890129e5",
"url": "http://vimeo.com/56015672", "url": "http://vimeo.com/56015672",
"file": "56015672.mp4", "files": [[ "56015672.mp4", "8879b6cc097e987f02484baf890129e5" ]],
"info_dict": { "info_dict": {
"title": "youtube-dl test video - ★ \" ' 幸 / \\ ä ↭ 𝕐", "title": "youtube-dl test video - ★ \" ' 幸 / \\ ä ↭ 𝕐",
"uploader": "Filippo Valsorda", "uploader": "Filippo Valsorda",
@ -50,70 +46,60 @@
}, },
{ {
"name": "Soundcloud", "name": "Soundcloud",
"md5": "ebef0a451b909710ed1d7787dddbf0d7",
"url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy", "url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy",
"file": "62986583.mp3" "files": [[ "62986583.mp3", "ebef0a451b909710ed1d7787dddbf0d7" ]]
}, },
{ {
"name": "StanfordOpenClassroom", "name": "StanfordOpenClassroom",
"md5": "544a9468546059d4e80d76265b0443b8",
"url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100", "url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100",
"file": "PracticalUnix_intro-environment.mp4" "files": [[ "PracticalUnix_intro-environment.mp4", "544a9468546059d4e80d76265b0443b8" ]]
}, },
{ {
"name": "XNXX", "name": "XNXX",
"md5": "0831677e2b4761795f68d417e0b7b445",
"url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_", "url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_",
"file": "1135332.flv" "files": [[ "1135332.flv", "0831677e2b4761795f68d417e0b7b445" ]]
}, },
{ {
"name": "Youku", "name": "Youku",
"url": "http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html", "url": "http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html",
"file": "XNDgyMDQ2NTQw_part00.flv", "files": [[ "XNDgyMDQ2NTQw_part00.flv", "ffe3f2e435663dc2d1eea34faeff5b5b" ]],
"md5": "ffe3f2e435663dc2d1eea34faeff5b5b",
"params": { "test": false } "params": { "test": false }
}, },
{ {
"name": "NBA", "name": "NBA",
"url": "http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html", "url": "http://www.nba.com/video/games/nets/2012/12/04/0021200253-okc-bkn-recap.nba/index.html",
"file": "0021200253-okc-bkn-recap.nba.mp4", "files": [[ "0021200253-okc-bkn-recap.nba.mp4", "c0edcfc37607344e2ff8f13c378c88a4" ]]
"md5": "c0edcfc37607344e2ff8f13c378c88a4"
}, },
{ {
"name": "JustinTV", "name": "JustinTV",
"url": "http://www.twitch.tv/thegamedevhub/b/296128360", "url": "http://www.twitch.tv/thegamedevhub/b/296128360",
"file": "296128360.flv", "files": [[ "296128360.flv", "ecaa8a790c22a40770901460af191c9a" ]]
"md5": "ecaa8a790c22a40770901460af191c9a"
}, },
{ {
"name": "MyVideo", "name": "MyVideo",
"url": "http://www.myvideo.de/watch/8229274/bowling_fail_or_win", "url": "http://www.myvideo.de/watch/8229274/bowling_fail_or_win",
"file": "8229274.flv", "files": [[ "8229274.flv", "2d2753e8130479ba2cb7e0a37002053e" ]]
"md5": "2d2753e8130479ba2cb7e0a37002053e"
}, },
{ {
"name": "Escapist", "name": "Escapist",
"url": "http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate", "url": "http://www.escapistmagazine.com/videos/view/the-escapist-presents/6618-Breaking-Down-Baldurs-Gate",
"file": "6618-Breaking-Down-Baldurs-Gate.flv", "files": [[ "6618-Breaking-Down-Baldurs-Gate.flv", "c6793dbda81388f4264c1ba18684a74d" ]],
"md5": "c6793dbda81388f4264c1ba18684a74d",
"skip": "Fails with timeout on Travis" "skip": "Fails with timeout on Travis"
}, },
{ {
"name": "GooglePlus", "name": "GooglePlus",
"url": "https://plus.google.com/u/0/108897254135232129896/posts/ZButuJc6CtH", "url": "https://plus.google.com/u/0/108897254135232129896/posts/ZButuJc6CtH",
"file": "ZButuJc6CtH.flv" "files": [[ "ZButuJc6CtH.flv", false ]]
}, },
{ {
"name": "FunnyOrDie", "name": "FunnyOrDie",
"url": "http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version", "url": "http://www.funnyordie.com/videos/0732f586d7/heart-shaped-box-literal-video-version",
"file": "0732f586d7.mp4", "files": [[ "0732f586d7.mp4", "f647e9e90064b53b6e046e75d0241fbd" ]]
"md5": "f647e9e90064b53b6e046e75d0241fbd"
}, },
{ {
"name": "TweetReel", "name": "TweetReel",
"url": "http://tweetreel.com/?77smq", "url": "http://tweetreel.com/?77smq",
"file": "77smq.mov", "files": [[ "77smq.mov", "56b4d9ca9de467920f3f99a6d91255d6" ]],
"md5": "56b4d9ca9de467920f3f99a6d91255d6",
"info_dict": { "info_dict": {
"uploader": "itszero", "uploader": "itszero",
"uploader_id": "itszero", "uploader_id": "itszero",
@ -124,8 +110,8 @@
{ {
"name": "Steam", "name": "Steam",
"url": "http://store.steampowered.com/video/105600/", "url": "http://store.steampowered.com/video/105600/",
"file": "81300.flv", "files": [[ "81300.flv", "f870007cee7065d7c76b88f0a45ecc07" ],
"md5": "f870007cee7065d7c76b88f0a45ecc07", [ "80859.flv", "61aaf31a5c5c3041afb58fb83cbb5751" ]],
"info_dict": { "info_dict": {
"title": "Terraria 1.1 Trailer" "title": "Terraria 1.1 Trailer"
} }

Loading…
Cancel
Save