test for youtube-dl stitch-up

This commit is contained in:
Noah Levitt 2018-08-15 17:42:53 -07:00
parent c2ad8427e1
commit 3c27132aaa
10 changed files with 79 additions and 2 deletions

View File

@ -67,7 +67,7 @@ setuptools.setup(
'youtube-dl',
'reppy==0.3.4',
'requests',
'websocket-client!=0.39.0',
'websocket-client!=0.39.0,!=0.49.0',
'pillow>=5.2.0',
'urlcanon>=0.1.dev23',
'doublethink>=0.2.0.dev88',

View File

@ -0,0 +1,34 @@
<html>
<head>
<title>segmented (hls) video test</title>
</head>
<body>
<!--
hls segments and manifest generated like so:
ffmpeg -i ../site6/small.mp4 -c:v h264 -flags +cgop -g 30 -hls_time 1 small.m3u8
-->
<!--
hls doesn't work in chrome with plain video tag without js, but we
don't care because we're testing youtube-dl functionality
-->
<video id="video" controls muted>
<source src="small.m3u8" type="application/x-mpegURL">
</video>
<!-- to make this work in chrome you need this -->
<!--
<script src="hls.js"></script>
<script>
if(Hls.isSupported()) {
var video = document.getElementById('video');
var hls = new Hls();
hls.loadSource('small.m3u8');
hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
video.play();
});
}
</script>
-->
</body>
</html>

View File

@ -0,0 +1,15 @@
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:1
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:1.000000,
small1.ts
#EXTINF:1.000000,
small2.ts
#EXTINF:1.000000,
small3.ts
#EXTINF:1.000000,
small4.ts
#EXTINF:0.533333,
small5.ts
#EXT-X-ENDLIST

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@
test_cluster.py - integration tests for a brozzler cluster, expects brozzler,
warcprox, pywb, rethinkdb and other dependencies to be running already
Copyright (C) 2016-2017 Internet Archive
Copyright (C) 2016-2018 Internet Archive
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -796,3 +796,31 @@ def test_time_limit(httpd):
job.refresh()
assert job.status == 'FINISHED'
def test_ydl_stitching(httpd):
test_id = 'test_ydl_stitching-%s' % datetime.datetime.utcnow().isoformat()
rr = doublethink.Rethinker('localhost', db='brozzler')
frontier = brozzler.RethinkDbFrontier(rr)
site = brozzler.Site(rr, {
'seed': 'http://localhost:%s/site10/' % httpd.server_port})
brozzler.new_site(frontier, site)
# the site should be brozzled fairly quickly
start = time.time()
while site.status != 'FINISHED' and time.time() - start < 300:
time.sleep(0.5)
site.refresh()
assert site.status == 'FINISHED'
# check page.videos
pages = list(frontier.site_pages(site.id))
assert len(pages) == 1
page = pages[0]
assert len(page.videos) == 6
assert {
'blame': 'youtube-dl',
'content-length': 267900,
'content-type': 'video/mp4',
'response_code': 204,
'url': 'youtube-dl:00001:http://localhost:%s/site10/' % httpd.server_port,
} in page.videos