serienrenamer 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,84 +0,0 @@
1
- # encoding: UTF-8
2
- require File.dirname(__FILE__) + '/test_helper.rb'
3
-
4
- class TestSerienjunkiesOrg < Test::Unit::TestCase
5
- @@files = {
6
- 'flpo' => 'Flashpoint.S04E04.German.Dubbed.WEB-DL.XViD.avi',
7
- 'dani' => 'Dr.Dani.Santino.S01E04.German.Dubbed.WEB-DL.XViD.avi',
8
- 'two' => 'Two.and.a.half.Men.S06E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
9
- 'sea' => 'Sea.Patrol.s05e11.avi',
10
- }
11
-
12
- def setup
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_seriespage_url_search
22
-
23
- VCR.use_cassette("sjunkie_org_#{method_name}") do
24
- plugin = Serienrenamer::Plugin::SerienjunkiesOrg
25
-
26
- misfits = plugin.find_link_to_series_page("Misfits")
27
- assert_equal("http://serienjunkies.org/serie/misfits/", misfits)
28
-
29
- thementalist = plugin.find_link_to_series_page("The Mentalist")
30
- assert_equal("http://serienjunkies.org/serie/the-mentalist/", thementalist)
31
-
32
- ncis = plugin.find_link_to_series_page("NCIS")
33
- assert_equal("http://serienjunkies.org/serie/ncis/", ncis)
34
- end
35
- end
36
-
37
- def test_parse_seriespage
38
-
39
- VCR.use_cassette("sjunkie_org_#{method_name}") do
40
- plugin = Serienrenamer::Plugin::SerienjunkiesOrg
41
-
42
- seasons = plugin.parse_seriespage(
43
- "http://serienjunkies.org/royal-pains/")
44
- assert_match(/Auch.Reiche.sind.nur.Menschen/, seasons['1_1'])
45
- assert_match(/Krank.vor.Liebe/, seasons['2_2'])
46
-
47
- seasons = plugin.parse_seriespage(
48
- "http://serienjunkies.org/serie/chuck/")
49
- assert_match(/Chuck.gegen.den.Intersect/, seasons['1_1'])
50
- assert_match(/Chuck.gegen.den.Tunnel.des.Schreckens/, seasons['4_6'])
51
-
52
- seasons = plugin.parse_seriespage("http://serienjunkies.org/ncis")
53
- assert_match(/Sprung.in.den.Tod/, seasons['1_2'])
54
- assert_match(/Fuer.immer.jung/, seasons['9_2'])
55
- end
56
- end
57
-
58
- def test_episode_information_generation
59
-
60
- VCR.use_cassette("sjunkie_org_#{method_name}") do
61
- plugin = Serienrenamer::Plugin::SerienjunkiesOrg
62
-
63
- flpo = Serienrenamer::Episode.new(@@files['flpo'])
64
- data = plugin.generate_episode_information(flpo)[0]
65
- flpo.add_episode_information(data, true) if data
66
- assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
67
-
68
- dani = Serienrenamer::Episode.new(@@files['dani'])
69
- data = plugin.generate_episode_information(dani)[0]
70
- dani.add_episode_information(data, true) if data
71
- assert_equal("S01E04 - Gewohnheiten.avi", dani.to_s)
72
-
73
- two = Serienrenamer::Episode.new(@@files['two'])
74
- data = plugin.generate_episode_information(two)[0]
75
- two.add_episode_information(data, true) if data
76
- assert_equal("S06E07 - Alles einsteigen.avi", two.to_s)
77
-
78
- sea = Serienrenamer::Episode.new(@@files['sea'])
79
- data = plugin.generate_episode_information(sea)[0]
80
- sea.add_episode_information(data, true) if data
81
- assert_equal("S05E11 - Der Morgen danach.avi", sea.to_s)
82
- end
83
- end
84
- end
@@ -1,177 +0,0 @@
1
- # encoding: UTF-8
2
- require File.dirname(__FILE__) + '/test_helper.rb'
3
- require 'media_wiki'
4
-
5
- class TestPluginWikipedia < Test::Unit::TestCase
6
- @@files = {
7
- 'flpo' => 'Flashpoint.S04E04.German.Dubbed.WEB-DL.XViD.avi',
8
- 'dani' => 'Dr.Dani.Santino.S01E04.German.Dubbed.WEB-DL.XViD.avi',
9
- 'two' => 'Two.and.a.half.Men.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
10
- 'simp' => 'Die.Simpsons.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
11
- 'sea' => 'tcpa-seapatrol_s05e11.avi',
12
- }
13
-
14
- @@directories = {
15
- 'chuck' => 'Chuck.S01E01.German.Dubbed.BLURAYRiP.WEB-DL',
16
- 'chuck2' => 'Chuck.S02E10.German.Dubbed.BLURAYRiP.WEB-DL',
17
- }
18
-
19
- def setup
20
- TestHelper.create_test_files(@@files.values)
21
- TestHelper.create_test_dirs(@@directories.values)
22
- TestHelper.cwd
23
- end
24
-
25
- def teardown
26
- TestHelper.clean
27
- end
28
-
29
- def test_episode_list_page_data_extraction
30
-
31
- VCR.use_cassette("wiki_#{method_name}") do
32
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
33
-
34
- data = wiki.get("Liste der Episoden von Bones – Die Knochenjägerin")
35
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
36
-
37
- assert_equal("Die Frau im Teich", seasons[1][1])
38
- assert_equal("Ein Verräter im Feuer", seasons[2][11])
39
- assert_equal("Vom Vergehen und Werden", seasons[6][23])
40
-
41
- data = wiki.get("Liste der Criminal-Minds-Episoden")
42
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
43
-
44
- assert_equal("Der Abgrund", seasons[1][1])
45
- assert_equal("Rivalen", seasons[2][9])
46
- assert_equal("Valhalla", seasons[6][17])
47
-
48
- data = wiki.get("Liste der Dexter-Episoden")
49
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
50
-
51
- assert_equal("Rot wie Blut", seasons[1][10])
52
- assert_equal("Hitzewelle", seasons[2][4])
53
- assert_equal("Familienväter", seasons[4][6])
54
-
55
- data = wiki.get("Liste der Simpsons-Episoden")
56
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data, true)
57
-
58
- assert_equal("Es weihnachtet schwer", seasons[1][1])
59
- assert_equal("Bösartige Spiele", seasons[4][5])
60
- assert_equal("Homer an der Uni", seasons[5][3])
61
- assert_equal("Hochzeit auf Indisch", seasons[9][7])
62
- assert_equal("G.I. Homer", seasons[18][5])
63
- assert_equal("Die Farbe Gelb", seasons[21][13])
64
-
65
- data = wiki.get("Liste der Misfits-Episoden")
66
- seasons = Plugin::Wikipedia.parse_episodelist_page_data(data)
67
-
68
- assert_equal("Das Gewitter", seasons[1][1])
69
- assert_equal("Nathan wird Vater", seasons[2][7])
70
- end
71
- end
72
-
73
- # def test_inpage_episode_list_page_data_extraction
74
-
75
- # VCR.use_cassette("wiki_#{method_name}") do
76
- # wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
77
-
78
- # data = wiki.get("The Glades")
79
- # seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
80
-
81
- # assert_equal("Reptilien im Paradies", seasons[1][1])
82
- # assert_equal("Doppelgänger", seasons[1][6])
83
- # assert_equal("Unruhiges Blut", seasons[1][9])
84
-
85
- # data = wiki.get("Dr. Dani Santino – Spiel des Lebens")
86
- # seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
87
-
88
- # assert_equal("Touchdown", seasons[1][1])
89
- # assert_equal("Zickenkrieg", seasons[1][7])
90
-
91
- # # the following series have an old inarticle episodelist
92
- # data = wiki.get("Prison Break")
93
- # seasons = Plugin::Wikipedia.parse_inarticle_episodelist_page_data(data)
94
-
95
- # assert_equal("Der große Plan", seasons[1][1])
96
- # assert_equal("Seite 1213", seasons[2][5])
97
- # end
98
- # end
99
-
100
-
101
- def test_episode_information_generation
102
-
103
- VCR.use_cassette("wiki_#{method_name}") do
104
- two = Serienrenamer::Episode.new(@@files['two'])
105
- data = Plugin::Wikipedia.generate_episode_information(two)[0]
106
- two.add_episode_information(data, false) if data
107
- assert_equal("S09E07 - Das Tagebuch.avi", two.to_s)
108
-
109
- simp = Serienrenamer::Episode.new(@@files['simp'])
110
- data = Plugin::Wikipedia.generate_episode_information(simp)[0]
111
- simp.add_episode_information(data, false) if data
112
- assert_equal("S09E07 - Hochzeit auf Indisch.avi", simp.to_s)
113
-
114
- chuck = Serienrenamer::Episode.new(@@directories['chuck'])
115
- data = Plugin::Wikipedia.generate_episode_information(chuck)[0]
116
- chuck.add_episode_information(data, false) if data
117
- assert_equal("S01E01 - Pilot.avi", chuck.to_s)
118
-
119
- chuck2 = Serienrenamer::Episode.new(@@directories['chuck2'])
120
- data = Plugin::Wikipedia.generate_episode_information(chuck2)[0]
121
- chuck2.add_episode_information(data, false) if data
122
- assert_equal("S02E10 - Chuck gegen zehn Millionen.avi", chuck2.to_s)
123
-
124
- # should be refactored or mocked out
125
- # dani = Serienrenamer::Episode.new(@@files['dani'])
126
- # data = Plugin::Wikipedia.generate_episode_information(dani)[0]
127
- # dani.add_episode_information(data, false) if data
128
- # assert_equal("S01E04 - Gewohnheiten.avi", dani.to_s)
129
-
130
- sea = Serienrenamer::Episode.new(@@files['sea'])
131
- data = Plugin::Wikipedia.generate_episode_information(sea)[0]
132
- sea.add_episode_information(data, false) if data
133
- assert_equal("S05E11 - Der Morgen danach.avi", sea.to_s)
134
- end
135
- end
136
-
137
- def test_check_for_series_main_page
138
-
139
- VCR.use_cassette("wiki_#{method_name}") do
140
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
141
-
142
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones")))
143
- assert_equal(true, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones – Die Knochenjägerin")))
144
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Bones – Der Tod ist erst der Anfang")))
145
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck")))
146
- assert_equal(true, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck (Fernsehserie)")))
147
- assert_equal(false, Plugin::Wikipedia.is_series_main_page?(wiki.get("Chuck (Album)")))
148
- end
149
- end
150
-
151
- def test_check_for_disambiguation_page
152
-
153
- VCR.use_cassette("wiki_#{method_name}") do
154
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
155
-
156
- assert_equal(true, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Bones")))
157
- assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Bones – Die Knochenjägerin")))
158
- assert_equal(true, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck")))
159
- assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck (Fernsehserie)")))
160
- assert_equal(false, Plugin::Wikipedia.is_disambiguation_site?(wiki.get("Chuck (Album)")))
161
- end
162
-
163
- end
164
-
165
- def test_check_for_inarticle_episode_list
166
-
167
- VCR.use_cassette("wiki_#{method_name}") do
168
- wiki = MediaWiki::Gateway.new('http://de.wikipedia.org/w/api.php')
169
-
170
- assert_equal(false, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Bones")))
171
- assert_equal(true, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("The Glades")))
172
- assert_equal(false, Plugin::Wikipedia.contains_inarticle_episode_list?(wiki.get("Royal Pains")))
173
- end
174
-
175
- end
176
-
177
- end
@@ -1,98 +0,0 @@
1
- # encoding: UTF-8
2
- require File.dirname(__FILE__) + '/test_helper.rb'
3
-
4
- class TestPluginSerienjunkiesDe < Test::Unit::TestCase
5
- @@files = {
6
- 'flpo' => 'Flashpoint.S04E04.German.Dubbed.WEB-DL.XViD.avi',
7
- 'dani' => 'Dr.Dani.Santino.S01E04.German.Dubbed.WEB-DL.XViD.avi',
8
- 'two' => 'Two.and.a.half.Men.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
9
- 'simp' => 'Die.Simpsons.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
10
- 'sea' => 'tcpa-seapatrol_s05e11.avi',
11
- }
12
-
13
- @@directories = {
14
- 'chuck' => 'Chuck.S01E01.German.Dubbed.BLURAYRiP.WEB-DL',
15
- 'chuck2' => 'Chuck.S02E10.German.Dubbed.BLURAYRiP.WEB-DL',
16
- }
17
-
18
- def setup
19
- TestHelper.create_test_files(@@files.values)
20
- TestHelper.create_test_dirs(@@directories.values)
21
- TestHelper.cwd
22
- end
23
-
24
- def teardown
25
- TestHelper.clean
26
- end
27
-
28
- def test_seriespage_url_search
29
- VCR.use_cassette("sjunkie_de_#{method_name}") do
30
- plugin = Serienrenamer::Plugin::SerienjunkiesDe
31
-
32
- misfits = plugin.find_link_to_series_page("Misfits")
33
- assert_equal("http://serienjunkies.de/misfits/", misfits)
34
-
35
- thementalist = plugin.find_link_to_series_page("The Mentalist")
36
- assert_equal("http://serienjunkies.de/the-mentalist/", thementalist)
37
-
38
- ncis = plugin.find_link_to_series_page("NCIS")
39
- assert_equal("http://serienjunkies.de/ncis/", ncis)
40
-
41
- berger = plugin.find_link_to_series_page("The Hard Times Of RJ Berger")
42
- assert_equal(nil, berger)
43
- end
44
- end
45
-
46
- def test_parse_seriespage
47
-
48
- VCR.use_cassette("sjunkie_de_#{method_name}") do
49
- plugin = Serienrenamer::Plugin::SerienjunkiesDe
50
-
51
- seasons = plugin.parse_seriespage(
52
- "http://www.serienjunkies.de/royal-pains/")
53
- assert_match(/Auch.Reiche.sind.nur.Menschen/, seasons['S01E01'])
54
- assert_match(/Krank.vor.Liebe/, seasons['S02E02'])
55
-
56
- seasons = plugin.parse_seriespage(
57
- "http://www.serienjunkies.de/flashpoint/")
58
- assert_match(/Zu.viele.Verlierer/, seasons['S02E02'])
59
- assert_match(/Der.Aufstand/, seasons['S02E16'])
60
-
61
- seasons = plugin.parse_seriespage(
62
- "http://www.serienjunkies.de/necessary-roughness/")
63
- assert_match(/Touchdown/, seasons['S01E01'])
64
- assert_match(/Extremsport/, seasons['S01E06'])
65
-
66
- seasons = plugin.parse_seriespage("http://www.serienjunkies.de/Weeds/")
67
- assert_match(/Das.Geld.im.Pool/, seasons['S03E02'])
68
- assert_match(/Schlangennest/, seasons['S02E01'])
69
- end
70
- end
71
-
72
- def test_episode_information_generation
73
-
74
- VCR.use_cassette("sjunkie_de_#{method_name}") do
75
- plugin = Serienrenamer::Plugin::SerienjunkiesDe
76
-
77
- flpo = Serienrenamer::Episode.new(@@files['flpo'])
78
- data = plugin.generate_episode_information(flpo)[0]
79
- flpo.add_episode_information(data, true) if data
80
- assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
81
-
82
- two = Serienrenamer::Episode.new(@@files['two'])
83
- data = plugin.generate_episode_information(two)[0]
84
- two.add_episode_information(data, true) if data
85
- assert_equal("S09E07 - Das Tagebuch.avi", two.to_s)
86
-
87
- chuck = Serienrenamer::Episode.new(@@directories['chuck'])
88
- data = plugin.generate_episode_information(chuck)[0]
89
- chuck.add_episode_information(data, true) if data
90
- assert_equal("S01E01 - Pilot.avi", chuck.to_s)
91
-
92
- chuck2 = Serienrenamer::Episode.new(@@directories['chuck2'])
93
- data = plugin.generate_episode_information(chuck2)[0]
94
- chuck2.add_episode_information(data, true) if data
95
- assert_equal("S02E10 - Chuck gegen zehn Millionen.avi", chuck2.to_s)
96
- end
97
- end
98
- end