serienrenamer 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dfe4fac376fd628f3ef0386f8b8c30be02eb607
4
- data.tar.gz: af35a66b3a25cdc58a13206354f6a9e699394dca
3
+ metadata.gz: c8c2998eec46e3c7d62d5942cf5a233f67b5d72c
4
+ data.tar.gz: ecf65a918b00e68c6fef74ecc84dca474ad0c8d9
5
5
  SHA512:
6
- metadata.gz: 84e6d595fd4764a3a578c91401963af663a5acbc99b67a7971ac36cb9f64432febc546645bb092ab24e728d862dd067f852bb46d7ca2a647912d0280b76887f8
7
- data.tar.gz: e3006748bd8e956efd573845afc59ab9f6e193efb725904a716d30ca80f91afaee5971d0484330458fa35cd9e2b11751982711c9751d4b70b9e36ccf3ef5b2f1
6
+ metadata.gz: eb3c908ca725711d79f26d67d7c0a5be7de2f761ffab52a3c72bd1ea816f2ed98635e0bc4a4c0e781f7f1adcb9b6e30a21f42a61a6779463ad8d8c7897e8c519
7
+ data.tar.gz: 6351bc6d4cedd5a8d25e4263bdbc3135c4b8f9bf45ba0c0532da1d294180a37999315593050ea42c8cd013650dcec1ad07705f5291e4545438d0bb54189b7852
data/.gitignore CHANGED
@@ -6,7 +6,6 @@ test/testfiles/
6
6
  .bundle
7
7
  .config
8
8
  .yardoc
9
- Gemfile.lock
10
9
  InstalledFiles
11
10
  _yardoc
12
11
  coverage
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
-
4
+ - 2.0.0
5
+ - 2.1.0
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem "vcr"
3
+ gem "vcr", "~> 2.4"
4
4
  gem "fakeweb"
5
5
  gem "rake"
6
6
 
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ serienrenamer (0.2.0)
5
+ hashconfig (>= 0.0.1)
6
+ highline (>= 1.6.11)
7
+ wlapi (>= 0.8.5)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ akami (1.2.1)
13
+ gyoku (>= 0.4.0)
14
+ nokogiri
15
+ builder (3.2.2)
16
+ fakeweb (1.3.0)
17
+ gyoku (1.1.1)
18
+ builder (>= 2.1.2)
19
+ hash-deep-merge (0.1.1)
20
+ hashconfig (0.0.2)
21
+ hash-deep-merge
22
+ highline (1.6.21)
23
+ httpi (2.1.0)
24
+ rack
25
+ rubyntlm (~> 0.3.2)
26
+ mime-types (1.25.1)
27
+ mini_portile (0.5.2)
28
+ nokogiri (1.6.1)
29
+ mini_portile (~> 0.5.0)
30
+ nori (2.3.0)
31
+ rack (1.5.2)
32
+ rake (10.1.1)
33
+ rubyntlm (0.3.4)
34
+ savon (2.3.3)
35
+ akami (~> 1.2.0)
36
+ builder (>= 2.1.2)
37
+ gyoku (~> 1.1.0)
38
+ httpi (~> 2.1.0)
39
+ nokogiri (>= 1.4.0)
40
+ nori (~> 2.3.0)
41
+ wasabi (~> 3.2.2)
42
+ vcr (2.8.0)
43
+ wasabi (3.2.3)
44
+ httpi (~> 2.0)
45
+ mime-types (< 2.0.0)
46
+ nokogiri (>= 1.4.0)
47
+ wlapi (0.8.5)
48
+ savon (~> 2.1)
49
+
50
+ PLATFORMS
51
+ ruby
52
+
53
+ DEPENDENCIES
54
+ fakeweb
55
+ rake
56
+ serienrenamer!
57
+ vcr (~> 2.4)
data/README.rdoc CHANGED
@@ -13,9 +13,6 @@ like "S01E01 - Episodename.avi"
13
13
  * clean these information and bring that into a recommended format
