m3u8 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.hound.yml +3 -0
- data/.rubocop.yml +5 -0
- data/lib/m3u8/playlist_item.rb +20 -3
- data/lib/m3u8/version.rb +1 -1
- data/spec/playlist_spec.rb +11 -0
- data/spec/writer_spec.rb +15 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b0a12ed7f44279220cc4ff7875ac7489d3acdd8
|
4
|
+
data.tar.gz: 6d402ff9367f418ba336d43b82fd31d3b53a713d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67e830b28ab20def54ceb22c1d37c4900faaf75888fcf6d64e84b5d0446a7f979c418935c20cf6ce0bba661a8bc3f28f1d4fa1dda86682096f08c0c939749a59
|
7
|
+
data.tar.gz: 120d949eee406b2770d9e216cf8436b1f3a79c64aaa2337fd5037d86bc027772404d18e7688ae4f7073866759bcc76185ebcd77f7ed23670a286d87d80925547
|
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
data/lib/m3u8/playlist_item.rb
CHANGED
@@ -34,8 +34,12 @@ module M3u8
|
|
34
34
|
|
35
35
|
def to_s
|
36
36
|
validate
|
37
|
-
|
38
|
-
|
37
|
+
|
38
|
+
attributes = [program_id_format,
|
39
|
+
resolution_format,
|
40
|
+
codecs_format,
|
41
|
+
bandwidth_format].compact.join(',')
|
42
|
+
"#EXT-X-STREAM-INF:#{attributes}\n#{playlist}"
|
39
43
|
end
|
40
44
|
|
41
45
|
private
|
@@ -44,9 +48,22 @@ module M3u8
|
|
44
48
|
fail MissingCodecError, MISSING_CODEC_MESSAGE if codecs.nil?
|
45
49
|
end
|
46
50
|
|
51
|
+
def program_id_format
|
52
|
+
return if program_id.nil?
|
53
|
+
"PROGRAM-ID=#{program_id}"
|
54
|
+
end
|
55
|
+
|
47
56
|
def resolution_format
|
48
57
|
return if resolution.nil?
|
49
|
-
"RESOLUTION=#{resolution}
|
58
|
+
"RESOLUTION=#{resolution}"
|
59
|
+
end
|
60
|
+
|
61
|
+
def codecs_format
|
62
|
+
"CODECS=\"#{codecs}\""
|
63
|
+
end
|
64
|
+
|
65
|
+
def bandwidth_format
|
66
|
+
"BANDWIDTH=#{bitrate}"
|
50
67
|
end
|
51
68
|
|
52
69
|
def audio_codec(audio)
|
data/lib/m3u8/version.rb
CHANGED
data/spec/playlist_spec.rb
CHANGED
@@ -8,6 +8,17 @@ describe M3u8::Playlist do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should render master playlist' do
|
11
|
+
options = { playlist: 'playlist_url', bitrate: 6400,
|
12
|
+
audio: 'mp3' }
|
13
|
+
item = M3u8::PlaylistItem.new options
|
14
|
+
playlist = M3u8::Playlist.new
|
15
|
+
playlist.items.push item
|
16
|
+
|
17
|
+
output = "#EXTM3U\n" +
|
18
|
+
%(#EXT-X-STREAM-INF:CODECS="mp4a.40.34") +
|
19
|
+
",BANDWIDTH=6400\nplaylist_url\n"
|
20
|
+
expect(playlist.to_s).to eq output
|
21
|
+
|
11
22
|
options = { program_id: '1', playlist: 'playlist_url', bitrate: 6400,
|
12
23
|
audio: 'mp3' }
|
13
24
|
item = M3u8::PlaylistItem.new options
|
data/spec/writer_spec.rb
CHANGED
@@ -2,6 +2,21 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe M3u8::Writer do
|
4
4
|
it 'should render master playlist' do
|
5
|
+
options = { playlist: 'playlist_url', bitrate: 6400,
|
6
|
+
audio: 'mp3' }
|
7
|
+
item = M3u8::PlaylistItem.new options
|
8
|
+
playlist = M3u8::Playlist.new
|
9
|
+
playlist.items.push item
|
10
|
+
|
11
|
+
output = "#EXTM3U\n" +
|
12
|
+
%(#EXT-X-STREAM-INF:CODECS="mp4a.40.34") +
|
13
|
+
",BANDWIDTH=6400\nplaylist_url\n"
|
14
|
+
|
15
|
+
io = StringIO.open
|
16
|
+
writer = M3u8::Writer.new io
|
17
|
+
writer.write playlist
|
18
|
+
expect(io.string).to eq output
|
19
|
+
|
5
20
|
options = { program_id: '1', playlist: 'playlist_url', bitrate: 6400,
|
6
21
|
audio: 'mp3' }
|
7
22
|
item = M3u8::PlaylistItem.new options
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: m3u8
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Deckard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,7 +60,9 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- ".hound.yml"
|
63
64
|
- ".rspec"
|
65
|
+
- ".rubocop.yml"
|
64
66
|
- ".travis.yml"
|
65
67
|
- CHANGELOG.md
|
66
68
|
- Gemfile
|