1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-12-11 16:15:46 +01:00

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

This made the JSON structure really unreadable and was a quick fix.

This reverts commit 6535e9511f.
This commit is contained in:
Philipp Hagemeister 2013-01-01 19:07:06 +01:00
parent 911ee27e83
commit 6985325e01
2 changed files with 53 additions and 38 deletions

View File

@ -54,10 +54,9 @@ class TestDownload(unittest.TestCase):
self.tearDown() self.tearDown()
def tearDown(self): def tearDown(self):
for files in [ test['files'] for test in self.defs ]: for fn in [ test.get('file', False) for test in self.defs ]:
for fn, md5 in files: if fn and os.path.exists(fn):
if os.path.exists(fn): os.remove(fn)
os.remove(fn)
### Dynamically generate tests ### Dynamically generate tests
@ -68,6 +67,9 @@ 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
@ -82,11 +84,10 @@ 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']])
for filename, md5 in test_case['files']: self.assertTrue(os.path.exists(test_case['file']))
self.assertTrue(os.path.exists(filename)) if 'md5' in test_case:
if md5: md5_for_file = _file_md5(test_case['file'])
md5_for_file = _file_md5(filename) self.assertEqual(md5_for_file, test_case['md5'])
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:'):

View File

@ -1,8 +1,8 @@
[ [
{ {
"name": "Youtube", "name": "Youtube",
"url": "http://www.youtube.com/watch?v=BaW_jenozKc", "url": "http://www.youtube.com/watch?v=BaW_jenozKc",
"files": [[ "BaW_jenozKc.mp4", false ]], "file": "BaW_jenozKc.mp4",
"info_dict": { "info_dict": {
"title": "youtube-dl test video \"'/\\ä↭𝕐", "title": "youtube-dl test video \"'/\\ä↭𝕐",
"uploader": "Philipp Hagemeister", "uploader": "Philipp Hagemeister",
@ -13,29 +13,33 @@
}, },
{ {
"name": "Dailymotion", "name": "Dailymotion",
"url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech", "md5": "392c4b85a60a90dc4792da41ce3144eb",
"files": [[ "x33vw9.mp4", "392c4b85a60a90dc4792da41ce3144eb" ]] "url": "http://www.dailymotion.com/video/x33vw9_tutoriel-de-youtubeur-dl-des-video_tech",
"file": "x33vw9.mp4"
}, },
{ {
"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/",
"files": [[ "_aUehQsCQtM.flv", false ]] "file": "_aUehQsCQtM.flv"
}, },
{ {
"name": "BlipTV", "name": "BlipTV",
"url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352", "md5": "b2d849efcf7ee18917e4b4d9ff37cafe",
"files": [[ "5779306.m4v", "b2d849efcf7ee18917e4b4d9ff37cafe" ]] "url": "http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352",
"file": "5779306.m4v"
}, },
{ {
"name": "XVideos", "name": "XVideos",
"url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1", "md5": "1d0c835822f0a71a7bf011855db929d0",
"files": [[ "939581.flv", "1d0c835822f0a71a7bf011855db929d0" ]] "url": "http://www.xvideos.com/video939581/funny_porns_by_s_-1",
"file": "939581.flv"
}, },
{ {
"name": "Vimeo", "name": "Vimeo",
"url": "http://vimeo.com/56015672", "md5": "8879b6cc097e987f02484baf890129e5",
"files": [[ "56015672.mp4", "8879b6cc097e987f02484baf890129e5" ]], "url": "http://vimeo.com/56015672",
"file": "56015672.mp4",
"info_dict": { "info_dict": {
"title": "youtube-dl test video - ★ \" ' 幸 / \\ ä ↭ 𝕐", "title": "youtube-dl test video - ★ \" ' 幸 / \\ ä ↭ 𝕐",
"uploader": "Filippo Valsorda", "uploader": "Filippo Valsorda",
@ -46,60 +50,70 @@
}, },
{ {
"name": "Soundcloud", "name": "Soundcloud",
"url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy", "md5": "ebef0a451b909710ed1d7787dddbf0d7",
"files": [[ "62986583.mp3", "ebef0a451b909710ed1d7787dddbf0d7" ]] "url": "http://soundcloud.com/ethmusic/lostin-powers-she-so-heavy",
"file": "62986583.mp3"
}, },
{ {
"name": "StanfordOpenClassroom", "name": "StanfordOpenClassroom",
"url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100", "md5": "544a9468546059d4e80d76265b0443b8",
"files": [[ "PracticalUnix_intro-environment.mp4", "544a9468546059d4e80d76265b0443b8" ]] "url": "http://openclassroom.stanford.edu/MainFolder/VideoPage.php?course=PracticalUnix&video=intro-environment&speed=100",
"file": "PracticalUnix_intro-environment.mp4"
}, },
{ {
"name": "XNXX", "name": "XNXX",
"url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_", "md5": "0831677e2b4761795f68d417e0b7b445",
"files": [[ "1135332.flv", "0831677e2b4761795f68d417e0b7b445" ]] "url": "http://video.xnxx.com/video1135332/lida_naked_funny_actress_5_",
"file": "1135332.flv"
}, },
{ {
"name": "Youku", "name": "Youku",
"url": "http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html", "url": "http://v.youku.com/v_show/id_XNDgyMDQ2NTQw.html",
"files": [[ "XNDgyMDQ2NTQw_part00.flv", "ffe3f2e435663dc2d1eea34faeff5b5b" ]], "file": "XNDgyMDQ2NTQw_part00.flv",
"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",
"files": [[ "0021200253-okc-bkn-recap.nba.mp4", "c0edcfc37607344e2ff8f13c378c88a4" ]] "file": "0021200253-okc-bkn-recap.nba.mp4",
"md5": "c0edcfc37607344e2ff8f13c378c88a4"
}, },
{ {
"name": "JustinTV", "name": "JustinTV",
"url": "http://www.twitch.tv/thegamedevhub/b/296128360", "url": "http://www.twitch.tv/thegamedevhub/b/296128360",
"files": [[ "296128360.flv", "ecaa8a790c22a40770901460af191c9a" ]] "file": "296128360.flv",
"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",
"files": [[ "8229274.flv", "2d2753e8130479ba2cb7e0a37002053e" ]] "file": "8229274.flv",
"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",
"files": [[ "6618-Breaking-Down-Baldurs-Gate.flv", "c6793dbda81388f4264c1ba18684a74d" ]], "file": "6618-Breaking-Down-Baldurs-Gate.flv",
"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",
"files": [[ "ZButuJc6CtH.flv", false ]] "file": "ZButuJc6CtH.flv"
}, },
{ {
"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",
"files": [[ "0732f586d7.mp4", "f647e9e90064b53b6e046e75d0241fbd" ]] "file": "0732f586d7.mp4",
"md5": "f647e9e90064b53b6e046e75d0241fbd"
}, },
{ {
"name": "TweetReel", "name": "TweetReel",
"url": "http://tweetreel.com/?77smq", "url": "http://tweetreel.com/?77smq",
"files": [[ "77smq.mov", "56b4d9ca9de467920f3f99a6d91255d6" ]], "file": "77smq.mov",
"md5": "56b4d9ca9de467920f3f99a6d91255d6",
"info_dict": { "info_dict": {
"uploader": "itszero", "uploader": "itszero",
"uploader_id": "itszero", "uploader_id": "itszero",
@ -110,8 +124,8 @@
{ {
"name": "Steam", "name": "Steam",
"url": "http://store.steampowered.com/video/105600/", "url": "http://store.steampowered.com/video/105600/",
"files": [[ "81300.flv", "f870007cee7065d7c76b88f0a45ecc07" ], "file": "81300.flv",
[ "80859.flv", "61aaf31a5c5c3041afb58fb83cbb5751" ]], "md5": "f870007cee7065d7c76b88f0a45ecc07",
"info_dict": { "info_dict": {
"title": "Terraria 1.1 Trailer" "title": "Terraria 1.1 Trailer"
} }