14
14
  * search for information in specific textfiles like "filename.txt"
15
15
  * query the seriejunkies.org-feed for episode information
16
- * query the serienjunkies.org Page for series specific data
17
- * query the serienjunkies.de Page for series specific data
18
- * query wikipedia for episode information
19
16
  * contains a plugin that creates an episodename out of the episode identifier
20
17
  * repair broken german umlauts if the occur in the episode title
21
18
  * rename these files
@@ -23,11 +20,8 @@ like "S01E01 - Episodename.avi"
23
20
  == REQUIREMENTS:
24
21
 
25
22
  * ruby (>= 1.9)
26
- * wlapi
27
- * mediawiki_gateway
28
23
  * highline
29
24
  * nokogiri
30
- * mechanize
31
25
  * hashconfig
32
26
 
33
27
  == INSTALL:
@@ -43,20 +37,22 @@ it should be quick.
43
37
 
44
38
  == LICENSE:
45
39
 
46
- (General Public License)
47
-
48
- Copyright (c) 2012 Philipp Böhm
49
-
50
- This program is free software; you can redistribute it and/or modify
51
- it under the terms of the GNU General Public License as published by
52
- the Free Software Foundation in version 3 of the License.
53
-
54
- This program is distributed in the hope that it will be useful,
55
- but WITHOUT ANY WARRANTY; without even the implied warranty of
56
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57
- GNU General Public License for more details.
58
-
59
- You should have received a copy of the GNU General Public License
60
- along with this program; if not, write to the Free Software
61
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
62
- MA 02110-1301, USA.
40
+ Copyright (C) 2014 Philipp Böhm
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining
43
+ a copy of this software and associated documentation files (the "Software"),
44
+ to deal in the Software without restriction, including without limitation
45
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
46
+ and/or sell copies of the Software, and to permit persons to whom the
47
+ Software is furnished to do so, subject to the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be included
50
+ in all copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
53
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
54
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
55
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
56
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
57
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
58
+ OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/serienrenamer CHANGED
@@ -146,7 +146,7 @@ begin
146
146
  # if episodename is empty than query plugins
147
147
  if epi.episodename.match(/\w+/).nil? || options[:ignore_filenamedata]
148
148
 
149
- registered_plugins.each do |plugin|
149
+ registered_plugins.select {|p| p.type == :information}.each do |plugin|
150
150
 
151
151
  # configure cleanup
152
152
  clean_data, extract_seriesname = false, false
@@ -177,6 +177,12 @@ begin
177
177
  end
178
178
  end
179
179
 
180
+ # filter episode name
181
+ registered_plugins.select {|p| p.type == :filter}.each do |plugin|
182
+ epi.episodename = plugin.filter(epi.episodename)
183
+ end
184
+
185
+ # rename episode when the user confirms
180
186
  puts ">>> #{epi.to_s}"
181
187
 
182
188
  if not config[:force_rename]
@@ -1,20 +1,14 @@
1
1
  # coding: UTF-8
2
2
  require 'find'
3
3
  require 'fileutils'
4
- require 'wlapi'
5
4
  require 'digest/md5'
6
5
 
7
- # suppress debug messages from wlapi which uses Savon
8
- HTTPI.log = false
9
-
10
-
11
6
  module Serienrenamer
12
-
13
7
  class Episode
14
8
 
15
- attr_reader :season, :episode, :episodename,
9
+ attr_reader :season, :episode,
16
10
  :extension, :episodepath, :success, :source_directory
17
- attr_accessor :episodename_needed, :series
11
+ attr_accessor :episodename, :episodename_needed, :series
18
12
 
19
13
  # patterns for suitable episodes
