mediaman 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mediaman/command.rb +13 -4
- data/lib/mediaman/document.rb +1 -0
- data/lib/mediaman/version.rb +1 -1
- metadata +1 -1
data/lib/mediaman/command.rb
CHANGED
@@ -22,11 +22,20 @@ module Mediaman
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
desc "metadata <file>", "returns all the metadata discoverable about this file or directory"
|
25
|
+
desc "metadata <file/directory/title>", "returns all the metadata discoverable about this file, title, or directory"
|
26
26
|
def metadata(path)
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
path = File.expand_path path
|
28
|
+
if !File.exists?(path) && !File.directory?(path)
|
29
|
+
name = path
|
30
|
+
end
|
31
|
+
if name
|
32
|
+
doc = Mediaman::TemporaryDocument.from_name(name)
|
33
|
+
puts doc.metadata.stringify_keys.to_yaml
|
34
|
+
else
|
35
|
+
doc = Document.from_path(path)
|
36
|
+
doc.save_and_apply_metadata!
|
37
|
+
puts "Metadata and image saved to #{doc.extras_path}"
|
38
|
+
end
|
30
39
|
end
|
31
40
|
|
32
41
|
end
|
data/lib/mediaman/document.rb
CHANGED
@@ -104,6 +104,7 @@ module Mediaman
|
|
104
104
|
Metadata.new({'episode_details' => tv.to_hash, 'show_details' => tv.show.to_hash})
|
105
105
|
end
|
106
106
|
rescue
|
107
|
+
puts "TRAKT_API_KEY not set. Please set this environment variable to use remote metadata." unless ENV["TRAKT_API_KEY"]
|
107
108
|
{}
|
108
109
|
end
|
109
110
|
end
|
data/lib/mediaman/version.rb
CHANGED