autogg 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -4,7 +4,7 @@ spec = Gem::Specification.new do |s|
4
4
  s.description = File.read(File.join(File.dirname(__FILE__), 'README'))
5
5
  s.requirements << 'oggenc must be installed on the base system'
6
6
  s.add_dependency 'rb-inotify', '>= 0.8.4'
7
- s.version = "0.2.1"
7
+ s.version = "0.2.2"
8
8
  s.author = 'Evan Simmons'
9
9
  s.email = 'esims89@gmail.com'
10
10
  s.homepage = 'https://github.com/estk/autogg'
@@ -1,4 +1,5 @@
1
1
  require 'find'
2
+ require 'rb-inotify'
2
3
  require_relative 'progressbar'
3
4
 
4
5
  module OggEncode
@@ -6,24 +7,22 @@ module OggEncode
6
7
  class << self
7
8
 
8
9
  def oggencdir
10
+ @pbar = ProgressBar.new( "Progress", ( count_flacs - count_oggs ) )
11
+ @watching = false
9
12
  Find.find( @paths.flac ) do |path|
10
13
  if FileTest.directory?( path )
11
- if File.basename( path )[0] == ?.
12
- Find.prune
13
- else
14
- #@pbar.inc
15
- end
14
+ Find.prune if File.basename( path )[0] == ?.
16
15
  elsif Flac.exists?( path ) and not Ogg.exists?( getoutpath(path) )
17
16
  encfile( path )
18
17
  end
19
18
  end
20
- Process.waitall ; @ps_hash = {}
19
+ Process.waitall ; @ps_hash = {} ; @pbar.finish
21
20
  end
22
21
 
23
22
  def encfile( inpath )
24
23
  outpath = getoutpath( inpath )
25
24
  @ps_hash.store( nil, outpath ) do
26
- IO.popen %Q{oggenc #{@oggargs.join(' ')} "#{inpath}" -o "#{outpath}"}
25
+ ps = IO.popen %Q{oggenc #{@oggargs.join(' ')} "#{inpath}" -o "#{outpath}"}
27
26
  end
28
27
  @pbar.inc
29
28
  end
@@ -46,7 +45,7 @@ module OggEncode
46
45
  end
47
46
 
48
47
  def interupt
49
- puts "\n" + "Shutting down and removing partially encoded files"
48
+ puts "\n" + "Shutting down and removing partially encoded files" unless @watching
50
49
  @ps_hash.each do |pid, path|
51
50
  File.delete( path )
52
51
  end
@@ -54,24 +53,24 @@ module OggEncode
54
53
  end
55
54
 
56
55
  def watcher
57
- require 'rb-inotify'
58
56
  notifier = INotify::Notifier.new
59
- notifier.watch( @paths.flac, :create ) do |e|
57
+ notifier.watch( @paths.flac, :create, :recursive ) do |e|
60
58
  puts %Q{#{Time.now.ctime}: #{e.name} was modified, rescaning...}
61
- oggencdir ; Process.waitall
62
- puts "watching #{@paths.flac}"
59
+ sleep 60
60
+ oggencdir ; @watching = true ; puts "watching #{@paths.flac}"
63
61
  end
62
+ @watching = true
64
63
  puts "watching #{@paths.flac}"
65
64
  notifier.run
66
65
  end
67
66
 
67
+
68
68
  def encode( options )
69
69
  @options = options
70
70
  @paths = options.paths
71
71
  @oggargs = options.oggargs
72
72
  @ps_hash = SizedPsHash.new( options.max_procs )
73
- @pbar = ProgressBar.new( "Subdirectory progress", ( count_flacs - count_oggs ) )
74
- oggencdir ; @pbar.finish
73
+ oggencdir
75
74
  watcher if options.watch
76
75
  end
77
76
  end
@@ -10,3 +10,7 @@ module OggEncode
10
10
  end
11
11
  end
12
12
  end
13
+
14
+ if $0 == __FILE__
15
+ OggEncode::Runner.run(ARGV)
16
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: autogg
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Evan Simmons
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-26 00:00:00 Z
13
+ date: 2011-06-20 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rb-inotify
@@ -36,6 +36,7 @@ extra_rdoc_files: []
36
36
  files:
37
37
  - autogg.gemspec
38
38
  - LICENCE
39
+ - autogg-0.2.1.gem
39
40
  - autogg-0.2.0.gem
40
41
  - bin/autogg
41
42
  - README
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  requirements:
68
69
  - oggenc must be installed on the base system
69
70
  rubyforge_project:
70
- rubygems_version: 1.7.2
71
+ rubygems_version: 1.8.4
71
72
  signing_key:
72
73
  specification_version: 3
73
74
  summary: converts a folder of flacs to ogg, preserving directory structure