movie-renamer 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -8,14 +8,14 @@ uses imdb gem to query imdb about current movie trying to obtain useful infos
8
8
 
9
9
  to see the usage type
10
10
 
11
- $ movie-renamer -h
12
- Usage: movie-renamer [-i|-s|-f|-h|-p] <folder>
13
- Default behavior is -f on current working directory
14
- -h, --help Display this help
15
- -i, --imdb Executes a query on imdb on <movie name>
16
- -s, --singlemovie FILE Acts on a single movie file <file name>
17
- -f, --folder FOLDER Acts on whole folder <folder>
18
- -p, --path PATH path for moving renamed movies default is tmp/ in current working directory
11
+ $ movie-renamer -h
12
+ Usage: movie-renamer [-i|-s|-f|-h|-p] <folder>
13
+ Default behavior is -f on current working directory
14
+ -h, --help Display this help
15
+ -i, --imdb Executes a query on imdb on <movie name>
16
+ -s, --singlemovie FILE Acts on a single movie file <file name>
17
+ -f, --folder FOLDER Acts on whole folder <folder>
18
+ -p, --path PATH path for moving renamed movies default is tmp/ in current working directory
19
19
 
20
20
 
21
21
  == How it works
@@ -35,10 +35,10 @@ By default Movies are renamed like this:
35
35
 
36
36
  You can set the rename pattern creating a .movie-renamer file in your home
37
37
 
38
- example:
38
+ example:
39
39
  filename: ($year) - $title - $director
40
40
 
41
- === Multilanguage support
41
+ === Multilangual support
42
42
  Optionally a language for the search can be set in .movie-renamer file
43
43
  language: it
44
44
 
@@ -49,6 +49,13 @@ In this case search will return the complete title but then just the title in th
49
49
 
50
50
  Please NOTE that multilanguage support REQUIRES an UTF-8 enabled terminal to work correctly
51
51
 
52
+ === Change default savepath
53
+ savepath: /home/ghedamat/movies
54
+
55
+ Setting this variable you can change the default savepath to save in the same path all the renamed movies.
56
+ The behavior is the same as with -p option.
57
+
58
+
52
59
  == Notes on install
53
60
  movie-renamer requires ruby1.9 to work correctly
54
61
  gem dependencies also includes
data/lib/movie-renamer.rb CHANGED
@@ -69,8 +69,9 @@ module MovieRenamer
69
69
 
70
70
  if $config['savepath']
71
71
  @newpath = File.expand_path($config['savepath'])
72
- puts @newpath
73
72
  end
73
+
74
+ puts "Renamed movies will be saved in #{@newpath}"
74
75
 
75
76
  class Movie
76
77
 
@@ -140,6 +141,10 @@ module MovieRenamer
140
141
  return Movie.new(filename,:title => title)
141
142
  end
142
143
 
144
+ def MovieRenamer::parseMovie(filename)
145
+
146
+ Movie.new(filename)
147
+ end
143
148
  # attempt to remove the divx part from a filename
144
149
  def MovieRenamer::titleExtract(filename)
145
150
  r1 = %r{\s*\[?\(?\s*[dD](i|I)(v|V)(x|X)\s?(-|_)?\s?\w+\s*\)?\]?\s*}
@@ -326,7 +331,8 @@ module MovieRenamer
326
331
  s = Imdb::Search.new(movie.title)
327
332
  s.movies[0..4].each_with_index do |m,i|
328
333
  m.title = coder.decode(m.title)#.encode("iso-8859-1")
329
- @output.puts "#{i}, #{m.year} - #{m.director.to_s.gsub(/(\[")|("\])/,'')} - #{m.title.gsub(/ .*/,'')}"
334
+ out = "#{i}, #{m.year} - #{m.director.to_s.gsub(/(\[")|("\])/,'')} - #{m.title.gsub(/ .*/,'')}"
335
+ say(HighLine.new.color(out, :green))
330
336
  end
331
337
  mt = s.movies[0..4]
332
338
  cmd = ask("pick a choice [0..#{(mt.length) -1 }], Manual search, Edit manually, Skip Movie, Quit", ((0...mt.length).to_a.map{ |e| e.to_s} << %w{m e s q}).flatten)
@@ -1,6 +1,7 @@
1
1
  require 'helper'
2
2
  require File.join(File.dirname(__FILE__),'..', 'lib','movie-renamer')
3
3
  require 'stringio'
4
+ require 'mocha'
4
5
 
5
6
  class TestMovieRenamer < Test::Unit::TestCase
6
7
 
@@ -98,7 +99,11 @@ class TestMovieRenamer < Test::Unit::TestCase
98
99
  assert_equal "ain't a very bad movie son", MovieRenamer::sanitizeInput(input)
99
100
  end
100
101
 
101
-
102
+ must "parse a movie title" do
103
+ input = "2010: Odissea Nello Spazio - Stanley Kubrick - 1964.avi"
104
+ mov = MovieRenamer::Movie.new("test.avi",:title =>"2001: Odissea Nello Spazio",:director=>"Stanley Kubrick",:year=>1964)
105
+ assert_equal mov, MovieRenamer::parseMovie(input)
106
+ end
102
107
 
103
108
  =begin
104
109
  # test main loop over folder
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movie-renamer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 19
10
- version: 0.0.19
9
+ - 20
10
+ version: 0.0.20
11
11
  platform: ruby
12
12
  authors:
13
13
  - ghedamat