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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 076a51812bf0e0b15592085e11cdbd8c16f891a0
4
- data.tar.gz: deb1623d472e42656015eee0db7b98d065524db9
3
+ metadata.gz: 1b0a12ed7f44279220cc4ff7875ac7489d3acdd8
4
+ data.tar.gz: 6d402ff9367f418ba336d43b82fd31d3b53a713d
5
5
  SHA512:
6
- metadata.gz: b60b8c3ac32179a37c3bbbc4ee5dbbfd15c31b37e8b0e24da79f831040effe821bb567f3bd99003dab2405ca3bc41d34a284b4431274ae772883227333292141
7
- data.tar.gz: fc80b8e642ce134f7af812d421453d8a1fa198d00ea183b178ce217f8594512ca8c11754e8b073d635a5bb66f15239ac82080208fc07c62e7dda1a77c2ee3443
6
+ metadata.gz: 67e830b28ab20def54ceb22c1d37c4900faaf75888fcf6d64e84b5d0446a7f979c418935c20cf6ce0bba661a8bc3f28f1d4fa1dda86682096f08c0c939749a59
7
+ data.tar.gz: 120d949eee406b2770d9e216cf8436b1f3a79c64aaa2337fd5037d86bc027772404d18e7688ae4f7073866759bcc76185ebcd77f7ed23670a286d87d80925547
@@ -0,0 +1,3 @@
1
+ ruby:
2
+ enabled: true
3
+ config_file: .rubocop.yml
@@ -0,0 +1,5 @@
1
+ Style/StringLiterals:
2
+ EnforcedStyle: single_quotes
3
+ SupportedStyles:
4
+ - single_quotes
5
+ - double_quotes
@@ -34,8 +34,12 @@ module M3u8
34
34
 
35
35
  def to_s
36
36
  validate
37
- "#EXT-X-STREAM-INF:PROGRAM-ID=#{program_id},#{resolution_format}" +
38
- %(CODECS="#{codecs}",BANDWIDTH=#{bitrate}\n#{playlist})
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)
@@ -1,3 +1,3 @@
1
1
  module M3u8
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -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
@@ -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.1
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-15 00:00:00.000000000 Z
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