movie-renamer 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ to see the usage type
10
10
 
11
11
  $ movie-renamer -h
12
12
  Usage: movie-renamer [-i|-s|-f|-h|-p] <folder>
13
- Default behavior is -f on current working directory
13
+ Default behavior is -f on current working directory
14
14
  -h, --help Display this help
15
15
  -i, --imdb Executes a query on imdb on <movie name>
16
16
  -s, --singlemovie FILE Acts on a single movie file <file name>
@@ -20,17 +20,19 @@ Default behavior is -f on current working directory
20
20
 
21
21
  == How it works
22
22
 
23
- Default behavior is to scan the current working directory
23
+ Default behavior is to scan the current working directory.
24
24
  For each movie in the folder a question about what to do is asked.
25
25
 
26
- Then movie is renamed using input provided by the user
26
+ Then movie is renamed using input provided by the user.
27
27
  You can query imdb using the filename or enter use manual search
28
28
 
29
29
  Each renamed movie is moved into a tmp/ subfolder of the current working directory or
30
30
  in the folder specified with the -p option
31
31
 
32
32
  By default Movies are renamed like this:
33
+
33
34
  $year - $director - $title partXX.file_extension
35
+
34
36
  You can set the rename pattern creating a .movie-renamer file in your home
35
37
 
36
38
  example:
@@ -66,7 +66,7 @@ elsif options[:single]
66
66
  exit 0
67
67
 
68
68
  elsif options[:imdb]
69
- MovieRenamer::suggestMovies(name)
69
+ MovieRenamer::imdbLookup(name)
70
70
  exit 0
71
71
  elsif name
72
72
  MovieRenamer::folderPath = File.expand_path(name)
@@ -273,7 +273,13 @@ module MovieRenamer
273
273
  # simply removing all non standard characters
274
274
  input.gsub(/[^A-Za-z0-9\_\-\s']/,'').gsub(/\s+/,' ').chomp.sub(/ +$/,'')
275
275
  end
276
-
276
+
277
+ def MovieRenamer::imdbLookup(name)
278
+ s = Imdb::Search.new(name)
279
+ s.movies[0..4].each_with_index do |m,i|
280
+ @output.puts "#{i}, #{m.year} - #{m.director.to_s.gsub(/(\[")|("\])/,'')} - #{m.title.gsub(/ .*/,'')}"
281
+ end
282
+ end
277
283
  # makes a query to imdb database
278
284
  def MovieRenamer::suggestMovies(movie)
279
285
  s = Imdb::Search.new(movie.title)
@@ -285,7 +291,7 @@ module MovieRenamer
285
291
  end
286
292
  if %w{0 1 2 3 4}.include?(cmd)
287
293
  m = s.movies[cmd.to_i]
288
- movie.title = m.title.gsub(/ .*/,'').gsub(/\s*\([0-9]+\)/,'')
294
+ movie.title = m.title.gsub(/ .*/,'').gsub(/\s*\([0-9]+\)/,'').gsub(/\saka\s.*/,'') # aka removes other lang from title
289
295
  movie.year = m.year
290
296
  movie.director = m.director.to_s.gsub(/(\[")|("\])/,'')
291
297
  elsif cmd == "m"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movie-renamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - ghedamat