osdb 0.1.0 → 0.1.2

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.
Files changed (4) hide show
  1. data/README.md +1 -1
  2. data/bin/getsub +14 -1
  3. data/lib/osdb/version.rb +1 -1
  4. metadata +4 -4
data/README.md CHANGED
@@ -26,7 +26,7 @@ You just have to execute `getsub` with some video files in arguments:
26
26
 
27
27
  Or specify a directory to search recursively:
28
28
 
29
- $ getsub -d ~/Movies
29
+ $ getsub ~/Movies
30
30
 
31
31
  For options details just run:
32
32
 
data/bin/getsub CHANGED
@@ -49,7 +49,7 @@ class GetSub
49
49
  def run!(files)
50
50
  @parser.parse!
51
51
 
52
- movie_files = files.map{ |path| OSDb::MovieFile.new(path) }
52
+ movie_files = glob(files).map{ |path| OSDb::MovieFile.new(path) }
53
53
 
54
54
  movie_files.each do |movie_file|
55
55
  begin
@@ -72,6 +72,19 @@ class GetSub
72
72
  end
73
73
  end
74
74
 
75
+ def glob(files)
76
+ files.map do |path|
77
+ if File.directory?(path)
78
+ Dir.chdir(path) do # chdir to avoid escaping special chars in path
79
+ relative_paths = Dir.glob("**/*.{#{OSDb::MovieFile::EXTENSIONS.join(',')}}")
80
+ return relative_paths.map{ |f| File.join(path, f) }
81
+ end
82
+ else
83
+ path
84
+ end
85
+ end.flatten
86
+ end
87
+
75
88
  def report_exception(exception)
76
89
  puts "Something crashed."
77
90
  puts "Feel free to report the error here: https://github.com/byroot/ruby-osdb/issues"
@@ -1,3 +1,3 @@
1
1
  module OSDb
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-22 00:00:00.000000000 Z
12
+ date: 2013-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  segments:
141
141
  - 0
142
- hash: 3778629745082147470
142
+ hash: -4594447033621309387
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  none: false
145
145
  requirements:
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  segments:
150
150
  - 0
151
- hash: 3778629745082147470
151
+ hash: -4594447033621309387
152
152
  requirements: []
153
153
  rubyforge_project: osdb
154
154
  rubygems_version: 1.8.24