autogg 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +13 -0
- data/autogg-0.2.2.gem +0 -0
- data/autogg.gemspec +1 -3
- data/lib/autogg/encoder.rb +1 -17
- data/lib/autogg/parser.rb +1 -8
- metadata +6 -17
- data/README +0 -1
data/README.textile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
h1. Autogg
|
2
|
+
|
3
|
+
h2. Summary
|
4
|
+
|
5
|
+
Encodes all flac files in a given directory to ogg in another given directory while preserving the directory structure.
|
6
|
+
|
7
|
+
h2. Adding as a cronjob
|
8
|
+
|
9
|
+
*Example:*
|
10
|
+
|
11
|
+
bc. $ echo '@hourly ID=autogg autogg /media/tb/rt/wt/ /media/tb/ogg/ -o -q8' | crontab -
|
12
|
+
|
13
|
+
_keep in mind this replaces the current crontab_
|
data/autogg-0.2.2.gem
ADDED
Binary file
|
data/autogg.gemspec
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
spec = Gem::Specification.new do |s|
|
2
2
|
s.name = 'autogg'
|
3
3
|
s.summary = 'converts a folder of flacs to ogg, preserving directory structure'
|
4
|
-
s.description = File.read(File.join(File.dirname(__FILE__), 'README'))
|
5
4
|
s.requirements << 'oggenc must be installed on the base system'
|
6
|
-
s.
|
7
|
-
s.version = "0.2.2"
|
5
|
+
s.version = "0.2.3"
|
8
6
|
s.author = 'Evan Simmons'
|
9
7
|
s.email = 'esims89@gmail.com'
|
10
8
|
s.homepage = 'https://github.com/estk/autogg'
|
data/lib/autogg/encoder.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'find'
|
2
|
-
require 'rb-inotify'
|
3
2
|
require_relative 'progressbar'
|
4
3
|
|
5
4
|
module OggEncode
|
@@ -8,7 +7,6 @@ module OggEncode
|
|
8
7
|
|
9
8
|
def oggencdir
|
10
9
|
@pbar = ProgressBar.new( "Progress", ( count_flacs - count_oggs ) )
|
11
|
-
@watching = false
|
12
10
|
Find.find( @paths.flac ) do |path|
|
13
11
|
if FileTest.directory?( path )
|
14
12
|
Find.prune if File.basename( path )[0] == ?.
|
@@ -45,33 +43,19 @@ module OggEncode
|
|
45
43
|
end
|
46
44
|
|
47
45
|
def interupt
|
48
|
-
puts "\n" + "Shutting down and removing partially encoded files"
|
46
|
+
puts "\n" + "Shutting down and removing partially encoded files"
|
49
47
|
@ps_hash.each do |pid, path|
|
50
48
|
File.delete( path )
|
51
49
|
end
|
52
50
|
exit
|
53
51
|
end
|
54
52
|
|
55
|
-
def watcher
|
56
|
-
notifier = INotify::Notifier.new
|
57
|
-
notifier.watch( @paths.flac, :create, :recursive ) do |e|
|
58
|
-
puts %Q{#{Time.now.ctime}: #{e.name} was modified, rescaning...}
|
59
|
-
sleep 60
|
60
|
-
oggencdir ; @watching = true ; puts "watching #{@paths.flac}"
|
61
|
-
end
|
62
|
-
@watching = true
|
63
|
-
puts "watching #{@paths.flac}"
|
64
|
-
notifier.run
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
53
|
def encode( options )
|
69
54
|
@options = options
|
70
55
|
@paths = options.paths
|
71
56
|
@oggargs = options.oggargs
|
72
57
|
@ps_hash = SizedPsHash.new( options.max_procs )
|
73
58
|
oggencdir
|
74
|
-
watcher if options.watch
|
75
59
|
end
|
76
60
|
end
|
77
61
|
|
data/lib/autogg/parser.rb
CHANGED
@@ -7,21 +7,14 @@ module OggEncode
|
|
7
7
|
|
8
8
|
script_name = File.basename( $0 )
|
9
9
|
options = OpenStruct.new
|
10
|
-
options.watch = false
|
11
10
|
options.max_procs = 4
|
12
11
|
options.oggargs = ['-Q']
|
13
12
|
|
14
13
|
op = OptionParser.new do |opts|
|
15
14
|
opts.banner = "Usage: autogg.rb [options] flacpath oggpath [ -o oggenc args ... ]\n" +
|
16
|
-
"Example: #{script_name} ~/music/flac/ ~/music/ogg/ --
|
15
|
+
"Example: #{script_name} ~/music/flac/ ~/music/ogg/ --oggenc-args -q8\n" +
|
17
16
|
" Ex2: #{script_name} ~/music/flac/ ~/music/ogg/ -o -q8,-Q,--utf8"
|
18
17
|
|
19
|
-
opts.on( '-w', '--watch',
|
20
|
-
"Watch flacpath for changes, then rescan " +
|
21
|
-
"and encode if any files are created within" ) do
|
22
|
-
options.watch = true
|
23
|
-
end
|
24
|
-
|
25
18
|
opts.on( '-m', '--max-processes n', "Maximum number of encoding processes running at once" ) do |n|
|
26
19
|
options.max_procs = n.to_i
|
27
20
|
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.
|
5
|
+
version: 0.2.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Evan Simmons
|
@@ -10,22 +10,10 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: rb-inotify
|
17
|
-
prerelease: false
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.8.4
|
24
|
-
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
description: |
|
27
|
-
Encodes all flac files in a given directory to ogg in another given directory while preserving the directory structure. Also if rb-inotify is installed and -w flag is passed, it will watch for changes on the filesystem and rescan the directory, encoding the new files.
|
13
|
+
date: 2011-06-21 00:00:00 Z
|
14
|
+
dependencies: []
|
28
15
|
|
16
|
+
description:
|
29
17
|
email: esims89@gmail.com
|
30
18
|
executables:
|
31
19
|
- autogg
|
@@ -34,12 +22,13 @@ extensions: []
|
|
34
22
|
extra_rdoc_files: []
|
35
23
|
|
36
24
|
files:
|
25
|
+
- README.textile
|
37
26
|
- autogg.gemspec
|
38
27
|
- LICENCE
|
39
28
|
- autogg-0.2.1.gem
|
40
29
|
- autogg-0.2.0.gem
|
41
30
|
- bin/autogg
|
42
|
-
-
|
31
|
+
- autogg-0.2.2.gem
|
43
32
|
- lib/autogg/progressbar.rb
|
44
33
|
- lib/autogg/runner.rb
|
45
34
|
- lib/autogg/parser.rb
|
data/README
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Encodes all flac files in a given directory to ogg in another given directory while preserving the directory structure. Also if rb-inotify is installed and -w flag is passed, it will watch for changes on the filesystem and rescan the directory, encoding the new files.
|