serienrenamer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -29,7 +29,7 @@ like "S01E01 - Episodename.avi"
29
29
 
30
30
  == INSTALL:
31
31
 
32
- * FIX (sudo gem install, anything else)
32
+ * sudo gem install serienrenamer
33
33
 
34
34
  == LICENSE:
35
35
 
data/bin/serienrenamer CHANGED
@@ -46,6 +46,12 @@ opts.on( "-a", "--[no-]all",
46
46
  options[:process_all_files] = opt
47
47
  end
48
48
 
49
+ opts.on( "-v", "--version",
50
+ "Prints the version number.") do |opt|
51
+ puts Serienrenamer::VERSION
52
+ exit(0)
53
+ end
54
+
49
55
  opts.separator("")
50
56
  opts.separator(" Arguments:")
51
57
  opts.separator(" DIR The path that includes the episodes")
@@ -22,7 +22,7 @@ module Plugin
22
22
  # a hash with all series and existing episodes, which can
23
23
  # be used by all future method calls
24
24
  #
25
- def self.generate_episode_information(episode)
25
+ def self.generate_episode_information(episode, debug=false)
26
26
 
27
27
  raise ArgumentError, "Serienrenamer::Episode instance needed" unless
28
28
  episode.is_a?(Serienrenamer::Episode)
@@ -66,6 +66,7 @@ module Plugin
66
66
  word_splitted = false
67
67
 
68
68
  while ! name_words.empty?
69
+ p name_words if debug
69
70
 
70
71
  pattern = name_words.join('.*')
71
72
  matched_episodes = matched_definitions.grep(/#{pattern}.*S\d+E\d+/i)
@@ -78,6 +79,10 @@ module Plugin
78
79
  next
79
80
  end
80
81
 
82
+ # if last word was splitted and does not match than break
83
+ # and return empty resultset
84
+ break if word_splitted
85
+
81
86
  name_words.delete_at(0)
82
87
  end
83
88
 
data/lib/serienrenamer.rb CHANGED
@@ -3,7 +3,7 @@ $:.unshift(File.dirname(__FILE__)) unless
3
3
 
4
4
 
5
5
  module Serienrenamer
6
- VERSION = '0.0.1'
6
+ VERSION = '0.0.2'
7
7
 
8
8
  require 'serienrenamer/episode.rb'
9
9
 
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "serienrenamer"
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Philipp Boehm"]
9
- s.date = "2012-03-03"
9
+ s.date = "2012-03-04"
10
10
  s.description = "Ruby Script that brings your series into an appropriate format\nlike \"S01E01 - Episodename.avi\""
11
11
  s.email = ["philipp@i77i.de"]
12
12
  s.executables = ["serienrenamer"]
13
- s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
13
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
14
14
  s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "bin/serienrenamer", "lib/plugin.rb", "lib/plugin/serienjunkies_de.rb", "lib/plugin/serienjunkies_feed.rb", "lib/plugin/textfile.rb", "lib/plugin/wikipedia.rb", "lib/serienrenamer.rb", "lib/serienrenamer/episode.rb", "script/console", "script/destroy", "script/generate", "serienrenamer.gemspec", "test/serienjunkies_feed_sample.xml", "test/test_episode.rb", "test/test_helper.rb", "test/test_plugin_serienjunkies_de.rb", "test/test_plugin_serienjunkies_feed.rb", "test/test_plugin_textfile.rb", "test/test_plugin_wikipedia.rb", ".gemtest"]
15
15
  s.homepage = "http://github.com/pboehm/serienrenamer"
16
16
  s.rdoc_options = ["--main", "README.rdoc"]
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.add_runtime_dependency(%q<highline>, [">= 1.6.11"])
31
31
  s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
32
32
  s.add_development_dependency(%q<newgem>, [">= 1.5.3"])
33
- s.add_development_dependency(%q<hoe>, ["~> 2.13"])
33
+ s.add_development_dependency(%q<hoe>, ["~> 2.15"])
34
34
  else
35
35
  s.add_dependency(%q<wlapi>, [">= 0.8.4"])
36
36
  s.add_dependency(%q<mediawiki-gateway>, [">= 0.4.4"])
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.add_dependency(%q<highline>, [">= 1.6.11"])
39
39
  s.add_dependency(%q<rdoc>, ["~> 3.10"])
40
40
  s.add_dependency(%q<newgem>, [">= 1.5.3"])
41
- s.add_dependency(%q<hoe>, ["~> 2.13"])
41
+ s.add_dependency(%q<hoe>, ["~> 2.15"])
42
42
  end
43
43
  else
44
44
  s.add_dependency(%q<wlapi>, [">= 0.8.4"])
@@ -47,6 +47,6 @@ Gem::Specification.new do |s|
47
47
  s.add_dependency(%q<highline>, [">= 1.6.11"])
48
48
  s.add_dependency(%q<rdoc>, ["~> 3.10"])
49
49
  s.add_dependency(%q<newgem>, [">= 1.5.3"])
50
- s.add_dependency(%q<hoe>, ["~> 2.13"])
50
+ s.add_dependency(%q<hoe>, ["~> 2.15"])
51
51
  end
52
52
  end
@@ -11,6 +11,8 @@ class TestPluginSerienjunkiesFeed < Test::Unit::TestCase
11
11
  'crmi' => 'test/testfiles/crmi-s06e22.avi',
12
12
  'two' => 'test/testfiles/Two.and.a.half.Men.S09E07.German.Dubbed.WS.WEB-DL.XviD-GDR.avi',
13
13
  'sea' => 'test/testfiles/tcpa-seapatrol_s05e11.avi',
14
+ 'shlock' => 'test/testfiles/Sherlock.s02e01.avi',
15
+ 'unit' => 'test/testfiles/The.Unit.s01e17.avi',
14
16
  }
