movier 0.0.9 → 0.1.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: 96b965b53f940bc2634e3b8b048d5f9b2e5d8dd6
4
- data.tar.gz: 59ca808303a4ee2698592e810f36610686892cbf
3
+ metadata.gz: 0badd4508856c37a8b5058c7cdd20b7f1f58a28e
4
+ data.tar.gz: 125ea20f8f286fe15572f8f14a2d032ac36f77c6
5
5
  SHA512:
6
- metadata.gz: 6cf3f65f3d0e17618e24ae2644af34d433947b170c8bb14646a2cf7bcae27f3894e6aadef7b870d7f9daa69d9c7fcf2301971b9cb5405fa50abd042216c77113
7
- data.tar.gz: 33b82ada92a9e8590745106d8871918f49e02423f0634c8233f5ed29e9a09f509154a05890cd7cce46b419349620f6db6773b91cce5fbfff93470cb228891e5c
6
+ metadata.gz: fcb9ea902e193e756ecc4aefbd4596a208ba09bb2d73c224d17566d78dbcd0965b8d7103d9904048c4fc4bcabad54dff869fe5b0c8ed60b8fcab8df2cab41809
7
+ data.tar.gz: fcd4bc724eb9e81565317d14589b05a3d030c3b3f28ab8cc098f45c3c6205b3e655c8592de6736064f2d3260a32ad99f977362b4c16cf81aa4564d516a49ae4f
@@ -1,4 +1,5 @@
1
1
  require 'movier/version.rb'
2
+ require 'pry'
2
3
 
3
4
  # Add requires for other files you add to your project here, so
4
5
  # you just need to require this one file in your bin file
@@ -57,6 +57,7 @@ module Movier
57
57
  end
58
58
 
59
59
  def find(params)
60
+ # TODO: add support for "find in a box" and "exclude boxes"
60
61
  read_data; @params = params; @params[:verbose] = true if @params[:shuffle]
61
62
  raise "Please, add some movie boxes, before searching in the local movie database" unless @movies.any?
62
63
 
@@ -154,15 +155,9 @@ module Movier
154
155
  message = "Found no movie box in the local database.\n"
155
156
  message += "Please, run `movier add` to add some movie boxes, before updating me!"
156
157
  raise message if @boxes.empty?
157
- @boxes.each { |box| delete(box); add(box) }
158
- end
159
-
160
- def delete(dir = nil)
161
- dir = File.expand_path dir
162
- @movies.reject!{ |movie| movie[:box] == dir }
163
- @boxes.reject!{ |box| box == dir }
158
+ @movies = []
164
159
  write_data
165
- current_state
160
+ @boxes.each { |box| add(box) }
166
161
  end
167
162
 
168
163
  # Add a given directory to the local movie database.
@@ -181,8 +176,9 @@ module Movier
181
176
  count = 0
182
177
  imdb.each do |file|
183
178
  movie = Movier.read_yaml file
184
- if in_database?(movie) && !@boxes.include?(dir)
185
- Movier.warn_with "#{movie[:imdb]["Title"]} already exists in database!"
179
+ if in_database?(movie)
180
+ # TODO: add the path with a "dup" key
181
+ Movier.warn_with "#{movie[:imdb]["Title"]} - # #{movie[:imdb]["imdbRating"]} - already exists in database!"
186
182
  elsif !in_database?(movie)
187
183
  @movies.push sanitize(movie, dir, file)
188
184
  count += 1
@@ -192,12 +188,8 @@ module Movier
192
188
  @boxes.push dir unless @boxes.include? dir
193
189
  write_data
194
190
 
195
- Movier.passed_with "Added #{count} new movies in LMDB."
196
- current_state
197
- end
198
-
199
- def current_state
200
- Movier.tip_now "LMDB now contains #{@movies.count} movies, and #{@boxes.count} boxes."
191
+ Movier.passed_with "Added #{"%4d" % count} new movies in LMDB from: #{dir}"
192
+ Movier.tip_now "LMDB now contains #{"%4d" % @movies.count} movies."
201
193
  end
202
194
 
203
195
  def sanitize(movie, dir, imdb_file)
@@ -1,3 +1,3 @@
1
1
  module Movier
2
- VERSION = '0.0.9'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: movier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikhil Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-10 00:00:00.000000000 Z
11
+ date: 2013-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.0.0
178
+ rubygems_version: 2.0.3
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Movier is a gem that allows you to quickly organize your movies