-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
5ad6f75
commit c4f1efd
Showing
7 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.pyc | ||
*.egg-info | ||
tests/server.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
''' | ||
Test server to deliver stubed M3U8s | ||
''' | ||
from os.path import dirname, abspath, join | ||
|
||
from bottle import route, run, response | ||
import bottle | ||
|
||
playlists = abspath(join(dirname(__file__), 'playlists')) | ||
|
||
@route('/simple.m3u8') | ||
def simple(): | ||
response.set_header('Content-Type', 'application/vnd.apple.mpegurl') | ||
return m3u8_file('simple-playlist.m3u8') | ||
|
||
def m3u8_file(filename): | ||
with open(join(playlists, filename)) as fileobj: | ||
return fileobj.read().strip() | ||
|
||
bottle.debug = True | ||
run(host='localhost', port=8112) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#EXTM3U | ||
#EXT-X-TARGETDURATION:5220 | ||
#EXTINF:5220, | ||
http://media.example.com/entire.ts | ||
#EXT-X-ENDLIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
import m3u8 | ||
from playlists import * | ||
|
||
def test_loads_should_create_m3u8_object_from_string(): | ||
m3u8_obj = m3u8.loads(SIMPLE_PLAYLIST) | ||
assert 5220 == m3u8_obj.target_duration | ||
def test_loads_should_create_object_from_string(): | ||
obj = m3u8.loads(SIMPLE_PLAYLIST) | ||
assert isinstance(obj, m3u8.M3U8) | ||
assert 5220 == obj.target_duration | ||
assert 'http://media.example.com/entire.ts' == obj.segments[0].uri | ||
|
||
def test_load_should_create_object_from_file(): | ||
obj = m3u8.load(SIMPLE_PLAYLIST_FILENAME) | ||
assert isinstance(obj, m3u8.M3U8) | ||
assert 5220 == obj.target_duration | ||
assert 'http://media.example.com/entire.ts' == obj.segments[0].uri | ||
|
||
def test_load_should_create_object_from_uri(): | ||
obj = m3u8.load(SIMPLE_PLAYLIST_URI) | ||
assert isinstance(obj, m3u8.M3U8) | ||
assert 5220 == obj.target_duration | ||
assert 'http://media.example.com/entire.ts' == obj.segments[0].uri |