iplayer-dl 0.1.18 → 0.1.19
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.
- data/README +1 -0
- data/Rakefile +0 -4
- data/bin/iplayer-dl +1 -1
- data/lib/{iplayer/.version.rb.swp → .iplayer.rb.swp} +0 -0
- data/lib/iplayer/.browser.rb.swp +0 -0
- data/{bin/.iplayer-dl.swp → lib/iplayer/.constants.rb.swp} +0 -0
- data/lib/iplayer/.downloader.rb.swp +0 -0
- data/lib/iplayer/.metadata.rb.swp +0 -0
- data/lib/iplayer/.subtitles.rb.swp +0 -0
- data/lib/iplayer/browser.rb +2 -2
- data/lib/iplayer/gui/.app.rb.swp +0 -0
- data/lib/iplayer/gui/app.rb +3 -3
- data/lib/iplayer/metadata.rb +5 -2
- data/lib/iplayer/preferences.rb +1 -1
- data/lib/iplayer/version.rb +1 -1
- data/test/.test_metadata.rb.swp +0 -0
- data/test/test_metadata.rb +35 -0
- metadata +21 -17
data/README
CHANGED
data/Rakefile
CHANGED
@@ -88,10 +88,6 @@ begin
|
|
88
88
|
# using GitHub, edit as appropriate.
|
89
89
|
Rake::GemPackageTask.new(spec) do |pkg|
|
90
90
|
pkg.gem_spec = spec
|
91
|
-
|
92
|
-
# Generate the gemspec file for github.
|
93
|
-
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
|
94
|
-
File.open(file, "w") {|f| f << spec.to_ruby }
|
95
91
|
end
|
96
92
|
rescue LoadError
|
97
93
|
end
|
data/bin/iplayer-dl
CHANGED
@@ -89,7 +89,7 @@ if http_proxy = preferences.http_proxy
|
|
89
89
|
http_proxy = 'http://' + http_proxy unless http_proxy =~ %r{^http://}
|
90
90
|
u = URI.parse(http_proxy)
|
91
91
|
$stderr.puts "Using proxy #{u.host}:#{u.port}"
|
92
|
-
http = Net::HTTP::Proxy(u.host, u.port)
|
92
|
+
http = Net::HTTP::Proxy(u.host, u.port, u.user, u.password)
|
93
93
|
else
|
94
94
|
http = Net::HTTP
|
95
95
|
end
|
Binary file
|
data/lib/iplayer/.browser.rb.swp
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/iplayer/browser.rb
CHANGED
@@ -3,13 +3,13 @@ require 'uri'
|
|
3
3
|
|
4
4
|
class Net::HTTPResponse # Monkey-patch in some 21st-century functionality
|
5
5
|
include Enumerable
|
6
|
-
|
6
|
+
|
7
7
|
def cookies
|
8
8
|
inject([]){ |acc, (key, value)|
|
9
9
|
key == 'set-cookie' ? acc << value.split(/;/).first : acc
|
10
10
|
}
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def to_hash
|
14
14
|
@to_hash ||= inject({}){ |hash, (key, value)|
|
15
15
|
hash[key] = value
|
Binary file
|
data/lib/iplayer/gui/app.rb
CHANGED
@@ -15,7 +15,7 @@ class App < Wx::App
|
|
15
15
|
if http_proxy = @options[:http_proxy]
|
16
16
|
http_proxy = 'http://' + http_proxy unless http_proxy =~ %r{^http://}
|
17
17
|
u = URI.parse(http_proxy)
|
18
|
-
http = Net::HTTP::Proxy(u.host, u.port)
|
18
|
+
http = Net::HTTP::Proxy(u.host, u.port, u.user, u.password)
|
19
19
|
else
|
20
20
|
http = Net::HTTP
|
21
21
|
end
|
@@ -31,8 +31,8 @@ class App < Wx::App
|
|
31
31
|
downloader = Downloader.new(@browser, pid)
|
32
32
|
available_versions = downloader.available_versions
|
33
33
|
raise MP4Unavailable if available_versions.empty?
|
34
|
-
version = available_versions.sort_by{ |v|
|
35
|
-
@options[:type_preference].index(v.name) || 100
|
34
|
+
version = available_versions.sort_by{ |v|
|
35
|
+
@options[:type_preference].index(v.name) || 100
|
36
36
|
}.first
|
37
37
|
|
38
38
|
self.yield
|
data/lib/iplayer/metadata.rb
CHANGED
@@ -18,7 +18,7 @@ class Metadata
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def full_title
|
21
|
-
mixed_title.gsub(/\s*:\s*/, ' - ')
|
21
|
+
dmy_to_ymd(mixed_title).gsub(/\s*:\s*/, ' - ')
|
22
22
|
end
|
23
23
|
|
24
24
|
def filetype
|
@@ -36,7 +36,6 @@ class Metadata
|
|
36
36
|
end
|
37
37
|
|
38
38
|
private
|
39
|
-
|
40
39
|
def metadata
|
41
40
|
@metadata ||= REXML::Document.new( @browser.get(METADATA_URL % @pid).body )
|
42
41
|
rescue Exception => e
|
@@ -60,5 +59,9 @@ private
|
|
60
59
|
programme_type == 'radioProgramme'
|
61
60
|
end
|
62
61
|
|
62
|
+
# convert UK date format to YYYY-MM-DD so that it can be sorted easily
|
63
|
+
def dmy_to_ymd(s)
|
64
|
+
s.sub(%r[(\d{2})/(\d{2})/(\d{4})], "\\3-\\2-\\1")
|
65
|
+
end
|
63
66
|
end
|
64
67
|
end
|
data/lib/iplayer/preferences.rb
CHANGED
data/lib/iplayer/version.rb
CHANGED
Binary file
|
data/test/test_metadata.rb
CHANGED
@@ -72,4 +72,39 @@ class MetadataTest < Test::Unit::TestCase
|
|
72
72
|
expected = {'anonymous' => 'b00htg55'}
|
73
73
|
assert_equal expected, metadata.versions
|
74
74
|
end
|
75
|
+
|
76
|
+
def test_should_rearrange_DDMMYYYY_dates_to_YYYYMMDD
|
77
|
+
xml = %{
|
78
|
+
<playlist xmlns="http://bbc.co.uk/2008/emp/playlist" revision="1">
|
79
|
+
<config>
|
80
|
+
<plugin name="iPlayerLiveStats"/>
|
81
|
+
<plugin name="spacesReporting"/>
|
82
|
+
</config>
|
83
|
+
<id>tag:bbc.co.uk,2008:pips:b00769ss:playlist</id>
|
84
|
+
<link rel="self" href="http://www.bbc.co.uk/iplayer/playlist/b00769ss/"/>
|
85
|
+
<link rel="alternate" href="http://www.bbc.co.uk/iplayer/episode/b00769ss/That_Reminds_Me_01_10_2002/"/>
|
86
|
+
<link rel="holding" href="http://node2.bbcimg.co.uk/iplayer/images/episode/b00769ss_640_360.jpg" height="360" width="640" type="image/jpeg" />
|
87
|
+
<title>That Reminds Me: 01/10/2002</title>
|
88
|
+
<summary>The late Ludovic Kennedy reminisces about his life. He remembers a very Eton schoolboy prank involving hiring a plane, and shares memories of his favourite interviewees.</summary>
|
89
|
+
<updated>2009-12-10T00:05:48Z</updated>
|
90
|
+
<rights>
|
91
|
+
<right name="embed">unset</right>
|
92
|
+
</rights>
|
93
|
+
<item kind="radioProgramme" duration="1800" identifier="b001x3rr" group="b00769ss" publisher="pips">
|
94
|
+
<title>That Reminds Me: 01/10/2002</title>
|
95
|
+
<broadcast>2009-12-24T20:00:00Z</broadcast>
|
96
|
+
<service id="bbc_radio_four" href="http://www.bbc.co.uk/iplayer/bbc_radio_four">BBC Radio 4</service>
|
97
|
+
<masterbrand id="bbc_radio_four" href="http://www.bbc.co.uk/iplayer/bbc_radio_four">BBC Radio 4</masterbrand>
|
98
|
+
<passionSite href="http://www.bbc.co.uk/programmes/b00dzkk0/microsite">That Reminds Me</passionSite>
|
99
|
+
<alternate id="default" />
|
100
|
+
<mediator identifier="b001x3rr" name="pips"/>
|
101
|
+
</item>
|
102
|
+
</playlist>
|
103
|
+
}
|
104
|
+
pid = 'abc'
|
105
|
+
browser = stub(:get => stub(:body => xml))
|
106
|
+
metadata = IPlayer::Metadata.new(pid, browser)
|
107
|
+
assert_match /2002-10-01/, metadata.full_title
|
108
|
+
end
|
109
|
+
|
75
110
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iplayer-dl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Battley
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-20 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,33 +35,37 @@ files:
|
|
35
35
|
- README
|
36
36
|
- setup.rb
|
37
37
|
- Rakefile
|
38
|
-
- lib
|
39
|
-
- lib/iplayer/
|
40
|
-
- lib/iplayer
|
41
|
-
- lib/iplayer/downloader.rb
|
38
|
+
- lib/.iplayer.rb.swp
|
39
|
+
- lib/iplayer/errors.rb
|
40
|
+
- lib/iplayer/.metadata.rb.swp
|
42
41
|
- lib/iplayer/preferences.rb
|
43
|
-
- lib/iplayer
|
42
|
+
- lib/iplayer/.downloader.rb.swp
|
43
|
+
- lib/iplayer/.subtitles.rb.swp
|
44
|
+
- lib/iplayer/subtitles.rb
|
45
|
+
- lib/iplayer/downloader.rb
|
46
|
+
- lib/iplayer/constants.rb
|
47
|
+
- lib/iplayer/.constants.rb.swp
|
44
48
|
- lib/iplayer/gui/app.rb
|
49
|
+
- lib/iplayer/gui/.app.rb.swp
|
50
|
+
- lib/iplayer/gui/frame.rb
|
45
51
|
- lib/iplayer/gui/main_frame.rb
|
46
|
-
- lib/iplayer/subtitles.rb
|
47
|
-
- lib/iplayer/errors.rb
|
48
52
|
- lib/iplayer/.browser.rb.swp
|
49
|
-
- lib/iplayer/.downloader.rb.swp
|
50
|
-
- lib/iplayer/translations.rb
|
51
53
|
- lib/iplayer/metadata.rb
|
52
|
-
- lib/iplayer/
|
54
|
+
- lib/iplayer/browser.rb
|
55
|
+
- lib/iplayer/translations.rb
|
56
|
+
- lib/iplayer/version.rb
|
53
57
|
- lib/iplayer.rb
|
58
|
+
- test/test_subtitles.rb
|
54
59
|
- test/test_preferences.rb
|
60
|
+
- test/.test_metadata.rb.swp
|
55
61
|
- test/test_metadata.rb
|
56
|
-
- test/test_subtitles.rb
|
57
62
|
- bin/iplayer-dl
|
58
63
|
- bin/iplayer-dl-gui
|
59
|
-
-
|
60
|
-
- share/pixmaps/iplayer-dl/
|
64
|
+
- share/pixmaps/iplayer-dl/icon64.png
|
65
|
+
- share/pixmaps/iplayer-dl/icon32.png
|
61
66
|
- share/pixmaps/iplayer-dl/icon48.png
|
62
67
|
- share/pixmaps/iplayer-dl/icon16.png
|
63
|
-
- share/pixmaps/iplayer-dl/
|
64
|
-
- share/pixmaps/iplayer-dl/icon64.png
|
68
|
+
- share/pixmaps/iplayer-dl/icon128.png
|
65
69
|
has_rdoc: true
|
66
70
|
homepage: http://po-ru.com/projects/iplayer-downloader
|
67
71
|
licenses: []
|