serienrenamer 0.0.11 → 0.0.12
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/.travis.yml +4 -0
- data/Gemfile +1 -0
- data/README.rdoc +2 -1
- data/Rakefile +2 -0
- data/lib/plugin/episode_identifier.rb +33 -0
- data/lib/plugin/wikipedia.rb +1 -1
- data/lib/serienrenamer.rb +1 -1
- data/lib/serienrenamer/episode.rb +7 -0
- data/lib/serienrenamer/version.rb +3 -0
- data/serienrenamer.gemspec +1 -1
- data/test/test_plugin_episode_identifier.rb +38 -0
- data/test/test_plugin_wikipedia.rb +1 -20
- metadata +13 -3
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= serienrenamer
|
1
|
+
= serienrenamer {<img src="https://secure.travis-ci.org/pboehm/serienrenamer.png" />}[http://travis-ci.org/pboehm/serienrenamer]
|
2
2
|
|
3
3
|
* http://github.com/pboehm/serienrenamer
|
4
4
|
|
@@ -16,6 +16,7 @@ like "S01E01 - Episodename.avi"
|
|
16
16
|
* query the serienjunkies.org Page for series specific data
|
17
17
|
* query the serienjunkies.de Page for series specific data
|
18
18
|
* query wikipedia for episode information
|
19
|
+
* contains a plugin that creates an episodename out of the episode identifier
|
19
20
|
* repair broken german umlauts if the occur in the episode title
|
20
21
|
* rename these files
|
21
22
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# class that creates an episodename out of the episode identifier
|
2
|
+
# for S02E04 the episodename would be "Episode 4"
|
3
|
+
|
4
|
+
module Plugin
|
5
|
+
|
6
|
+
class EpisodeIdentifier < Serienrenamer::Pluginbase
|
7
|
+
|
8
|
+
def self.plugin_name; "EpisodeIdentifier" end
|
9
|
+
def self.usable; true end
|
10
|
+
def self.priority; 1 end
|
11
|
+
|
12
|
+
# this method will be called from the main program
|
13
|
+
# with an Serienrenamer::Episode instance or a path
|
14
|
+
# to to a directory as parameter
|
15
|
+
#
|
16
|
+
# it returns an array of episode information
|
17
|
+
def self.generate_episode_information(episode)
|
18
|
+
|
19
|
+
path = episode.episodepath
|
20
|
+
|
21
|
+
matched_episodes = []
|
22
|
+
|
23
|
+
if Serienrenamer::Episode.contains_episode_information?(path)
|
24
|
+
if md = Serienrenamer::Episode.extract_episode_information(path)
|
25
|
+
episodename = "Episode %d" % [ md[:episode] ]
|
26
|
+
matched_episodes << episodename
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
return matched_episodes
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/plugin/wikipedia.rb
CHANGED
@@ -52,7 +52,7 @@ module Plugin
|
|
52
52
|
search_pattern_modified = false
|
53
53
|
|
54
54
|
begin
|
55
|
-
wiki.search(search_pattern, nil,
|
55
|
+
wiki.search(search_pattern, nil, 15).each do |title|
|
56
56
|
pagedata = wiki.get(title)
|
57
57
|
if is_series_main_page?(pagedata)
|
58
58
|
series_site = title
|
data/lib/serienrenamer.rb
CHANGED
data/serienrenamer.gemspec
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
3
|
+
|
4
|
+
class TestPluginEpisodeIdentifier < Test::Unit::TestCase
|
5
|
+
@@files = {
|
6
|
+
'chuck' => 'chuck.312.hdtv-lol.avi',
|
7
|
+
'csiny' => 'sof-csi.ny.s07e01.avi',
|
8
|
+
'simps' => 'simpsons.s22e16.avi',
|
9
|
+
}
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@plugin = Plugin::EpisodeIdentifier
|
13
|
+
TestHelper.create_test_files(@@files.values)
|
14
|
+
TestHelper.cwd
|
15
|
+
end
|
16
|
+
|
17
|
+
def teardown
|
18
|
+
TestHelper.clean
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_information_extraction
|
22
|
+
|
23
|
+
simps = Serienrenamer::Episode.new(@@files['simps'])
|
24
|
+
data = @plugin.generate_episode_information(simps)[0]
|
25
|
+
simps.add_episode_information(data, true)
|
26
|
+
assert_equal("S22E16 - Episode 16.avi", simps.to_s)
|
27
|
+
|
28
|
+
chuck = Serienrenamer::Episode.new(@@files['chuck'])
|
29
|
+
data = @plugin.generate_episode_information(chuck)[0]
|
30
|
+
chuck.add_episode_information(data, true)
|
31
|
+
assert_equal("S03E12 - Episode 12.avi", chuck.to_s)
|
32
|
+
|
33
|
+
csiny = Serienrenamer::Episode.new(@@files['csiny'])
|
34
|
+
data = @plugin.generate_episode_information(csiny)[0]
|
35
|
+
csiny.add_episode_information(data, true)
|
36
|
+
assert_equal("S07E01 - Episode 1.avi", csiny.to_s)
|
37
|
+
end
|
38
|
+
end
|
@@ -82,20 +82,6 @@ class TestPluginWikipedia < Test::Unit::TestCase
|
|
82
82
|
assert_equal("Doppelgänger", seasons[1][6])
|
83
83
|
assert_equal("Unruhiges Blut", seasons[1][9])
|
84
84
|
|
85
|
-
data = wiki.get("Royal Pains")
|
86
|
-
seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
|
87
|
-
|
88
|
-
assert_equal("Auch Reiche sind nur Menschen", seasons[1][1])
|
89
|
-
assert_equal("Krank vor Liebe", seasons[2][2])
|
90
|
-
assert_equal("Mich trifft der Blitz", seasons[2][16])
|
91
|
-
|
92
|
-
data = wiki.get("Flashpoint – Das Spezialkommando")
|
93
|
-
seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
|
94
|
-
|
95
|
-
assert_equal("Skorpion", seasons[1][1])
|
96
|
-
assert_equal("Die Festung", seasons[2][2])
|
97
|
-
assert_equal("Der Beschützer", seasons[2][16])
|
98
|
-
|
99
85
|
data = wiki.get("Dr. Dani Santino – Spiel des Lebens")
|
100
86
|
seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
|
101
87
|
|
@@ -115,11 +101,6 @@ class TestPluginWikipedia < Test::Unit::TestCase
|
|
115
101
|
def test_episode_information_generation
|
116
102
|
|
117
103
|
VCR.use_cassette("wiki_#{method_name}") do
|
118
|
-
flpo = Serienrenamer::Episode.new(@@files['flpo'])
|
119
|
-
data = Plugin::Wikipedia.generate_episode_information(flpo)[0]
|
120
|
-
flpo.add_episode_information(data, false) if data
|
121
|
-
assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
|
122
|
-
|
123
104
|
two = Serienrenamer::Episode.new(@@files['two'])
|
124
105
|
data = Plugin::Wikipedia.generate_episode_information(two)[0]
|
125
106
|
two.add_episode_information(data, false) if data
|
@@ -187,7 +168,7 @@ class TestPluginWikipedia < Test::Unit::TestCase
|
|
187
168
|
|
188
169
|
assert_equal(false, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Bones")))
|
189
170
|
assert_equal(true, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("The Glades")))
|
190
|
-
assert_equal(
|
171
|
+
assert_equal(false, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Royal Pains")))
|
191
172
|
end
|
192
173
|
|
193
174
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serienrenamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wlapi
|
@@ -101,11 +101,13 @@ extensions: []
|
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
103
|
- .gitignore
|
104
|
+
- .travis.yml
|
104
105
|
- Gemfile
|
105
106
|
- README.rdoc
|
106
107
|
- Rakefile
|
107
108
|
- bin/serienrenamer
|
108
109
|
- lib/plugin.rb
|
110
|
+
- lib/plugin/episode_identifier.rb
|
109
111
|
- lib/plugin/serienjunkies_de.rb
|
110
112
|
- lib/plugin/serienjunkies_feed.rb
|
111
113
|
- lib/plugin/serienjunkies_org.rb
|
@@ -114,11 +116,13 @@ files:
|
|
114
116
|
- lib/serienrenamer.rb
|
115
117
|
- lib/serienrenamer/episode.rb
|
116
118
|
- lib/serienrenamer/information_store.rb
|
119
|
+
- lib/serienrenamer/version.rb
|
117
120
|
- serienrenamer.gemspec
|
118
121
|
- test/serienjunkies_feed_sample.xml
|
119
122
|
- test/test_episode.rb
|
120
123
|
- test/test_helper.rb
|
121
124
|
- test/test_information_store.rb
|
125
|
+
- test/test_plugin_episode_identifier.rb
|
122
126
|
- test/test_plugin_serienjunkies_de.rb
|
123
127
|
- test/test_plugin_serienjunkies_feed.rb
|
124
128
|
- test/test_plugin_textfile.rb
|
@@ -136,12 +140,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
140
|
- - ! '>='
|
137
141
|
- !ruby/object:Gem::Version
|
138
142
|
version: '0'
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
hash: -3488055912419224280
|
139
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
147
|
none: false
|
141
148
|
requirements:
|
142
149
|
- - ! '>='
|
143
150
|
- !ruby/object:Gem::Version
|
144
151
|
version: '0'
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
hash: -3488055912419224280
|
145
155
|
requirements: []
|
146
156
|
rubyforge_project:
|
147
157
|
rubygems_version: 1.8.24
|
@@ -154,9 +164,9 @@ test_files:
|
|
154
164
|
- test/test_episode.rb
|
155
165
|
- test/test_helper.rb
|
156
166
|
- test/test_information_store.rb
|
167
|
+
- test/test_plugin_episode_identifier.rb
|
157
168
|
- test/test_plugin_serienjunkies_de.rb
|
158
169
|
- test/test_plugin_serienjunkies_feed.rb
|
159
170
|
- test/test_plugin_textfile.rb
|
160
171
|
- test/test_plugin_wikipedia.rb
|
161
172
|
- test/test_serienjunkies_org.rb
|
162
|
-
has_rdoc:
|