m3u8 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 692b6b95751961d33c5a99b902815343faa94ef8
4
- data.tar.gz: 5e9fe6ceb3d9f9d3210880e5df34ab0c44082cea
3
+ metadata.gz: b4e584f9677b6f81c20f52ee7829611fb1586139
4
+ data.tar.gz: 33f822204530d6af5339426a4d986b5edf21ed2c
5
5
  SHA512:
6
- metadata.gz: 9cbc51a229e659aa49f09794c5825eca8be24e47462e0bfc74484391640bc4d1e497b139a0e8c475a4880b572d723fe9cef0638e702a18b0a1ef69f8ef4d5546
7
- data.tar.gz: bbff2a3695684af2113554fec5bc8b6b55535c1d188fd22ab7faf9374a6c88319f3f7d7b4660e9ca44c722e8e85f3949d8b1d78cd8cef62c2bbc39737ca8ec44
6
+ metadata.gz: 330864a27a4338191fa141e861f4bb1a7e88984af9f0a4a70e647157be5c43c75cad442d6e76c0b7743004f82769e9bcabc453c47b2ba49184aa2e7d3e23f243
7
+ data.tar.gz: bf442b7d7e652a5a2e7935a4b1f9d8d2ec455f9ae87c4e21d8329b4dd6ec36770d0e3ffe0d1e29b723bf72633569291baf2397b574295f53635fdd2b8ac3eb57
@@ -1,3 +1,5 @@
1
+ #### 0.6.8 (4/12/2016) - Merged pull request #16 from [ghn](https://github.com/ghn). Fixes issue #12 to support parsing #EXT-X-PROGRAM-DATE-TIME correctly in media segments.
2
+
1
3
  #### 0.6.7 (4/8/2016) - Merged pull request #15 from [jviney](https://github.com/jviney). Fix: Always render the duration as a decimal integer.
2
4
 
3
5
  #### 0.6.6 (3/30/2016) - Merged pull request #14 from [raphi](https://github.com/raphi). Adds support for non-standard name attribute on #EXT-X-STREAM-INF tags.
@@ -152,8 +152,12 @@ module M3u8
152
152
  end
153
153
 
154
154
  def parse_time(line)
155
- self.open = false
156
- playlist.items << M3u8::TimeItem.parse(line)
155
+ if open
156
+ item.program_date_time = M3u8::TimeItem.parse(line)
157
+ else
158
+ self.open = false
159
+ playlist.items << M3u8::TimeItem.parse(line)
160
+ end
157
161
  end
158
162
 
159
163
  def parse_next_line(line)
@@ -3,14 +3,15 @@ module M3u8
3
3
  # optionally allowing an EXT-X-BYTERANGE tag to be set.
4
4
  class SegmentItem
5
5
  include M3u8
6
- attr_accessor :duration, :segment, :comment, :byterange
6
+ attr_accessor :duration, :segment, :comment, :program_date_time, :byterange
7
7
 
8
8
  def initialize(params = {})
9
9
  intialize_with_byterange(params)
10
10
  end
11
11
 
12
12
  def to_s
13
- "#EXTINF:#{duration},#{comment}#{byterange_format}\n#{segment}"
13
+ date = "#{program_date_time}\n" unless program_date_time.nil?
14
+ "#EXTINF:#{duration},#{comment}#{byterange_format}\n#{date}#{segment}"
14
15
  end
15
16
 
16
17
  private
@@ -1,4 +1,4 @@
1
1
  # M3u8 provides parsing, generation, and validation of m3u8 playlists
2
2
  module M3u8
3
- VERSION = '0.6.7'
3
+ VERSION = '0.6.8'
4
4
  end