20
14
  @@PATTERNS = [
@@ -196,10 +190,7 @@ module Serienrenamer
196
190
  # :include_trashwords
197
191
  # remove Words like German or Dubbed from
198
192
  # the string (Trashwords)
199
- # :repair_umlauts
200
- # try to repair broken umlauts if they occur
201
- #
202
- def self.clean_episode_data(data, include_trashwords=false, repair_umlauts=false)
193
+ def self.clean_episode_data(data, include_trashwords=false, *args)
203
194
  data.gsub!(/\./, " ")
204
195
  data.gsub!(/\_/, " ")
205
196
  data.gsub!(/\-/, " ")
@@ -217,8 +208,6 @@ module Serienrenamer
217
208
  for word in data.split(/ /) do
218
209
  next unless word.match(/\w+/)
219
210
 
220
- word = repair_umlauts(word) if repair_umlauts
221
-
222
211
  # if word is in TRASH_WORDS
223
212
  if ! @@TRASH_WORDS.grep(/^#{word}$/i).empty?
224
213
  purge_count += 1
@@ -239,51 +228,6 @@ module Serienrenamer
239
228
  return data
240
229
  end
241
230
 
242
- # This method tries to repair some german umlauts so that
243
- # the following occurs
244
- #
245
- # ae => ä ; ue => ü ; oe => ö ; Ae => Ä ; Ue => Ü ; Oe => Ö
246
- #
247
- # This method uses a webservice at:
248
- # http://wortschatz.uni-leipzig.de/
249
- # which produces statistics about the german language and
250
- # e.g. frequency of words occuring in the german language
251
- #
252
- # this method convert all broken umlauts in the word and compares
253
- # the frequency of both version and uses the version which is more
254
- # common
255
- #
256
- # returns an repaired version of the word if necessary
257
- def self.repair_umlauts(word)
258
-
259
- if contains_eventual_broken_umlauts?(word)
260
-
261
- repaired = word.gsub(/ae/, 'ä').gsub(/ue/, 'ü').gsub(/oe/, 'ö')
262
- repaired.gsub!(/^Ae/, 'Ä')
263
- repaired.gsub!(/^Ue/, 'Ü')
264
- repaired.gsub!(/^Oe/, 'Ö')
265
-
266
- ws = WLAPI::API.new
267
-
268
- res_broken = ws.frequencies(word)
269
- freq_broken = res_broken.nil? ? -1 : res_broken[0].to_i
270
-
271
- res_repaired = ws.frequencies(repaired)
272
- freq_repaired = res_repaired.nil? ? -1 : res_repaired[0].to_i
273
-
274
- if freq_repaired > freq_broken
275
- return repaired
276
- end
277
- end
278
- return word
279
- end
280
-
281
- # checks for eventual broken umlauts
282
- #
283
- # returns true if broken umlaut if included
284
- def self.contains_eventual_broken_umlauts?(string)
285
- ! string.match(/ae|ue|oe|Ae|Ue|Oe/).nil?
286
- end
287
231
 
288
232
  # tries to match the given string against
289
233
  # all supported regex-patterns and returns true if a
@@ -13,6 +13,7 @@ module Serienrenamer
13
13
  end
14
14
 
15
15
  def self.plugin_name; "PluginBase" end
16
+ def self.type; :information end # or :filter
16
17
 
17
18
  def self.to_s
18
19
  self.plugin_name
@@ -0,0 +1,70 @@
1
+ # encoding: utf-8
2
+ require 'wlapi'
3
+
4
+ module Serienrenamer
5
+ module Plugin
6
+
7
+ class Umlauts < Serienrenamer::Pluginbase
8
+
9
+ def self.plugin_name; "Umlauts" end
10
+ def self.usable; true end
11
+ def self.priority; 150 end
12
+ def self.type; :filter end
13
+
14
+ # This method is called from outside with the full episodename as
15
+ # parameter and it should return the manipulated episodename
16
+ def self.filter(episode_name)
17
+ episode_name.split.map {|e| repair_umlauts(e) }.join(" ")
18
+ end
19
+
20
+
21
+ # This method tries to repair some german umlauts so that
22
+ # the following occurs
23
+ #
24
+ # ae => ä ; ue => ü ; oe => ö ; Ae => Ä ; Ue => Ü ; Oe => Ö
25
+ #
26
+ # This method uses a webservice at:
27
+ # http://wortschatz.uni-leipzig.de/
28
+ # which produces statistics about the german language and
29
+ # e.g. frequency of words occuring in the german language
30
+ #
31
+ # this method convert all broken umlauts in the word and compares
32
+ # the frequency of both version and uses the version which is more
33
+ # common
34
+ #
35
+ # returns a repaired version of the word if necessary
36
+ def self.repair_umlauts(word)
37
+
38
+ if contains_eventual_broken_umlauts?(word)
39
+ @@client ||= WLAPI::API.new
40
+
41
+ repaired = word.gsub(/ae/, 'ä').gsub(/ue/, 'ü').gsub(/oe/, 'ö')
42
+ repaired.gsub!(/^Ae/, 'Ä')
43
+ repaired.gsub!(/^Ue/, 'Ü')
44
+ repaired.gsub!(/^Oe/, 'Ö')
45
+
46
+ res_broken = @@client.frequencies(word)
47
+ freq_broken = res_broken.nil? ? -1 : res_broken[0].to_i
48
+
49
+ res_repaired = @@client.frequencies(repaired)
50
+ freq_repaired = res_repaired.nil? ? -1 : res_repaired[0].to_i
51
+
52
+ if freq_repaired > freq_broken
53
+ return repaired
54
+ end
55
+ end
56
+
57
+ word
58
+ end
59
+
60
+ # checks for eventual broken umlauts
61
+ #
62
+ # returns true if broken umlaut if included
63
+ def self.contains_eventual_broken_umlauts?(string)
64
+ ! string.match(/ae|ue|oe|Ae|Ue|Oe/).nil?
65
+ end
66
+
67
+ end
68
+ end
69
+ end
70
+
@@ -1,3 +1,3 @@
1
1
  module Serienrenamer
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -3,7 +3,7 @@ require File.expand_path('../lib/serienrenamer/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.authors = ["Philipp Böhm"]
6
- gem.email = ["philipp@i77i.de"]
6
+ gem.email = ["dev@pboehm.org"]
7
7
  gem.description = %q{Ruby Script that brings your series into an appropriate format like \"S01E01 - Episodename.avi\"}
8
8
  gem.summary = %q{Ruby Script that brings your series into an appropriate format like \"S01E01 - Episodename.avi\"}
9
9
  gem.homepage = "http://github.com/pboehm/serienrenamer"
@@ -17,8 +17,6 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.required_ruby_version = '>= 1.9.0'
19
19
  gem.add_runtime_dependency(%q<wlapi>, [">= 0.8.5"])
20
- gem.add_runtime_dependency(%q<mediawiki-gateway>, [">= 0.4.4"])
21
- gem.add_runtime_dependency(%q<mechanize>, [">= 2.3"])
22
20
  gem.add_runtime_dependency(%q<highline>, [">= 1.6.11"])
23
21
  gem.add_runtime_dependency(%q<hashconfig>, [">= 0.0.1"])
24
22
  end
data/test/test_episode.rb CHANGED
@@ -64,111 +64,65 @@ class TestEpisode < Test::Unit::TestCase
64
64
  end
65
65
 
66
66
  def test_information_cleanup
67
- VCR.use_cassette("episode_#{method_name}") do
68
- assert_equal("Im sicheren Hafen",
69
- Serienrenamer::Episode.clean_episode_data(
70
- ".Im.sicheren.Hafen.GERMAN.DUBBED.DL.720p.HDTV.x264-euHD",
71
- true, true)
72
- )
73
- end
74
- end
75
-
76
- def test_repairing_umlauts
77
- VCR.use_cassette("episode_#{method_name}") do
78
- assert_equal("Duell",
79
- Serienrenamer::Episode.repair_umlauts("Duell"))
80
- assert_equal("für",
81
- Serienrenamer::Episode.repair_umlauts("fuer"))
82
- assert_equal("Änderung",
83
- Serienrenamer::Episode.repair_umlauts("Aenderung"))
84
- assert_equal("Zaubersprüche",
85
- Serienrenamer::Episode.repair_umlauts("Zaubersprueche"))
86
- assert_equal("Ungeheuerlich",
87
- Serienrenamer::Episode.repair_umlauts("Ungeheuerlich"))
88
- assert_equal("Frauen",
89
- Serienrenamer::Episode.repair_umlauts("Frauen"))
90
- assert_equal("Abführmittel",
91
- Serienrenamer::Episode.repair_umlauts("Abfuehrmittel"))
92
- assert_equal("tödlich",
93
- Serienrenamer::Episode.repair_umlauts("toedlich"))
94
- assert_equal("König",
95
- Serienrenamer::Episode.repair_umlauts("Koenig"))
96
- assert_equal("Öko",
97
- Serienrenamer::Episode.repair_umlauts("Oeko"))
98
- assert_equal("Männer",
99
- Serienrenamer::Episode.repair_umlauts("Maenner"))
100
- assert_equal("Draufgänger",
101
- Serienrenamer::Episode.repair_umlauts("Draufgaenger"))
102
- assert_equal("Unglücksvögel",
103
- Serienrenamer::Episode.repair_umlauts("Ungluecksvoegel"))
104
- assert_equal("Jäger",
105
- Serienrenamer::Episode.repair_umlauts("Jaeger"))
106
- assert_equal("Loyalität",
107
- Serienrenamer::Episode.repair_umlauts("Loyalitaet"))
108
- # both forms not existing
109
- assert_equal("Moeback",
110
- Serienrenamer::Episode.repair_umlauts("Moeback"))
111
- end
67
+ assert_equal("Im sicheren Hafen",
68
+ Serienrenamer::Episode.clean_episode_data(
69
+ ".Im.sicheren.Hafen.GERMAN.DUBBED.DL.720p.HDTV.x264-euHD",
70
+ true, true)
71
+ )
112
72
  end
113
73
 
114
74
  def test_episode_information_extraction_from_file
115
75
 
116
- VCR.use_cassette("episode_#{method_name}") do
117
- assert_raise(ArgumentError) { Serienrenamer::Episode.new('video.flv')}
76
+ assert_raise(ArgumentError) { Serienrenamer::Episode.new('video.flv')}
118
77
 
119
- epi = Serienrenamer::Episode.new(@@files["chuckfull"])
120
- assert_equal('Chuck',epi.series)
121
- assert_equal(1, epi.season)
122
- assert_equal(1, epi.episode)
123
- assert_equal("Dies ist ein Test", epi.episodename)
124
- assert_equal("S01E01 - Dies ist ein Test.avi", epi.to_s)
78
+ epi = Serienrenamer::Episode.new(@@files["chuckfull"])
79
+ assert_equal('Chuck',epi.series)
80
+ assert_equal(1, epi.season)
81
+ assert_equal(1, epi.episode)
82
+ assert_equal("Dies ist ein Test", epi.episodename)
83
+ assert_equal("S01E01 - Dies ist ein Test.avi", epi.to_s)
125
84
 
126
- flpo = Serienrenamer::Episode.new(@@files["flpo"])
127
- assert_equal("S04E04 - Getrübte Erinnerungen.avi", flpo.to_s)
85
+ flpo = Serienrenamer::Episode.new(@@files["flpo"])
86
+ assert_equal("S04E04 - Getruebte Erinnerungen.avi", flpo.to_s)
128
87
 
129
- csiny = Serienrenamer::Episode.new(@@files["csiny"])
130
- csiny.episodename_needed=false
131
- assert_equal("S07E20.avi", csiny.to_s)
88
+ csiny = Serienrenamer::Episode.new(@@files["csiny"])
89
+ csiny.episodename_needed=false
90
+ assert_equal("S07E20.avi", csiny.to_s)
132
91
 
133
- legaltrash = Serienrenamer::Episode.new(@@files["legaltrash"])
134
- assert_equal("S04E04 - Die German Erinnerungen.avi", legaltrash.to_s)
92
+ legaltrash = Serienrenamer::Episode.new(@@files["legaltrash"])
93
+ assert_equal("S04E04 - Die German Erinnerungen.avi", legaltrash.to_s)
135
94
 
136
- royal = Serienrenamer::Episode.new(@@files["royal"])
137
- assert_equal("S02E10 - Beziehungsbeschwerden.avi", royal.to_s)
138
- end
95
+ royal = Serienrenamer::Episode.new(@@files["royal"])
96
+ assert_equal("S02E10 - Beziehungsbeschwerden.avi", royal.to_s)
139
97
  end
140
98
 
141
99
  def test_episode_information_extraction_from_directory
142
100
 
143
- VCR.use_cassette("episode_#{method_name}") do
144
- chuck = Serienrenamer::Episode.new(@@directories["chuck"])
145
- assert_equal("S01E01 - Testepisode.avi", chuck.to_s)
101
+ chuck = Serienrenamer::Episode.new(@@directories["chuck"])
102
+ assert_equal("S01E01 - Testepisode.avi", chuck.to_s)
146
103
 
147
- chuck1 = Serienrenamer::Episode.new(@@directories["chuck1"])
148
- assert_equal("S01E01 - First Episode.avi", chuck1.to_s)
104
+ chuck1 = Serienrenamer::Episode.new(@@directories["chuck1"])
105
+ assert_equal("S01E01 - First Episode.avi", chuck1.to_s)
149
106
 
150
- ncis = Serienrenamer::Episode.new(@@directories["ncis"])
151
- assert_equal("S09E05 - Im sicheren Hafen.avi", ncis.to_s)
107
+ ncis = Serienrenamer::Episode.new(@@directories["ncis"])
108
+ assert_equal("S09E05 - Im sicheren Hafen.avi", ncis.to_s)
152
109
 
153
- chuck2 = Serienrenamer::Episode.new(@@directories["chuck2"])
154
- chuck2.episodename_needed=false
155
- assert_equal("S02E12.avi", chuck2.to_s)
156
- end
110
+ chuck2 = Serienrenamer::Episode.new(@@directories["chuck2"])
111
+ chuck2.episodename_needed=false
112
+ assert_equal("S02E12.avi", chuck2.to_s)
157
113
  end
158
114
 
159
115
  def test_adding_episodename_afterwards
160
116
 
161
- VCR.use_cassette("episode_#{method_name}") do
162
- csiny = Serienrenamer::Episode.new(@@files["csiny"])
163
- csiny.add_episode_information('Dies ist nachträglich eingefügt', false)
164
- assert_equal("S07E20 - Dies ist nachträglich eingefügt.avi", csiny.to_s)
117
+ csiny = Serienrenamer::Episode.new(@@files["csiny"])
118
+ csiny.add_episode_information('Dies ist nachträglich eingefügt', false)
119
+ assert_equal("S07E20 - Dies ist nachträglich eingefügt.avi", csiny.to_s)
165
120
 
166
- chuck = Serienrenamer::Episode.new(@@directories["chuck"])
167
- chuck.add_episode_information(
168
- 'Chuck.S01E01.First.Episode.GERMAN.DUBBED.DL.720p.HDTV.x264-euHD',
169
- true)
170
- assert_equal("S01E01 - First Episode.avi", chuck.to_s)
171
- end
121
+ chuck = Serienrenamer::Episode.new(@@directories["chuck"])
122
+ chuck.add_episode_information(
123
+ 'Chuck.S01E01.First.Episode.GERMAN.DUBBED.DL.720p.HDTV.x264-euHD',
124
+ true)
125
+ assert_equal("S01E01 - First Episode.avi", chuck.to_s)
172
126
  end
173
127
 
174
128
  def test_videofile_determination
@@ -182,55 +136,47 @@ class TestEpisode < Test::Unit::TestCase
182
136
  end
183
137
 
184
138
  def test_episode_rename_file
185
- VCR.use_cassette("episode_#{method_name}") do
186
- epi = Serienrenamer::Episode.new(@@files["chuckfull"])
187
- epi.rename
188
- assert_equal(true, epi.success)
189
- end
139
+ epi = Serienrenamer::Episode.new(@@files["chuckfull"])
140
+ epi.rename
141
+ assert_equal(true, epi.success)
190
142
  end
191
143
 
192
144
  def test_episode_rename_from_directory
193
- VCR.use_cassette("episode_#{method_name}") do
194
- @@directories.each do |n,d|
195
- epi = Serienrenamer::Episode.new(d)
196
- epi.rename
197
- assert_equal(true, epi.success)
198
- end
145
+ @@directories.each do |n,d|
146
+ epi = Serienrenamer::Episode.new(d)
147
+ epi.rename
148
+ assert_equal(true, epi.success)
199
149
  end
200
150
  end
201
151
 
202
152
  def test_episode_where_dir_has_not_enough_info
203
- VCR.use_cassette("episode_#{method_name}") do
204
- d = @@invalid_directories["tbbt"]
153
+ d = @@invalid_directories["tbbt"]
205
154
 
206
- filenametxt = File.new(File.join(d, "filename.txt"), "w")
207
- filenametxt.write(
208
- "The.Big.Bang.Theory.S05E16.Sheldon.Revival.HDTV.XviD-LOL")
209
- filenametxt.close
155
+ filenametxt = File.new(File.join(d, "filename.txt"), "w")
156
+ filenametxt.write(
157
+ "The.Big.Bang.Theory.S05E16.Sheldon.Revival.HDTV.XviD-LOL")
158
+ filenametxt.close
210
159
 
211
- tbbt = Serienrenamer::Episode.new(d)
212
- assert_equal("S05E16 - Sheldon Revival.avi", tbbt.to_s)
160
+ tbbt = Serienrenamer::Episode.new(d)
161
+ assert_equal("S05E16 - Sheldon Revival.avi", tbbt.to_s)
213
162
 
214
- tbbt.rename
215
- assert_equal(true, tbbt.success)
216
- end
163
+ tbbt.rename
164
+ assert_equal(true, tbbt.success)
217
165
  end
218
166
 
219
167
  def test_generate_episode_hash
220
- VCR.use_cassette("episode_#{method_name}") do
221
- chuck = Serienrenamer::Episode.new(@@directories["chuck"])
168
+ chuck = Serienrenamer::Episode.new(@@directories["chuck"])
222
169
 
223
- videofile = File.new(chuck.episodepath, "w")
224
- videofile.write("Chuck.S01E01.Testepisode.German.Dubbed.BLURAYRiP")
225
- videofile.close
170
+ videofile = File.new(chuck.episodepath, "w")
171
+ videofile.write("Chuck.S01E01.Testepisode.German.Dubbed.BLURAYRiP")
172
+ videofile.close
226
173
 
227
- assert_equal("d538bf7632bd3b14601015fbc3a39f60", chuck.md5sum)
228
- chuck.rename
229
- assert_equal("d538bf7632bd3b14601015fbc3a39f60", chuck.md5sum)
174
+ assert_equal("d538bf7632bd3b14601015fbc3a39f60", chuck.md5sum)
175
+ chuck.rename
176
+ assert_equal("d538bf7632bd3b14601015fbc3a39f60", chuck.md5sum)
230
177
 
231
- # explicit bytecount
232
- assert_equal("78193bb6ffe829b49981b494ab243a82", chuck.md5sum(5))
233
- assert_equal("0f2788bb1324330898fffddcafd2b8e1", chuck.md5sum(12))
234
- end
178
+ # explicit bytecount
179
+ assert_equal("78193bb6ffe829b49981b494ab243a82", chuck.md5sum(5))
180
+ assert_equal("0f2788bb1324330898fffddcafd2b8e1", chuck.md5sum(12))
235
181
  end
236
182
  end