m3u8 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a5387481e7765565192ca64517fe4a6391d4962
4
+ data.tar.gz: 2f58dc479c1fd0e0685a9ccb52c1059adbf7b00f
5
+ SHA512:
6
+ metadata.gz: ce8f26252aef072319753a20dc33ee886929c9168ae1ee03e19b6bea06577dfd8717789735c90f285f4951e7e00dd9ccc01839af6f91c3a288f9144ac202eebc
7
+ data.tar.gz: 848cff751a8dc6437197a51ea3f3f205507ab6d156685552919da4da170e25f4e476fdeb1849839a6477def61a5e703e6042ed6d351905a290b8caf93d614832
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby-19mode
6
+
7
+ script: rspec spec
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in m3u8.gemspec
4
+ gemspec
5
+
6
+ gem 'coveralls', require: false
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Seth Deckard
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # m3u8
2
+
3
+ m3u8 provides generation of m3u8 playlists used the [HTTP Live Streaming](https://developer.apple.com/library/ios/documentation/networkinginternet/conceptual/streamingmediaguide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008332-CH1-SW1) (HLS) specification created by Apple. This is useful if you wish to generate m3u8 playlists on the fly in your web application (to integrate authentication, do something custom, etc) while of course serving up the actual MPEG transport stream files (.ts) from a CDN. You could also use m3u8 to generate playlist files as part of an encoding pipeline.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'm3u8'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install m3u8
20
+
21
+ ## Usage
22
+
23
+ require 'm3u8'
24
+
25
+ #create a master playlist and add child playlists for adaptive bitrate streaming:
26
+ playlist = M3u8::Playlist.new
27
+ options = { :width => 1920, :height => 1080, :profile => 'high', :level => 4.1, :audio => 'aac-lc'}
28
+ playlist.add_playlist '2', 'http://playlist_url_or_path_file', 50000, options
29
+
30
+ #create a standard playlist and add TS segments:
31
+ playlist = M3u8::Playlist.new
32
+ playlist.add_segment 11.344644, "1080-7mbps00000.ts"
33
+
34
+ #just get the codec string for custom use
35
+ options = { :profile => 'baseline', :level => 3.0, :audio => 'aac-lc' }
36
+ codecs = M3u8::Playlist.codecs options
37
+ #=> "avc1.66.30,mp4a.40.2"
38
+
39
+ #specify options for playlist, these are ignored if playlist becomes a master playlist (child playlist added):
40
+ options = { :version => 1, :cache => false, :target => 12, :sequence => 1}
41
+ playlist = M3u8::Playlist.new options
42
+
43
+ #values for :audio (Codec name)
44
+ #aac-lc, he-aac, mp3
45
+
46
+ #values for :profile (H.264 Profile)
47
+ #baseline, main, high
48
+
49
+ #values for :level
50
+ #3.0, 3.1, 4.0, 4.1
51
+
52
+ #not all Levels and Profiles can be combined, consult H.264 documentation
53
+
54
+ ## Features
55
+ * Distinction between segment and master playlists are handled automatically (no need to use a different class)
56
+ * Automatically generates the audio/video codec string based on names and options you are familar with.
57
+ * Provides validation of input when adding playlists or segments.
58
+ * Allows all options to be configured on a playlist (caching, version, etc.)
59
+ * Can write playling to StringIO/File or to_s.
60
+
61
+ ## Contributing
62
+
63
+ 1. Fork it ( https://github.com/sethdeckard/m3u8/fork )
64
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
65
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
66
+ 4. Push to the branch (`git push origin my-new-feature`)
67
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
7
+ task :test => :spec
data/lib/m3u8/error.rb ADDED
@@ -0,0 +1,7 @@
1
+ module M3u8
2
+ class PlaylistTypeError < StandardError
3
+ end
4
+
5
+ class MissingCodecError < StandardError
6
+ end
7
+ end
@@ -0,0 +1,149 @@
1
+ module M3u8
2
+ class Playlist
3
+ attr_accessor :io, :header, :options
4
+
5
+ def initialize options={}
6
+ self.options = {
7
+ :version => 3,
8
+ :sequence => 0,
9
+ :cache => true,
10
+ :target => 10
11
+ }.merge options
12
+
13
+ @@empty = true
14
+ @@master = nil
15
+ self.io = StringIO.open
16
+ io.puts "#EXTM3U"
17
+ end
18
+
19
+ def self.codecs options={}
20
+ playlist = Playlist.new
21
+ playlist.codecs options
22
+ end
23
+
24
+ def add_playlist program_id, playlist, bitrate, options={}
25
+ options = {
26
+ :width => nil,
27
+ :height => nil,
28
+ :profile => nil,
29
+ :level => nil,
30
+ :audio => nil
31
+ }.merge options
32
+
33
+ validate_playlist_type true
34
+ @@master = true
35
+ @@empty = false
36
+
37
+ resolution = resolution options[:width], options[:height]
38
+ codecs = codecs({:audio => options[:audio], :profile => options[:profile], :level => options[:level]})
39
+ raise MissingCodecError.new("An audio or video codec should be provided.") if codecs.nil?
40
+ io.puts "#EXT-X-STREAM-INF:PROGRAM-ID=#{program_id},#{resolution}CODECS=""#{codecs}"",BANDWIDTH=#{bitrate}"
41
+ io.puts playlist
42
+ end
43
+
44
+ def add_segment duration, segment
45
+ validate_playlist_type false
46
+ @@master = false
47
+ @@empty = false
48
+
49
+ unless header
50
+ write_header
51
+ self.header = true
52
+ end
53
+
54
+ io.puts "#EXTINF:#{duration},"
55
+ io.puts segment
56
+ end
57
+
58
+ def codecs options={}
59
+ options = {
60
+ :audio => nil,
61
+ :profile => nil,
62
+ :level => nil
63
+ }.merge options
64
+
65
+ audio_codec = audio_codec options[:audio]
66
+ video_codec = video_codec options[:profile], options[:level]
67
+
68
+ if video_codec.nil?
69
+ return audio_codec
70
+ else
71
+ if audio_codec.nil?
72
+ return video_codec
73
+ else
74
+ return "#{video_codec},#{audio_codec}"
75
+ end
76
+ end
77
+ end
78
+
79
+ def write output
80
+ output.puts to_s
81
+ end
82
+
83
+ def master?
84
+ if not @@empty
85
+ return @@master
86
+ end
87
+ false
88
+ end
89
+
90
+
91
+ def to_s
92
+ if master?
93
+ io.string
94
+ else
95
+ io.string + "#EXT-X-ENDLIST"
96
+ end
97
+ end
98
+
99
+ private
100
+
101
+ def validate_playlist_type master
102
+ unless @@empty
103
+ if master and not master?
104
+ raise PlaylistTypeError.new "Playlist is not a master playlist, playlist can not be added."
105
+ elsif not master and master?
106
+ raise PlaylistTypeError.new "Playlist is a master playlist, segment can not be added."
107
+ end
108
+ end
109
+ end
110
+
111
+ def write_header
112
+ io.puts "#EXT-X-VERSION:#{options[:version]}"
113
+ io.puts "#EXT-X-MEDIA-SEQUENCE:#{options[:sequence]}"
114
+ io.puts "#EXT-X-ALLOW-CACHE:#{cache_string}"
115
+ io.puts "#EXT-X-TARGETDURATION:#{options[:target]}"
116
+ end
117
+
118
+ def cache_string
119
+ options[:cache] ? "YES" : "NO"
120
+ end
121
+
122
+ def audio_codec audio
123
+ unless audio.nil?
124
+ return 'mp4a.40.2' if audio.downcase == 'aac-lc'
125
+ return 'mp4a.40.5' if audio.downcase == 'he-aac'
126
+ return 'mp4a.40.34' if audio.downcase == 'mp3'
127
+ end
128
+ end
129
+
130
+ def video_codec profile, level
131
+ unless profile.nil? and level.nil?
132
+ return 'avc1.66.30' if profile.downcase == 'baseline' and level == 3.0
133
+ return 'avc1.42001f' if profile.downcase == 'baseline' and level == 3.1
134
+ return 'avc1.77.30' if profile.downcase == 'main' and level == 3.0
135
+ return 'avc1.4d001f' if profile.downcase == 'main' and level == 3.1
136
+ return 'avc1.4d0028' if profile.downcase == 'main' and level == 4.0
137
+ return 'avc1.64001f' if profile.downcase == 'high' and level == 3.1
138
+ return 'avc1.640028' if profile.downcase == 'high' and (level == 4.0 or level == 4.1)
139
+ end
140
+ end
141
+
142
+ def resolution width, height
143
+ unless width.nil?
144
+ "RESOLUTION=#{width}x#{height},"
145
+ end
146
+ end
147
+
148
+ end
149
+ end
@@ -0,0 +1,3 @@
1
+ module M3u8
2
+ VERSION = "0.1.0"
3
+ end
data/lib/m3u8.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'm3u8/version'
2
+ require 'm3u8/playlist'
3
+ require 'm3u8/error'
4
+
5
+ module M3u8
6
+ end
data/m3u8.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'm3u8/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "m3u8"
8
+ spec.version = M3u8::VERSION
9
+ spec.authors = ["Seth Deckard"]
10
+ spec.email = ["seth@deckard.me"]
11
+ spec.summary = %q{Generate m3u8 playlists for HTTP Live Streaming (HLS).}
12
+ spec.description = %q{Generate m3u8 playlists for HTTP Live Streaming (HLS).}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", ">= 1.6"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", ">= 2.11"
24
+ end
@@ -0,0 +1,198 @@
1
+ require 'spec_helper'
2
+
3
+ describe M3u8::Playlist do
4
+ it 'should generate codecs string' do
5
+ codecs = M3u8::Playlist.codecs
6
+ expect(codecs).to be_nil
7
+
8
+ codecs = M3u8::Playlist.codecs({ :audio => 'aac-lc' })
9
+ expect(codecs).to eq 'mp4a.40.2'
10
+
11
+ codecs = M3u8::Playlist.codecs({ :audio => 'AAC-LC' })
12
+ expect(codecs).to eq 'mp4a.40.2'
13
+
14
+ codecs = M3u8::Playlist.codecs({ :audio => 'he-aac' })
15
+ expect(codecs).to eq 'mp4a.40.5'
16
+
17
+ codecs = M3u8::Playlist.codecs({ :audio => 'HE-AAC' })
18
+ expect(codecs).to eq 'mp4a.40.5'
19
+
20
+ codecs = M3u8::Playlist.codecs({ :audio => 'he-acc1' })
21
+ expect(codecs).to be_nil
22
+
23
+ codecs = M3u8::Playlist.codecs({ :audio => 'mp3' })
24
+ expect(codecs).to eq 'mp4a.40.34'
25
+
26
+ codecs = M3u8::Playlist.codecs({ :audio => 'MP3' })
27
+ expect(codecs).to eq 'mp4a.40.34'
28
+
29
+ options = { :profile => 'baseline', :level => 3.0 }
30
+ codecs = M3u8::Playlist.codecs options
31
+ expect(codecs).to eq 'avc1.66.30'
32
+
33
+ options = { :profile => 'baseline', :level => 3.0, :audio => 'aac-lc' }
34
+ codecs = M3u8::Playlist.codecs options
35
+ expect(codecs).to eq 'avc1.66.30,mp4a.40.2'
36
+
37
+ options = { :profile => 'baseline', :level => 3.0, :audio => 'mp3' }
38
+ codecs = M3u8::Playlist.codecs options
39
+ expect(codecs).to eq 'avc1.66.30,mp4a.40.34'
40
+
41
+ options = { :profile => 'baseline', :level => 3.1 }
42
+ codecs = M3u8::Playlist.codecs options
43
+ expect(codecs).to eq 'avc1.42001f'
44
+
45
+ options = { :profile => 'baseline', :level => 3.1, :audio => 'he-aac' }
46
+ codecs = M3u8::Playlist.codecs options
47
+ expect(codecs).to eq 'avc1.42001f,mp4a.40.5'
48
+
49
+ options = { :profile => 'main', :level => 3.0 }
50
+ codecs = M3u8::Playlist.codecs options
51
+ expect(codecs).to eq 'avc1.77.30'
52
+
53
+ options = { :profile => 'main', :level => 3.0, :audio => 'aac-lc' }
54
+ codecs = M3u8::Playlist.codecs options
55
+ expect(codecs).to eq 'avc1.77.30,mp4a.40.2'
56
+
57
+ options = { :profile => 'main', :level => 3.1 }
58
+ codecs = M3u8::Playlist.codecs options
59
+ expect(codecs).to eq 'avc1.4d001f'
60
+
61
+ options = { :profile => 'main', :level => 4.0 }
62
+ codecs = M3u8::Playlist.codecs options
63
+ expect(codecs).to eq 'avc1.4d0028'
64
+
65
+ options = { :profile => 'high', :level => 3.1 }
66
+ codecs = M3u8::Playlist.codecs options
67
+ expect(codecs).to eq 'avc1.64001f'
68
+
69
+ options = { :profile => 'high', :level => 4.0 }
70
+ codecs = M3u8::Playlist.codecs options
71
+ expect(codecs).to eq 'avc1.640028'
72
+
73
+ options = { :profile => 'high', :level => 4.1 }
74
+ codecs = M3u8::Playlist.codecs options
75
+ expect(codecs).to eq 'avc1.640028'
76
+ end
77
+
78
+ it 'should render master playlist' do
79
+ playlist = M3u8::Playlist.new
80
+ playlist.add_playlist '1', 'playlist_url', 6400, { :audio => 'mp3' }
81
+
82
+ output = "#EXTM3U\n" +
83
+ "#EXT-X-STREAM-INF:PROGRAM-ID=1,CODECS=""mp4a.40.34"",BANDWIDTH=6400\n" +
84
+ "playlist_url\n"
85
+
86
+ expect(playlist.to_s).to eq output
87
+
88
+ playlist = M3u8::Playlist.new
89
+ options = { :width => 1920, :height => 1080, :profile => 'high', :level => 4.1, :audio => 'aac-lc'}
90
+ playlist.add_playlist '2', 'playlist_url', 50000, options
91
+
92
+ output = "#EXTM3U\n" +
93
+ "#EXT-X-STREAM-INF:PROGRAM-ID=2,RESOLUTION=1920x1080,CODECS=""avc1.640028,mp4a.40.2"",BANDWIDTH=50000\n" +
94
+ "playlist_url\n"
95
+
96
+ expect(playlist.to_s).to eq output
97
+
98
+ playlist = M3u8::Playlist.new
99
+ playlist.add_playlist '1', 'playlist_url', 6400, { :audio => 'mp3' }
100
+ options = { :width => 1920, :height => 1080, :profile => 'high', :level => 4.1, :audio => 'aac-lc'}
101
+ playlist.add_playlist '2', 'playlist_url', 50000, options
102
+
103
+ output = "#EXTM3U\n" +
104
+ "#EXT-X-STREAM-INF:PROGRAM-ID=1,CODECS=""mp4a.40.34"",BANDWIDTH=6400\n" +
105
+ "playlist_url\n" +
106
+ "#EXT-X-STREAM-INF:PROGRAM-ID=2,RESOLUTION=1920x1080,CODECS=""avc1.640028,mp4a.40.2"",BANDWIDTH=50000\n" +
107
+ "playlist_url\n"
108
+
109
+ expect(playlist.to_s).to eq output
110
+ end
111
+
112
+ it 'should render playlist' do
113
+ playlist = M3u8::Playlist.new
114
+ playlist.add_segment 11.344644, "1080-7mbps00000.ts"
115
+
116
+ output = "#EXTM3U\n" +
117
+ "#EXT-X-VERSION:3\n" +
118
+ "#EXT-X-MEDIA-SEQUENCE:0\n" +
119
+ "#EXT-X-ALLOW-CACHE:YES\n" +
120
+ "#EXT-X-TARGETDURATION:10\n" +
121
+ "#EXTINF:11.344644,\n" +
122
+ "1080-7mbps00000.ts\n" +
123
+ "#EXT-X-ENDLIST"
124
+
125
+ expect(playlist.to_s).to eq output
126
+
127
+ playlist.add_segment 11.261233, "1080-7mbps00001.ts"
128
+
129
+ output = "#EXTM3U\n" +
130
+ "#EXT-X-VERSION:3\n" +
131
+ "#EXT-X-MEDIA-SEQUENCE:0\n" +
132
+ "#EXT-X-ALLOW-CACHE:YES\n" +
133
+ "#EXT-X-TARGETDURATION:10\n" +
134
+ "#EXTINF:11.344644,\n" +
135
+ "1080-7mbps00000.ts\n" +
136
+ "#EXTINF:11.261233,\n" +
137
+ "1080-7mbps00001.ts\n" +
138
+ "#EXT-X-ENDLIST"
139
+
140
+ expect(playlist.to_s).to eq output
141
+
142
+ options = { :version => 1, :cache => false, :target => 12, :sequence => 1}
143
+ playlist = M3u8::Playlist.new options
144
+ playlist.add_segment 11.344644, "1080-7mbps00000.ts"
145
+
146
+ output = "#EXTM3U\n" +
147
+ "#EXT-X-VERSION:1\n" +
148
+ "#EXT-X-MEDIA-SEQUENCE:1\n" +
149
+ "#EXT-X-ALLOW-CACHE:NO\n" +
150
+ "#EXT-X-TARGETDURATION:12\n" +
151
+ "#EXTINF:11.344644,\n" +
152
+ "1080-7mbps00000.ts\n" +
153
+ "#EXT-X-ENDLIST"
154
+
155
+ expect(playlist.to_s).to eq output
156
+ end
157
+
158
+ it 'should write playlist to io' do
159
+ test_io = StringIO.new
160
+ playlist = M3u8::Playlist.new
161
+ playlist.add_playlist '1', 'playlist_url', 6400, { :audio => 'mp3' }
162
+ playlist.write test_io
163
+
164
+ output = "#EXTM3U\n" +
165
+ "#EXT-X-STREAM-INF:PROGRAM-ID=1,CODECS=""mp4a.40.34"",BANDWIDTH=6400\n" +
166
+ "playlist_url\n"
167
+
168
+ expect(test_io.string).to eq output
169
+ end
170
+
171
+ it 'should report if it is a master playlist' do
172
+ playlist = M3u8::Playlist.new
173
+ expect(playlist.master?).to be false
174
+
175
+ playlist.add_playlist '1', 'playlist_url', 6400, { :audio => 'mp3' }
176
+ expect(playlist.master?).to be true
177
+ end
178
+
179
+ it 'should raise error if type of playlist is changed' do
180
+ playlist = M3u8::Playlist.new
181
+ playlist.add_playlist '1', 'playlist_url', 6400, { :audio => 'mp3' }
182
+
183
+ message = "Playlist is a master playlist, segment can not be added."
184
+ expect { playlist.add_segment 11.344644, "1080-7mbps00000.ts" }.to raise_error(M3u8::PlaylistTypeError, message)
185
+
186
+ playlist = M3u8::Playlist.new
187
+ playlist.add_segment 11.344644, "1080-7mbps00000.ts"
188
+ message = "Playlist is not a master playlist, playlist can not be added."
189
+ expect { playlist.add_playlist '1', 'playlist_url', 6400 }.to raise_error(M3u8::PlaylistTypeError, message)
190
+ end
191
+
192
+ it 'should raise error if codecs are missing' do
193
+ playlist = M3u8::Playlist.new
194
+ message = "An audio or video codec should be provided."
195
+ expect { playlist.add_playlist '1', 'playlist_url', 6400 }.to raise_error(M3u8::MissingCodecError, message)
196
+ end
197
+
198
+ end
@@ -0,0 +1,95 @@
1
+ require 'm3u8/playlist'
2
+ require 'm3u8/error'
3
+
4
+ require 'coveralls'
5
+ Coveralls.wear!
6
+
7
+ # This file was generated by the `rspec --init` command. Conventionally, all
8
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
9
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
10
+ # file to always be loaded, without a need to explicitly require it in any files.
11
+ #
12
+ # Given that it is always loaded, you are encouraged to keep this file as
13
+ # light-weight as possible. Requiring heavyweight dependencies from this file
14
+ # will add to the boot time of your test suite on EVERY test run, even for an
15
+ # individual file that may not need all of that loaded. Instead, consider making
16
+ # a separate helper file that requires the additional dependencies and performs
17
+ # the additional setup, and require it from the spec files that actually need it.
18
+ #
19
+ # The `.rspec` file also contains a few flags that are not defaults but that
20
+ # users commonly want.
21
+ #
22
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
23
+ RSpec.configure do |config|
24
+ # rspec-expectations config goes here. You can use an alternate
25
+ # assertion/expectation library such as wrong or the stdlib/minitest
26
+ # assertions if you prefer.
27
+ config.expect_with :rspec do |expectations|
28
+ # This option will default to `true` in RSpec 4. It makes the `description`
29
+ # and `failure_message` of custom matchers include text for helper methods
30
+ # defined using `chain`, e.g.:
31
+ # be_bigger_than(2).and_smaller_than(4).description
32
+ # # => "be bigger than 2 and smaller than 4"
33
+ # ...rather than:
34
+ # # => "be bigger than 2"
35
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
36
+ end
37
+
38
+ # rspec-mocks config goes here. You can use an alternate test double
39
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
40
+ config.mock_with :rspec do |mocks|
41
+ # Prevents you from mocking or stubbing a method that does not exist on
42
+ # a real object. This is generally recommended, and will default to
43
+ # `true` in RSpec 4.
44
+ mocks.verify_partial_doubles = true
45
+ end
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # These two settings work together to allow you to limit a spec run
51
+ # to individual examples or groups you care about by tagging them with
52
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
53
+ # get run.
54
+ config.filter_run :focus
55
+ config.run_all_when_everything_filtered = true
56
+
57
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
58
+ # For more details, see:
59
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
60
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
61
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
62
+ config.disable_monkey_patching!
63
+
64
+ # This setting enables warnings. It's recommended, but in some cases may
65
+ # be too noisy due to issues in dependencies.
66
+ config.warnings = true
67
+
68
+ # Many RSpec users commonly either run the entire suite or an individual
69
+ # file, and it's useful to allow more verbose output when running an
70
+ # individual spec file.
71
+ if config.files_to_run.one?
72
+ # Use the documentation formatter for detailed output,
73
+ # unless a formatter has already been configured
74
+ # (e.g. via a command-line flag).
75
+ config.default_formatter = 'doc'
76
+ end
77
+
78
+ # Print the 10 slowest examples and example groups at the
79
+ # end of the spec run, to help surface which specs are running
80
+ # particularly slow.
81
+ config.profile_examples = 10
82
+
83
+ # Run specs in random order to surface order dependencies. If you find an
84
+ # order dependency and want to debug it, you can fix the order by providing
85
+ # the seed, which is printed after each run.
86
+ # --seed 1234
87
+ config.order = :random
88
+
89
+ # Seed global randomization in this process using the `--seed` CLI option.
90
+ # Setting this allows you to use `--seed` to deterministically reproduce
91
+ # test failures related to randomization by passing the same `--seed` value
92
+ # as the one that triggered the failure.
93
+ Kernel.srand config.seed
94
+ =end
95
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: m3u8
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Seth Deckard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '2.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '2.11'
55
+ description: Generate m3u8 playlists for HTTP Live Streaming (HLS).
56
+ email:
57
+ - seth@deckard.me
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .travis.yml
65
+ - Gemfile
66
+ - LICENSE.txt
67
+ - README.md
68
+ - Rakefile
69
+ - lib/m3u8.rb
70
+ - lib/m3u8/error.rb
71
+ - lib/m3u8/playlist.rb
72
+ - lib/m3u8/version.rb
73
+ - m3u8.gemspec
74
+ - spec/playlist_spec.rb
75
+ - spec/spec_helper.rb
76
+ homepage: ''
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.2.2
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Generate m3u8 playlists for HTTP Live Streaming (HLS).
100
+ test_files:
101
+ - spec/playlist_spec.rb
102
+ - spec/spec_helper.rb