15
17
 
16
18
  @@valid_directories = {
@@ -71,5 +73,14 @@ class TestPluginSerienjunkiesFeed < Test::Unit::TestCase
71
73
  csiny.add_episode_information(data, true)
72
74
  assert_equal("S07E21 - Kugelhagel.avi", csiny.to_s)
73
75
 
76
+ # the following episodes are not exisiting in the feed
77
+ # so it should returns nil
78
+ sherlock = Serienrenamer::Episode.new(@@valid_filenames['shlock'])
79
+ data = feed.generate_episode_information(sherlock)[0]
80
+ assert_nil(data)
81
+
82
+ theunit = Serienrenamer::Episode.new(@@valid_filenames['unit'])
83
+ data = feed.generate_episode_information(theunit)[0]
84
+ assert_nil(data)
74
85
  end
75
86
  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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-03 00:00:00.000000000 Z
12
+ date: 2012-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: wlapi
16
- requirement: &19580700 !ruby/object:Gem::Requirement
16
+ requirement: &11633260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19580700
24
+ version_requirements: *11633260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mediawiki-gateway
27
- requirement: &19579380 !ruby/object:Gem::Requirement
27
+ requirement: &11631640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.4.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *19579380
35
+ version_requirements: *11631640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: mechanize
38
- requirement: &19578480 !ruby/object:Gem::Requirement
38
+ requirement: &11629400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *19578480
46
+ version_requirements: *11629400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: highline
49
- requirement: &19577060 !ruby/object:Gem::Requirement
49
+ requirement: &11627260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.6.11
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *19577060
57
+ version_requirements: *11627260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdoc
60
- requirement: &19576180 !ruby/object:Gem::Requirement
60
+ requirement: &11641960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.10'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *19576180
68
+ version_requirements: *11641960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: newgem
71
- requirement: &19574640 !ruby/object:Gem::Requirement
71
+ requirement: &11639680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.5.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *19574640
79
+ version_requirements: *11639680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: hoe
82
- requirement: &19594920 !ruby/object:Gem::Requirement
82
+ requirement: &11637160 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '2.15'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *19594920
90
+ version_requirements: *11637160
91
91
  description: ! 'Ruby Script that brings your series into an appropriate format
92
92
 
93
93
  like "S01E01 - Episodename.avi"'