@@ -0,0 +1,22 @@
1
+ #EXTM3U
2
+ #EXT-X-VERSION:2
3
+ #EXT-X-TARGETDURATION:10
4
+ #EXT-X-MEDIA-SEQUENCE:1736515
5
+ #EXTINF:10, no desc
6
+ #EXT-X-PROGRAM-DATE-TIME:2016-04-11T15:24:31Z
7
+ 20160408T084506-01-1736515.ts
8
+ #EXTINF:10, no desc
9
+ #EXT-X-PROGRAM-DATE-TIME:2016-04-11T15:24:41Z
10
+ 20160408T084506-01-1736516.ts
11
+ #EXTINF:10, no desc
12
+ #EXT-X-PROGRAM-DATE-TIME:2016-04-11T15:24:51Z
13
+ 20160408T084506-01-1736517.ts
14
+ #EXTINF:10, no desc
15
+ #EXT-X-PROGRAM-DATE-TIME:2016-04-11T15:25:01Z
16
+ 20160408T084506-01-1736518.ts
17
+ #EXTINF:10, no desc
18
+ #EXT-X-PROGRAM-DATE-TIME:2016-04-11T15:25:11Z
19
+ 20160408T084506-01-1736519.ts
20
+ #EXTINF:10, no desc
21
+ #EXT-X-PROGRAM-DATE-TIME:2016-04-11T15:25:21Z
22
+ 20160408T084506-01-1736520.ts
@@ -221,4 +221,15 @@ describe M3u8::Reader do
221
221
  expect(item.byterange.length).to eq 4500
222
222
  expect(item.byterange.start).to eq 600
223
223
  end
224
+
225
+ it 'should read segment with timestamp' do
226
+ file = File.open 'spec/fixtures/timestamp_playlist.m3u8'
227
+ reader = M3u8::Reader.new
228
+ playlist = reader.read file
229
+ expect(playlist.items.count).to eq 6
230
+
231
+ item_date_time = playlist.items.first.program_date_time
232
+ expect(item_date_time).to be_a M3u8::TimeItem
233
+ expect(item_date_time.time).to eq Time.iso8601('2016-04-11T15:24:31Z')
234
+ end
224
235
  end
@@ -8,6 +8,7 @@ describe M3u8::SegmentItem do
8
8
  expect(item.segment).to eq 'test.ts'
9
9
  expect(item.comment).to be_nil
10
10
  expect(item.byterange).to be_nil
11
+ expect(item.program_date_time).to be_nil
11
12
 
12
13
  hash = { duration: 10.991, segment: 'test.ts', comment: 'anything',
13
14
  byterange: {
@@ -24,10 +25,15 @@ describe M3u8::SegmentItem do
24
25
  end
25
26
 
26
27
  it 'should provide m3u8 format representation' do
27
- hash = { duration: 10.991, segment: 'test.ts' }
28
+ time_hash = { time: '2010-02-19T14:54:23.031' }
29
+ time_item = M3u8::TimeItem.new(time_hash)
30
+
31
+ hash = { duration: 10.991, segment: 'test.ts',
32
+ program_date_time: time_item }
28
33
  item = M3u8::SegmentItem.new(hash)
29
34
  output = item.to_s
30
- expected = "#EXTINF:10.991,\ntest.ts"
35
+ date_time_output = item.program_date_time.to_s
36
+ expected = "#EXTINF:10.991,\n#{date_time_output}\ntest.ts"
31
37
  expect(output).to eq expected
32
38
 
33
39
  hash = { duration: 10.991, segment: 'test.ts', comment: 'anything' }
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.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Deckard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-08 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -153,6 +153,7 @@ files:
153
153
  - spec/fixtures/playlist.m3u8
154
154
  - spec/fixtures/playlist_with_comments.m3u8
155
155
  - spec/fixtures/session_data.m3u8
156
+ - spec/fixtures/timestamp_playlist.m3u8
156
157
  - spec/fixtures/variant_angles.m3u8
157
158
  - spec/fixtures/variant_audio.m3u8
158
159
  - spec/lib/m3u8/byte_range_spec.rb
@@ -203,6 +204,7 @@ test_files:
203
204
  - spec/fixtures/playlist.m3u8
204
205
  - spec/fixtures/playlist_with_comments.m3u8
205
206
  - spec/fixtures/session_data.m3u8
207
+ - spec/fixtures/timestamp_playlist.m3u8
206
208
  - spec/fixtures/variant_angles.m3u8
207
209
  - spec/fixtures/variant_audio.m3u8
208
210
  - spec/lib/m3u8/byte_range_spec.rb