myimdb 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/myimdb-catalogue +9 -8
- data/myimdb.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.8
|
data/bin/myimdb-catalogue
CHANGED
@@ -7,7 +7,7 @@ require 'myimdb'
|
|
7
7
|
class Platform
|
8
8
|
class << self
|
9
9
|
def windows?
|
10
|
-
RUBY_PLATFORM =~ /mswin|windows/i
|
10
|
+
RUBY_PLATFORM =~ /mswin|windows|mingw/i
|
11
11
|
end
|
12
12
|
|
13
13
|
def mac?
|
@@ -69,7 +69,7 @@ if ARGV.empty?
|
|
69
69
|
abort "Source directory required - exiting"
|
70
70
|
end
|
71
71
|
|
72
|
-
file_paths = options[:recursive] ? Dir["#{ARGV[0]}/*"] :
|
72
|
+
file_paths = options[:recursive] ? Dir["#{ARGV[0]}/*"] : [ARGV[0]]
|
73
73
|
|
74
74
|
|
75
75
|
# helper methods
|
@@ -77,7 +77,7 @@ def conf_file_name
|
|
77
77
|
'desktop.ini'
|
78
78
|
end
|
79
79
|
|
80
|
-
def
|
80
|
+
def icon_file_name
|
81
81
|
if Platform.windows?
|
82
82
|
'movie.ico'
|
83
83
|
else
|
@@ -109,7 +109,7 @@ def repair_permissions_for(target_dir)
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def convert_to_icon(image_file_path, icon_file_path)
|
112
|
-
`convert "#{image_file_path}" -thumbnail 256x256 -gravity center -crop 256x256+0+0! -background transparent -flatten "#{
|
112
|
+
`convert "#{image_file_path}" -thumbnail 256x256 -gravity center -crop 256x256+0+0! -background transparent -flatten "#{icon_file_path}"`
|
113
113
|
end
|
114
114
|
|
115
115
|
def save_image(target_dir, name, image_index=0)
|
@@ -123,8 +123,8 @@ def save_image(target_dir, name, image_index=0)
|
|
123
123
|
image_file.puts file.read
|
124
124
|
end
|
125
125
|
end
|
126
|
-
|
127
|
-
convert_to_icon(image_file_path,
|
126
|
+
|
127
|
+
convert_to_icon(image_file_path, File.join(target_dir, icon_file_name))
|
128
128
|
|
129
129
|
if Platform.windows?
|
130
130
|
repair_permissions_for(target_dir)
|
@@ -161,7 +161,7 @@ file_paths.each do |path|
|
|
161
161
|
|
162
162
|
metadata_present = (name.scan(/\[.*?\]/).size == 3)
|
163
163
|
# metadata exists and -f isn't supplied
|
164
|
-
if metadata_present and !options[:force]
|
164
|
+
if metadata_present and !options[:force] and options[:metadata]
|
165
165
|
p "Skipping: Metadata already exists for: #{name}"
|
166
166
|
elsif options[:metadata]
|
167
167
|
p "Fetching metadata for: #{name}"
|
@@ -171,7 +171,7 @@ file_paths.each do |path|
|
|
171
171
|
# movie icon exists and -f isn't supplied
|
172
172
|
if !metadata_present
|
173
173
|
p "Skipping: Metadata not present: #{name}"
|
174
|
-
elsif File.exists?(File.join(path, 'movie.ico')) and !options[:force]
|
174
|
+
elsif File.exists?(File.join(path, 'movie.ico')) and !options[:force] and options[:images]
|
175
175
|
p "Skipping: Image already exists for: #{name}"
|
176
176
|
elsif options[:images]
|
177
177
|
p "Fetching image for: #{name}"
|
@@ -184,6 +184,7 @@ file_paths.each do |path|
|
|
184
184
|
end
|
185
185
|
|
186
186
|
if options[:'rebuild-permissions']
|
187
|
+
p "Repairing permissions for for: #{name}"
|
187
188
|
repair_permissions_for(path)
|
188
189
|
end
|
189
190
|
rescue
|
data/myimdb.gemspec
CHANGED