mediaman 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -33,10 +33,14 @@ It does this based on a few simple rules:
33
33
 
34
34
  Anything else is considered "Other Media".
35
35
 
36
+ The parsing logic is handled by the [ToName gem](https://github.com/o-sam-o/toname).
37
+
36
38
  Then it will throw it into a pretty folder for you. Like this:
37
39
 
38
40
  ../Movies/Star Wars (1977).mov
39
41
 
42
+ or
43
+
40
44
  ../TV Shows/Star Trek - The Next Generation/Season 2/2x03 - Elementary, Dear Data.mov
41
45
 
42
46
  The library root directory is your current directory, or pass in something else with the `-l` flag.
@@ -47,10 +51,14 @@ The artwork image and metadata (in YAML format) will also be saved for your refe
47
51
 
48
52
  #### Get Metadata Only
49
53
 
50
- To save a sidecar YAML file with as much metadata as Mediaman can muster, just use:
54
+ To view a YAML-formatted printout of as much metadata as Mediaman can muster, just use:
51
55
 
52
56
  $ mediaman metadata ~/path/to/movie.mp4
53
57
 
58
+ You can also just pass in a name:
59
+
60
+ $ mediaman metadata "the truman show 1998"
61
+
54
62
  #### Help
55
63
 
56
64
  For more information, try:
@@ -1,25 +1,55 @@
1
1
  module Mediaman
2
2
 
3
3
  require "thor"
4
-
4
+ require "colorize"
5
+
5
6
  class CommandLine < Thor
6
7
 
7
8
  desc "add <file>", "sorts the file according to its metadata"
8
9
  method_option :library, type: :string, aliases: "-l", desc: "Media library base folder to sort into.", default: "."
9
- # method_option :batch, type: :boolean, aliases: "-b", desc: "Adds each file or folder in the passed-in folder to the library.", default: false
10
+ method_option :batch, type: :boolean, aliases: "-b", desc: "Adds each file or folder in the passed-in folder to the library. Not recursive.", default: false
10
11
  method_option :itunes, type: :boolean, desc: "Attempts to add the final file to iTunes.", default: false
11
- def add(path)
12
- puts "Adding #{File.basename File.expand_path(path)}..."
13
- library_document = LibraryDocument.from_path path
14
- library_document.library_path = File.expand_path options[:library]
15
- puts "Found #{library_document.video_files.size} video files and #{library_document.junk_files.size} junk files."
16
- library_document.move_to_library!
17
- library_document.save_and_apply_metadata!
18
- puts "New location: #{library_document.path}."
19
- if options[:itunes]
20
- library_document.add_to_itunes!
21
- puts "Added to iTunes!"
12
+ def add(input_path)
13
+
14
+ # Find files for batch.
15
+ if options[:batch] && File.directory?(input_path)
16
+ paths = []
17
+ Dir.glob File.join(input_path, "*") do |searchfile|
18
+ case File.extname(searchfile)[1..-1]
19
+ when /mov|mp4|m4v|avi|wmv|mkv/i then
20
+ paths << searchfile
21
+ else
22
+ if File.directory?(searchfile)
23
+ paths << searchfile
24
+ end
25
+ end
26
+ end
27
+ else
28
+ # Just try the path if it's not a directory.
29
+ paths = [input_path]
30
+ end
31
+
32
+ if paths.length > 0
33
+ puts "Found #{paths.length} supported file#{paths.length == 1 ? "" : "s"}.".yellow
34
+ else
35
+ puts "No directories or supported files found.".red
36
+ end
37
+
38
+ # Add each
39
+ for path in paths
40
+ puts "Adding #{File.basename File.expand_path(path)}".green
41
+ library_document = LibraryDocument.from_path path
42
+ library_document.library_path = File.expand_path options[:library]
43
+ puts " -> #{library_document.video_files.size} video files / #{library_document.junk_files.size} junk files."
44
+ library_document.move_to_library!
45
+ library_document.save_and_apply_metadata!
46
+ puts " -> Destination: #{library_document.path}"
47
+ if options[:itunes]
48
+ library_document.add_to_itunes!
49
+ puts " -> Added to iTunes"
50
+ end
22
51
  end
52
+
23
53
  end
24
54
 
25
55
  desc "metadata <file/directory/title>", "returns all the metadata discoverable about this file, title, or directory"
@@ -34,7 +64,7 @@ module Mediaman
34
64
  else
35
65
  doc = Document.from_path(path)
36
66
  doc.save_and_apply_metadata!
37
- puts "Metadata and image saved to #{doc.extras_path}"
67
+ puts "Metadata and image saved to #{doc.extras_path}".green
38
68
  end
39
69
  end
40
70
 
@@ -1,3 +1,3 @@
1
1
  module Mediaman
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
data/mediaman.gemspec CHANGED
@@ -23,7 +23,8 @@ Gem::Specification.new do |gem|
23
23
  gem.add_dependency 'httparty'
24
24
  gem.add_dependency 'hashie'
25
25
  gem.add_dependency 'toname'
26
-
26
+ gem.add_dependency 'colorize'
27
+
27
28
  gem.add_development_dependency "rake"
28
29
  gem.add_development_dependency "rspec"
29
30
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mediaman
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Wil Gieseler
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-08-27 00:00:00 Z
13
+ date: 2012-08-30 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -79,7 +79,7 @@ dependencies:
79
79
  type: :runtime
80
80
  version_requirements: *id006
81
81
  - !ruby/object:Gem::Dependency
82
- name: rake
82
+ name: colorize
83
83
  prerelease: false
84
84
  requirement: &id007 !ruby/object:Gem::Requirement
85
85
  none: false
@@ -87,10 +87,10 @@ dependencies:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: "0"
90
- type: :development
90
+ type: :runtime
91
91
  version_requirements: *id007
92
92
  - !ruby/object:Gem::Dependency
93
- name: rspec
93
+ name: rake
94
94
  prerelease: false
95
95
  requirement: &id008 !ruby/object:Gem::Requirement
96
96
  none: false
@@ -100,6 +100,17 @@ dependencies:
100
100
  version: "0"
101
101
  type: :development
102
102
  version_requirements: *id008
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec
105
+ prerelease: false
106
+ requirement: &id009 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ type: :development
113
+ version_requirements: *id009
103
114
  description: Mediaman manages your media, man.
104
115
  email:
105
116
  - supapuerco@gmail.com