svt-recorder 0.9

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.
@@ -0,0 +1,9 @@
1
+ #EXTM3U
2
+ #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=258689
3
+ GEOSEMOBIL_1027MATVECKA-PLAY-hts-a-v1_1_Layer2_vod.m3u8
4
+ #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=696752
5
+ stream-layer1-vod.m3u8
6
+ #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=143498
7
+ GEOSEMOBIL_1027MATVECKA-PLAY-hts-a-v1_1_Layer3_vod.m3u8
8
+ #EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=47646
9
+ GEOSEMOBIL_1027MATVECKA-PLAY-hts-a-v1_1_Layer4_vod.m3u8
@@ -0,0 +1,64 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ module SVT
5
+ module Recorder
6
+ describe Play do
7
+ describe 'Play.record' do
8
+ it 'should not raise any exceptions' do
9
+ lambda { SVT::Recorder::Play.record($play_html) }.should_not raise_error
10
+ end
11
+
12
+ it 'should return an array consisting of [base_url, [parts], bitrate, video_title]' do
13
+ data = SVT::Recorder::Play.record($play_html)
14
+
15
+ data.size.should == 4
16
+ data[3].should == 'Matvecka: Varför är de smala inte feta? - Dokumentärfilm'
17
+ end
18
+ end
19
+
20
+ let(:bitrate) { 696752 }
21
+ let(:recorder) { SVT::Recorder::Play.new($play_html) }
22
+
23
+ describe "#new" do
24
+ it "should take an argument that is a URL to a SVT Play page" do
25
+ lambda { SVT::Recorder::Play.new($play_html) }.should_not raise_error
26
+ end
27
+
28
+ it "should raise an ArgumentError exception if the page does not contain a <video> tag" do
29
+ lambda { SVT::Recorder::Play.new($faulty_play_html) }.should raise_error(ArgumentError)
30
+ end
31
+ end
32
+
33
+ describe '#title' do
34
+ it 'should return the title set on the HTML page' do
35
+ recorder.title.should == 'Matvecka: Varför är de smala inte feta? - Dokumentärfilm'
36
+ end
37
+ end
38
+
39
+ describe '#bitrates' do
40
+ it 'should give a list of all available bitrates' do
41
+ recorder.bitrates.sort.should == [47646, 143498, 696752, 258689].sort
42
+ end
43
+ end
44
+
45
+ describe '#part_urls' do
46
+ it 'should return an array consisting of [base_url, parts, bitrate]' do
47
+ recorder.bitrates
48
+ parts = recorder.part_urls(bitrate)
49
+
50
+ parts[0].should == 'spec/support'
51
+ parts[1].size.should == 308
52
+ parts[2].should == bitrate
53
+ end
54
+
55
+ it 'should choose the highest bitrate available if no bitrate is passed in' do
56
+ parts = recorder.part_urls
57
+
58
+ parts[2].should == 696752
59
+ end
60
+ end
61
+ end
62
+ end # /Recorder
63
+ end # /SVT
64
+
@@ -0,0 +1,61 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ module SVT
5
+ module Recorder
6
+ describe Rapport do
7
+ class Rapport
8
+ def rapport_xml_url(id = '')
9
+ "spec/support/#{id}"
10
+ end
11
+ end
12
+
13
+ describe 'Rapport.record' do
14
+ it 'should not raise any exceptions' do
15
+ lambda { SVT::Recorder::Rapport.record($rapport_url) }.should_not raise_error
16
+ end
17
+
18
+ it 'should return an array consisting of [base_url, [parts], bitrate, video_title]' do
19
+ data = SVT::Recorder::Rapport.record($rapport_url)
20
+ data.size.should == 4
21
+ data[3].should == 'Huvudvärk kan ha orsakat polispådraget i Göteborg'
22
+ end
23
+ end
24
+
25
+ let(:recorder) { SVT::Recorder::Rapport.new($rapport_url) }
26
+
27
+ describe '#new' do
28
+ it 'should take an argument that is a URL to a Play Rapport video' do
29
+ lambda { SVT::Recorder::Rapport.new($rapport_url) }.should_not raise_error
30
+ end
31
+ end
32
+
33
+ describe '#title' do
34
+ it 'should return the video title' do
35
+ recorder.title.should == 'Huvudvärk kan ha orsakat polispådraget i Göteborg'
36
+ end
37
+ end
38
+
39
+ describe '#bitrates' do
40
+ it 'should return the available bitrates' do
41
+ recorder.bitrates.sort.should == [650]
42
+ end
43
+ end
44
+
45
+ describe '#part_urls' do
46
+ it 'should not care what is passed in as a bitrate' do
47
+ lambda { recorder.part_urls('I AM CRRRRAAZY!!!!') }.should_not raise_error
48
+ end
49
+
50
+ it 'should return an array consisting of [base_url, parts, bitrate]' do
51
+ parts = recorder.part_urls
52
+
53
+ parts[0].should == 'http://www0.c00928.cdn.qbrick.com/00928/kluster/20101101'
54
+ parts[1].size.should == 1
55
+ parts[1][0].should == 'PR-2010-1101-TOHAGBG1930.flv'
56
+ parts[2].should == 650
57
+ end
58
+ end
59
+ end # /Rapport
60
+ end # /Recorder
61
+ end # /SVT
@@ -0,0 +1,18 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe 'SVT::Recorder.record' do
5
+ it 'should instantiate a Rapport recorder when called with a playrapport.se URL' do
6
+ SVT::Recorder::Rapport.stub(:record)
7
+ SVT::Recorder::Rapport.should_receive(:record)
8
+
9
+ SVT::Recorder.record('http://playrapport.se/#/video/2220728')
10
+ end
11
+
12
+ it 'should instantiate a Play recorder when the URL does not match playrapport.se' do
13
+ SVT::Recorder::Play.stub(:record)
14
+ SVT::Recorder::Play.should_receive(:record)
15
+
16
+ SVT::Recorder.record('http://svtplay.se/t/103472/wikileaks')
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: svt-recorder
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.9"
5
+ platform: ruby
6
+ authors:
7
+ - "Bj\xC3\xB6rn Andersson"
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-11-02 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.0.0
24
+ version:
25
+ description: A program that helps you record videos from SVTPlay.se and PlayRapport.se
26
+ email: ba@sanitarium.se
27
+ executables:
28
+ - svt-recorder
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README
33
+ files:
34
+ - README
35
+ - lib/svt/recorder.rb
36
+ - lib/svt/recorder/rapport.rb
37
+ - lib/svt/recorder/play.rb
38
+ - spec/svt_recorder_rapport_spec.rb
39
+ - spec/spec_helper.rb
40
+ - spec/svt_recorder_play_spec.rb
41
+ - spec/svt_recorder_spec.rb
42
+ - spec/support/example-page.html
43
+ - spec/support/2220728
44
+ - spec/support/faulty-example-page.html
45
+ - spec/support/streams.m3u8
46
+ - spec/support/stream-layer1-vod.m3u8
47
+ has_rdoc: true
48
+ homepage: http://github.com/gaqzi/svt-recorder
49
+ licenses: []
50
+
51
+ post_install_message:
52
+ rdoc_options:
53
+ - -x spec --main lib/svt/recorder.rb --line-numbers
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: "0"
61
+ version:
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ requirements: []
69
+
70
+ rubyforge_project:
71
+ rubygems_version: 1.3.5
72
+ signing_key:
73
+ specification_version: 3
74
+ summary: A program that helps you record videos from SVTPlay.se and PlayRapport.se
75
+ test_files:
76
+ - spec/svt_recorder_rapport_spec.rb
77
+ - spec/svt_recorder_play_spec.rb
78
+ - spec/svt_recorder_spec.rb