scottburton11-MovieBot 0.0.4
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.
- data/History.txt +6 -0
- data/Manifest.txt +174 -0
- data/MovieBot.gemspec +27 -0
- data/README.txt +66 -0
- data/VERSION.yml +4 -0
- data/bin/movie_bot +46 -0
- data/lib/movie_bot.rb +153 -0
- data/lib/movie_bot/image_converter.rb +31 -0
- data/lib/movie_bot/movie_maker.rb +160 -0
- data/lib/movie_bot/queue_manager.rb +61 -0
- data/spec/movie_bot_spec.rb +23 -0
- data/spec/spec_helper.rb +6 -0
- data/test/test_movie_bot.rb +0 -0
- metadata +66 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.git/COMMIT_EDITMSG
|
|
3
|
+
.git/HEAD
|
|
4
|
+
.git/ORIG_HEAD
|
|
5
|
+
.git/config
|
|
6
|
+
.git/description
|
|
7
|
+
.git/hooks/applypatch-msg
|
|
8
|
+
.git/hooks/commit-msg
|
|
9
|
+
.git/hooks/post-commit
|
|
10
|
+
.git/hooks/post-receive
|
|
11
|
+
.git/hooks/post-update
|
|
12
|
+
.git/hooks/pre-applypatch
|
|
13
|
+
.git/hooks/pre-commit
|
|
14
|
+
.git/hooks/pre-rebase
|
|
15
|
+
.git/hooks/update
|
|
16
|
+
.git/index
|
|
17
|
+
.git/info/exclude
|
|
18
|
+
.git/logs/HEAD
|
|
19
|
+
.git/logs/refs/heads/master
|
|
20
|
+
.git/logs/refs/remotes/origin/master
|
|
21
|
+
.git/objects/02/e90c370dc24a7a5faf3cb0cbe5e58b19febe0e
|
|
22
|
+
.git/objects/04/6905539f6d0af83c897b2cd1ca43685b53ed04
|
|
23
|
+
.git/objects/04/9be2d2eca720234e0180bbaff51043409201f0
|
|
24
|
+
.git/objects/05/3d41d2450b122904e18f5e60c7ac4b9fa2a7b4
|
|
25
|
+
.git/objects/06/3710acc9a4e9536685e7a18c8e317e7789dfe0
|
|
26
|
+
.git/objects/06/bd54f94349e6b516995ab7a545175e6c353f2b
|
|
27
|
+
.git/objects/0b/ea68021e8eec252a1ebf8393de7d1348823112
|
|
28
|
+
.git/objects/0c/b1f7e71cba2feb90971884b450135742ae0595
|
|
29
|
+
.git/objects/0e/0a4673b1fdfa2a27af075dec3c3c463da167f8
|
|
30
|
+
.git/objects/17/53616495233863cf5425d15a795944a54cfcfd
|
|
31
|
+
.git/objects/1d/19f283f64763dbfed45cc472eb4efb6832f89d
|
|
32
|
+
.git/objects/22/61d69368131d7b3b6fa67d81e17babfc226320
|
|
33
|
+
.git/objects/23/9d9d4913f72d48733a41cd7d99df43870ef39b
|
|
34
|
+
.git/objects/24/bca1d5aa65c12ef827cc01e51beb1c30115758
|
|
35
|
+
.git/objects/26/210402a59450484d58eb1a1588c5aed7bb4cc2
|
|
36
|
+
.git/objects/2a/5948e6d32ddd58d113ed9eb706f8cedb93c843
|
|
37
|
+
.git/objects/33/834d430d16534ba883b5e40d2f355dd1b07630
|
|
38
|
+
.git/objects/34/a12817bf1b781c9229d6f6151f1b24a6597d73
|
|
39
|
+
.git/objects/36/6c22306e61aabebca7d1f0a81f0182cf323d68
|
|
40
|
+
.git/objects/3c/dff8195f3733590ccb005882b6ca6d5d0f7e9e
|
|
41
|
+
.git/objects/41/679536c6571745348ab928858fbdfb70325490
|
|
42
|
+
.git/objects/42/2bdf8fcb2e7c1c5d346d4b60737014b6ed52d5
|
|
43
|
+
.git/objects/43/0aa314997c1831928587b96f426231304e7f66
|
|
44
|
+
.git/objects/4c/dd786262a18276f15a13f62abc42643cde89f7
|
|
45
|
+
.git/objects/4e/ef0c7d15ebb3b9f235d94f7467c5c5762b7093
|
|
46
|
+
.git/objects/57/c39790b5c1ab3d26bc2f1fb42faf4ff58ca38f
|
|
47
|
+
.git/objects/5a/41ff2e41ae4797820c6003e343af076da56cbf
|
|
48
|
+
.git/objects/5f/46e42ae75cc4ab3912045413d667daff565731
|
|
49
|
+
.git/objects/60/525f0244bdd1c30868ade689c631a41a90ac0e
|
|
50
|
+
.git/objects/60/bc4ce9a4fb4a90eecf061f7d3b6957350a240f
|
|
51
|
+
.git/objects/62/7ce15a4e63c4cddcfab2acbc9f54776f5baf83
|
|
52
|
+
.git/objects/66/75560b05ab8645598cd561ceca635d2ab29bce
|
|
53
|
+
.git/objects/6c/683da13c02d1005caf48dfacdc7fb90d0775e0
|
|
54
|
+
.git/objects/6f/8801f91e2ba6c9f3b38f305d119e7c53054ba8
|
|
55
|
+
.git/objects/71/a5708be50bc914b98fe3105529946d503b084e
|
|
56
|
+
.git/objects/73/7c4f8b387f8eabbd910296dea296a977a364a7
|
|
57
|
+
.git/objects/7d/31a30676f13f382dea8dc246449c2ceb9cb6dd
|
|
58
|
+
.git/objects/7e/54f746e2e5b8872149234b9f493f474022b9ac
|
|
59
|
+
.git/objects/7f/596c82e8655905c7446d4f58397785a29ed165
|
|
60
|
+
.git/objects/85/2b05b0d7a2bb7bf125d3ef1dbbe624fe71d66a
|
|
61
|
+
.git/objects/90/c2ac15f1cd0960bc2c80f87a663741d4d2355a
|
|
62
|
+
.git/objects/94/457e6a420537beba1fd63f49d1e60897ec15ae
|
|
63
|
+
.git/objects/95/f8eaef5ca189659be673fd4ba40ade9ddc94be
|
|
64
|
+
.git/objects/98/5a8637ba350861d5dca2ee73ebb66a3525fd06
|
|
65
|
+
.git/objects/99/48e7c51a0fe47ce9a2fb5a2dc42a6fc3c0b629
|
|
66
|
+
.git/objects/9a/e61e6cee3fdd4448d3b662eda49e64704bdca7
|
|
67
|
+
.git/objects/9c/74149447ad083c30365185a4ee513c679a7676
|
|
68
|
+
.git/objects/9c/7d99bbfcdde8766ff3f62ae9bb9c5eff8423b8
|
|
69
|
+
.git/objects/9e/42bfc540d99535f9276df69d033d1044056e9a
|
|
70
|
+
.git/objects/9e/e7f3a9a93279d394af73ae553f675be89038a4
|
|
71
|
+
.git/objects/af/9d97bbfd9293da698d1c6ee2fa3889e820641e
|
|
72
|
+
.git/objects/b5/389542915827714cd22d72a575696b468e9c8c
|
|
73
|
+
.git/objects/b7/2c74df3760557ea1cf489918d3f117a08563d1
|
|
74
|
+
.git/objects/bc/9691b780f321bdd9b35a7d20d9c41321ef4357
|
|
75
|
+
.git/objects/cc/a1cc612e00b953cfeb2d944f75fe0a9dfc4661
|
|
76
|
+
.git/objects/cd/3972fe469dba432f6d67ec1798e7a9950bf34e
|
|
77
|
+
.git/objects/cd/7e9be819ca55fb694b220f448ae33fea4d55de
|
|
78
|
+
.git/objects/d3/89fde6c7245ced461b8e348580a332890f9a35
|
|
79
|
+
.git/objects/d9/4624c2de4211e637668ac4ac050a9f9614516c
|
|
80
|
+
.git/objects/db/08667e73b334062b7a0803fa5b5e3c2a3de40a
|
|
81
|
+
.git/objects/dc/18c18e21799f0c64a0111dc74249986bd390e5
|
|
82
|
+
.git/objects/e2/48f74d4b8636831a3b71b79e38231e679ffc5a
|
|
83
|
+
.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|
|
84
|
+
.git/objects/ea/37145e866919bb493bb78577a267fc54555ed4
|
|
85
|
+
.git/objects/ef/63ac02adb9780c8e1c4758ec0b17024f8f3a4c
|
|
86
|
+
.git/objects/f3/772947ab0764b1b3f389af0c9058d99929740b
|
|
87
|
+
.git/objects/f6/9e8b80c2ad4e736d6e2fc528daf0c495dd80b6
|
|
88
|
+
.git/objects/f6/ed5a183ffe6a9a3a0da0f644e727b7fba31e96
|
|
89
|
+
.git/objects/f9/f60d0a8f94f19a9f55d4bcbfeaf7866207ada5
|
|
90
|
+
.git/refs/heads/master
|
|
91
|
+
.git/refs/remotes/origin/master
|
|
92
|
+
.git/refs/tags/0.0.1
|
|
93
|
+
.gitmodules
|
|
94
|
+
History.txt
|
|
95
|
+
Manifest.txt
|
|
96
|
+
MovieBot.gemspec
|
|
97
|
+
README.txt
|
|
98
|
+
Rakefile
|
|
99
|
+
bin/movie_bot
|
|
100
|
+
fixtures/image_formats.csv
|
|
101
|
+
fixtures/image_formats.yml
|
|
102
|
+
init.rb
|
|
103
|
+
lib/movie_bot.rb
|
|
104
|
+
lib/movie_bot/image_converter.rb
|
|
105
|
+
lib/movie_bot/movie_maker.rb
|
|
106
|
+
lib/movie_bot/queue_manager.rb
|
|
107
|
+
spec/movie_bot_spec.rb
|
|
108
|
+
spec/spec_helper.rb
|
|
109
|
+
test/test_movie_bot.rb
|
|
110
|
+
vendor/im_magick/.git/HEAD
|
|
111
|
+
vendor/im_magick/.git/config
|
|
112
|
+
vendor/im_magick/.git/description
|
|
113
|
+
vendor/im_magick/.git/hooks/applypatch-msg
|
|
114
|
+
vendor/im_magick/.git/hooks/commit-msg
|
|
115
|
+
vendor/im_magick/.git/hooks/post-commit
|
|
116
|
+
vendor/im_magick/.git/hooks/post-receive
|
|
117
|
+
vendor/im_magick/.git/hooks/post-update
|
|
118
|
+
vendor/im_magick/.git/hooks/pre-applypatch
|
|
119
|
+
vendor/im_magick/.git/hooks/pre-commit
|
|
120
|
+
vendor/im_magick/.git/hooks/pre-rebase
|
|
121
|
+
vendor/im_magick/.git/hooks/update
|
|
122
|
+
vendor/im_magick/.git/index
|
|
123
|
+
vendor/im_magick/.git/info/exclude
|
|
124
|
+
vendor/im_magick/.git/logs/HEAD
|
|
125
|
+
vendor/im_magick/.git/logs/refs/heads/master
|
|
126
|
+
vendor/im_magick/.git/logs/refs/remotes/origin/master
|
|
127
|
+
vendor/im_magick/.git/objects/pack/pack-53fa29483b3031c9a403ec9c13d6706b68ef081e.idx
|
|
128
|
+
vendor/im_magick/.git/objects/pack/pack-53fa29483b3031c9a403ec9c13d6706b68ef081e.keep
|
|
129
|
+
vendor/im_magick/.git/objects/pack/pack-53fa29483b3031c9a403ec9c13d6706b68ef081e.pack
|
|
130
|
+
vendor/im_magick/.git/refs/heads/master
|
|
131
|
+
vendor/im_magick/.git/refs/remotes/origin/HEAD
|
|
132
|
+
vendor/im_magick/.git/refs/remotes/origin/master
|
|
133
|
+
vendor/im_magick/.gitignore
|
|
134
|
+
vendor/im_magick/History.txt
|
|
135
|
+
vendor/im_magick/License.txt
|
|
136
|
+
vendor/im_magick/Manifest.txt
|
|
137
|
+
vendor/im_magick/README
|
|
138
|
+
vendor/im_magick/Rakefile
|
|
139
|
+
vendor/im_magick/config/hoe.rb
|
|
140
|
+
vendor/im_magick/config/requirements.rb
|
|
141
|
+
vendor/im_magick/lib/im_magick.rb
|
|
142
|
+
vendor/im_magick/lib/im_magick/command/base.rb
|
|
143
|
+
vendor/im_magick/lib/im_magick/command/collector.rb
|
|
144
|
+
vendor/im_magick/lib/im_magick/command/composite.rb
|
|
145
|
+
vendor/im_magick/lib/im_magick/command/convert.rb
|
|
146
|
+
vendor/im_magick/lib/im_magick/command/emitter.rb
|
|
147
|
+
vendor/im_magick/lib/im_magick/command/identify.rb
|
|
148
|
+
vendor/im_magick/lib/im_magick/command/mogrify.rb
|
|
149
|
+
vendor/im_magick/lib/im_magick/command/montage.rb
|
|
150
|
+
vendor/im_magick/lib/im_magick/command/runner.rb
|
|
151
|
+
vendor/im_magick/lib/im_magick/core_ext/class.rb
|
|
152
|
+
vendor/im_magick/lib/im_magick/core_ext/string.rb
|
|
153
|
+
vendor/im_magick/lib/im_magick/image.rb
|
|
154
|
+
vendor/im_magick/lib/im_magick/image_info.rb
|
|
155
|
+
vendor/im_magick/lib/im_magick/image_macros.rb
|
|
156
|
+
vendor/im_magick/lib/im_magick/merbtasks.rb
|
|
157
|
+
vendor/im_magick/lib/im_magick/util/geometry.rb
|
|
158
|
+
vendor/im_magick/lib/im_magick/util/temp_file.rb
|
|
159
|
+
vendor/im_magick/lib/im_magick/version.rb
|
|
160
|
+
vendor/im_magick/script/destroy
|
|
161
|
+
vendor/im_magick/script/generate
|
|
162
|
+
vendor/im_magick/setup.rb
|
|
163
|
+
vendor/im_magick/spec/fixtures/ImageMagick.jpg
|
|
164
|
+
vendor/im_magick/spec/fonts/union.ttf
|
|
165
|
+
vendor/im_magick/spec/fonts/unionbd.ttf
|
|
166
|
+
vendor/im_magick/spec/im_magick_convert_spec.rb
|
|
167
|
+
vendor/im_magick/spec/im_magick_image_info_spec.rb
|
|
168
|
+
vendor/im_magick/spec/im_magick_spec.rb
|
|
169
|
+
vendor/im_magick/spec/spec.opts
|
|
170
|
+
vendor/im_magick/spec/spec_helper.rb
|
|
171
|
+
vendor/im_magick/tasks/deployment.rake
|
|
172
|
+
vendor/im_magick/tasks/environment.rake
|
|
173
|
+
vendor/im_magick/tasks/rspec.rake
|
|
174
|
+
vendor/im_magick/tasks/website.rake
|
data/MovieBot.gemspec
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = %q{MovieBot}
|
|
5
|
+
s.version = "0.0.4"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Scott Burton"]
|
|
9
|
+
s.date = %q{2009-01-18}
|
|
10
|
+
s.description = %q{A simple movie converter, queue and directory crawler, all in one!}
|
|
11
|
+
s.email = %q{scottburton11@gmail.com}
|
|
12
|
+
s.files = ["History.txt", "Manifest.txt", "MovieBot.gemspec", "README.txt", "VERSION.yml", "bin/movie_bot", "lib/movie_bot", "lib/movie_bot/image_converter.rb", "lib/movie_bot/movie_maker.rb", "lib/movie_bot/queue_manager.rb", "lib/movie_bot.rb", "test/test_movie_bot.rb", "spec/movie_bot_spec.rb", "spec/spec_helper.rb"]
|
|
13
|
+
s.homepage = %q{http://wiki.github.com/scottburton11/moviebot/home}
|
|
14
|
+
s.require_paths = ["lib"]
|
|
15
|
+
s.rubygems_version = %q{1.3.1}
|
|
16
|
+
s.summary = %q{A simple movie converter, queue and directory crawler, all in one!}
|
|
17
|
+
|
|
18
|
+
if s.respond_to? :specification_version then
|
|
19
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
20
|
+
s.specification_version = 2
|
|
21
|
+
|
|
22
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
23
|
+
else
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
end
|
|
27
|
+
end
|
data/README.txt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
= MovieBot
|
|
2
|
+
|
|
3
|
+
http://wiki.github.com/scottburton11/moviebot
|
|
4
|
+
|
|
5
|
+
== DESCRIPTION:
|
|
6
|
+
|
|
7
|
+
MovieBot is a wrapper for MEncoder, ffmpeg and Apple Compressor.
|
|
8
|
+
|
|
9
|
+
It provides simple command-line usage, remote control via Starling queue,
|
|
10
|
+
and directory crawling suitable for cron jobs and directory watchers.
|
|
11
|
+
|
|
12
|
+
== FEATURES/PROBLEMS:
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
== SYNOPSIS:
|
|
16
|
+
|
|
17
|
+
Regular Usage:
|
|
18
|
+
movie_bot /path/to/input.mov -o /path/to/output.mov
|
|
19
|
+
|
|
20
|
+
In regular mode, you specify the input and output files.
|
|
21
|
+
|
|
22
|
+
Queue Mode:
|
|
23
|
+
movie_bot -q host:port:queue_name -o /path/to/output/
|
|
24
|
+
|
|
25
|
+
In queue mode, you specify the Memcache queue and name you want
|
|
26
|
+
to watch, and an output directory for files.
|
|
27
|
+
|
|
28
|
+
Crawl Mode:
|
|
29
|
+
movie_bot /path/to/input -c -o /path/to/output
|
|
30
|
+
|
|
31
|
+
In crawl mode, you specify a directory to crawl and an output
|
|
32
|
+
directory for files.
|
|
33
|
+
|
|
34
|
+
== REQUIREMENTS:
|
|
35
|
+
|
|
36
|
+
ImageMagick
|
|
37
|
+
Mplayer/Mencoder
|
|
38
|
+
|
|
39
|
+
== INSTALL:
|
|
40
|
+
|
|
41
|
+
git clone git@github.com:scottburton11/moviebot.git
|
|
42
|
+
|
|
43
|
+
== LICENSE:
|
|
44
|
+
|
|
45
|
+
(The MIT License)
|
|
46
|
+
|
|
47
|
+
Copyright (c) 2008 Scott Burton
|
|
48
|
+
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
50
|
+
a copy of this software and associated documentation files (the
|
|
51
|
+
'Software'), to deal in the Software without restriction, including
|
|
52
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
53
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
54
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
55
|
+
the following conditions:
|
|
56
|
+
|
|
57
|
+
The above copyright notice and this permission notice shall be
|
|
58
|
+
included in all copies or substantial portions of the Software.
|
|
59
|
+
|
|
60
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
61
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
62
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
63
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
64
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
65
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
66
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/VERSION.yml
ADDED
data/bin/movie_bot
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# == Synopsis
|
|
4
|
+
# MovieBot converts movies. You can run it in regular mode by providing the
|
|
5
|
+
# input and output filenames. In queue mode, input filenames are provided
|
|
6
|
+
# by reading a MemCache queue. Crawl mode will compress movies in the input
|
|
7
|
+
# directory that aren't already in the output directory.
|
|
8
|
+
#
|
|
9
|
+
# == Examples
|
|
10
|
+
#
|
|
11
|
+
# movie_bot /path/to/input.mov -o /path/to/output.mov
|
|
12
|
+
# movie_bot -q -o /path/to/output/
|
|
13
|
+
# movie_bot /path/to/input -c -o /path/to/output
|
|
14
|
+
#
|
|
15
|
+
# == Usage
|
|
16
|
+
# reguglar mode: movie_bot [options] /path/to/input -o /path/to/output
|
|
17
|
+
# queue mode: movie_bot [options] -q -o /path/to/output
|
|
18
|
+
# crawl mode: movie_bot [options] /path/to/input -c -o /path/to/output
|
|
19
|
+
#
|
|
20
|
+
# For help use: movie_bot -h
|
|
21
|
+
|
|
22
|
+
# == Options
|
|
23
|
+
# -h, --help Displays help message
|
|
24
|
+
# -v, --version Display the version, then exit
|
|
25
|
+
# -Q, --quiet Output as little as possible, overrides verbose
|
|
26
|
+
# -V, --verbose Verbose output
|
|
27
|
+
# -o, --output Set an output location
|
|
28
|
+
# -q, --queue Operate in queue mode
|
|
29
|
+
# {host:port:queue_name}
|
|
30
|
+
# -c, --crawl Operate in crawl mode
|
|
31
|
+
#
|
|
32
|
+
#
|
|
33
|
+
# == Author
|
|
34
|
+
# Scott Burton
|
|
35
|
+
#
|
|
36
|
+
# == Copyright
|
|
37
|
+
# Copyright (c) 2008 Scott Burton. Licensed under the MIT License:
|
|
38
|
+
# http://www.opensource.org/licenses/mit-license.php
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
require File.join(File.dirname(__FILE__), '../init.rb')
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# Create and run the application
|
|
45
|
+
movie_bot = MovieBot.new(ARGV, STDIN)
|
|
46
|
+
movie_bot.run
|
data/lib/movie_bot.rb
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
|
|
6
|
+
require 'optparse'
|
|
7
|
+
require 'rdoc/usage'
|
|
8
|
+
require 'ostruct'
|
|
9
|
+
require 'date'
|
|
10
|
+
|
|
11
|
+
require 'starling'
|
|
12
|
+
|
|
13
|
+
class MovieBot
|
|
14
|
+
VERSION = '0.0.2'
|
|
15
|
+
|
|
16
|
+
attr_reader :options
|
|
17
|
+
|
|
18
|
+
def initialize(arguments, stdin)
|
|
19
|
+
@arguments = arguments
|
|
20
|
+
@stdin = stdin
|
|
21
|
+
|
|
22
|
+
# Set defaults
|
|
23
|
+
@options = OpenStruct.new
|
|
24
|
+
@options.verbose = false
|
|
25
|
+
@options.quiet = false
|
|
26
|
+
@options.output = ENV["PWD"]
|
|
27
|
+
@options.mode = "standard"
|
|
28
|
+
@options.queue_host = "127.0.0.1"
|
|
29
|
+
@options.queue_port = "22122"
|
|
30
|
+
@options.queue_name = "render"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Parse options, check arguments, then process the command
|
|
34
|
+
def run
|
|
35
|
+
|
|
36
|
+
if parsed_options? && arguments_valid?
|
|
37
|
+
|
|
38
|
+
puts "Start at #{DateTime.now}\n\n" if @options.verbose
|
|
39
|
+
|
|
40
|
+
output_options if @options.verbose # [Optional]
|
|
41
|
+
|
|
42
|
+
process_arguments
|
|
43
|
+
process_command
|
|
44
|
+
|
|
45
|
+
puts "\nFinished at #{DateTime.now}" if @options.verbose
|
|
46
|
+
|
|
47
|
+
else
|
|
48
|
+
output_usage
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
protected
|
|
54
|
+
|
|
55
|
+
def parsed_options?
|
|
56
|
+
|
|
57
|
+
# Specify options
|
|
58
|
+
opts = OptionParser.new
|
|
59
|
+
opts.on('-v', '--version') { output_version ; exit 0 }
|
|
60
|
+
opts.on('-h', '--help') { output_help }
|
|
61
|
+
opts.on('-V', '--verbose') { @options.verbose = true }
|
|
62
|
+
opts.on('-Q', '--quiet') { @options.quiet = true }
|
|
63
|
+
opts.on('-o', '--output FILE') { |path| @options.output = path }
|
|
64
|
+
opts.on('-q', '--queue HOST:PORT:NAME') {|queue| @options.mode = "queue"; @options.queue_host, @options.queue_port, @options.queue_name = queue.split(':') unless queue.empty?}
|
|
65
|
+
opts.on('-c', '--crawl') {@options.mode = "crawl"}
|
|
66
|
+
|
|
67
|
+
opts.parse!(@arguments) rescue return false
|
|
68
|
+
|
|
69
|
+
process_options
|
|
70
|
+
true
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Performs post-parse processing on options
|
|
74
|
+
def process_options
|
|
75
|
+
@options.verbose = false if @options.quiet
|
|
76
|
+
# @options.output = "#{@options.output}/#{File.basename(@options.input)}" if File.directory?(@options.output)
|
|
77
|
+
@options.output = "#{@options.output}" if (File.directory?(@options.output) && File.exists?(File.dirname(@options.output)))
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def output_options
|
|
81
|
+
puts "Options:\n"
|
|
82
|
+
|
|
83
|
+
@options.marshal_dump.each do |name, val|
|
|
84
|
+
puts " #{name} = #{val}"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# True if required arguments were provided
|
|
89
|
+
def arguments_valid?
|
|
90
|
+
|
|
91
|
+
# true if @arguments.length == 1 && (File.directory?(@options.output) || File.exists?(File.dirname(@options.output))) && File.directory?(@options.input)
|
|
92
|
+
case @options.mode
|
|
93
|
+
when "queue"
|
|
94
|
+
true if File.directory?(@options.output)
|
|
95
|
+
when "crawl"
|
|
96
|
+
true if File.directory?(@options.output) && File.directory?(@options.input?)
|
|
97
|
+
else
|
|
98
|
+
true if @arguments.length == 1
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Setup the arguments
|
|
103
|
+
def process_arguments
|
|
104
|
+
@options.input = @arguments.first
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def output_help
|
|
108
|
+
output_version
|
|
109
|
+
RDoc::usage() #exits app
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def output_usage
|
|
113
|
+
RDoc::usage('usage') # gets usage from comments above
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def output_version
|
|
117
|
+
puts "#{File.basename(__FILE__)} version #{VERSION}"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def process_command
|
|
121
|
+
|
|
122
|
+
case @options.mode
|
|
123
|
+
when "queue"
|
|
124
|
+
QueueRunner.new(@options.output, @options.queue_host, @options.queue_port, @options.queue_name)
|
|
125
|
+
when "crawl"
|
|
126
|
+
|
|
127
|
+
else
|
|
128
|
+
# images = ImageConverter.new(@options.input)
|
|
129
|
+
# images.convert
|
|
130
|
+
movie = MovieMaker.new(@options.input, @options.output)
|
|
131
|
+
movie.convert
|
|
132
|
+
end
|
|
133
|
+
#process_standard_input # [Optional]
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def process_standard_input
|
|
137
|
+
input = @stdin.read
|
|
138
|
+
# TO DO - process input
|
|
139
|
+
|
|
140
|
+
# [Optional]
|
|
141
|
+
#@stdin.each do |line|
|
|
142
|
+
# # TO DO - process each line
|
|
143
|
+
#end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# TO DO - Add your Modules, Classes, etc
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Create and run the application
|
|
152
|
+
# movie_bot = MovieBot.new(ARGV, STDIN)
|
|
153
|
+
# movie_bot.run
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
class ImageConverter
|
|
2
|
+
|
|
3
|
+
require "rmagick"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def initialize(home)
|
|
7
|
+
@home = Dir.open(home)
|
|
8
|
+
|
|
9
|
+
FileUtils.mkdir_p(["#{@home.path}/jpg"])
|
|
10
|
+
@jpg_dir = Dir.open("#{@home.path}/jpg")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def convert
|
|
14
|
+
comps.each do |comp|
|
|
15
|
+
image = ImMagick::Image.file(comp)
|
|
16
|
+
image.convert.resize("720x486!")
|
|
17
|
+
image.convert.quality("100")
|
|
18
|
+
ext = ".#{image.filename.split(".").last}"
|
|
19
|
+
image.save("#{@jpg_dir.path}/#{File.basename(image.filename, ext)}.jpg")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def comps
|
|
24
|
+
(Dir.entries(@home.path) - [".", ".."]).map {|file| File.expand_path(@home.path) + "/#{file}"}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def images
|
|
28
|
+
comps.map {|frame| ImMagick::Image.file(frame)}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
class Movie
|
|
2
|
+
def initialize(path)
|
|
3
|
+
@path = path
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def path
|
|
7
|
+
@path
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class ImageSequence
|
|
12
|
+
def initialize(path)
|
|
13
|
+
@path = path
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def images
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class Image
|
|
23
|
+
def initialize(path)
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.extensions
|
|
28
|
+
# %w"jpg png gif dpx pct bmp"
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class MovieMaker
|
|
33
|
+
|
|
34
|
+
def initialize(input, output)
|
|
35
|
+
if File.file?(input)
|
|
36
|
+
@builder = MencoderMovieCreator.new(input, output)
|
|
37
|
+
elsif File.directory?(input) && !Dir.entries(input).empty?
|
|
38
|
+
@builder = MencoderMovieFromImagesCreator.new(input, output)
|
|
39
|
+
else
|
|
40
|
+
raise RuntimeError
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def convert
|
|
45
|
+
@builder.convert
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def self.make_movie_from_images(frames_path, output_path)
|
|
50
|
+
jpg_dir = Dir.open("#{frames_path}")
|
|
51
|
+
jpgs = "#{jpg_dir.path}/*.jpg"
|
|
52
|
+
# system("mencoder mf://#{jpgs} \
|
|
53
|
+
# -mf w=720:h=486:fps=24:type=jpg \
|
|
54
|
+
# -ovc lavc \
|
|
55
|
+
# -lavcopts vcodec=mpeg4:mbd=2:trell:precmp=0:cmp=3:vbitrate=1200:vglobal=1:v4mv \
|
|
56
|
+
# -oac copy \
|
|
57
|
+
# -of lavf \
|
|
58
|
+
# -lavfopts format=mov \
|
|
59
|
+
# -o #{movie_path}/output.mov")
|
|
60
|
+
# system("mencoder mf://#{jpgs} \
|
|
61
|
+
# -mf w=1024:h=778:fps=24:type=jpg \
|
|
62
|
+
# -ovc raw \
|
|
63
|
+
# -of rawvideo \
|
|
64
|
+
# -o #{movie_path}/output.mov")
|
|
65
|
+
# system("mencoder mf://#{jpgs} \
|
|
66
|
+
# -mf w=2048:h=1556:fps=24:type=jpg \
|
|
67
|
+
# -ovc copy \
|
|
68
|
+
# -of lavf \
|
|
69
|
+
# -lavfopts format=mov \
|
|
70
|
+
# -vf scale=720:486 \
|
|
71
|
+
# -o #{movie_path}/output.mov ")
|
|
72
|
+
# system("mencoder mf://#{jpgs} \
|
|
73
|
+
# -mf w=720:h=486:fps=24 \
|
|
74
|
+
# -ovc copy \
|
|
75
|
+
# -of lavf \
|
|
76
|
+
# -lavfopts format=mov \
|
|
77
|
+
# -o #{movie_path}/output.mov ")
|
|
78
|
+
system("mencoder mf://#{jpgs} \
|
|
79
|
+
-mf w=720:h=486:fps=24 \
|
|
80
|
+
-ovc lavc \
|
|
81
|
+
-lavcopts vcodec=mjpeg \
|
|
82
|
+
-of lavf \
|
|
83
|
+
-lavfopts format=mov \
|
|
84
|
+
-o #{output_path} ")
|
|
85
|
+
# system("mencoder mf://#{jpgs} \
|
|
86
|
+
# -mf w=720:h=486:fps=24 \
|
|
87
|
+
# -ovc lavc \
|
|
88
|
+
# -lavcopts vcodec=qtrle \
|
|
89
|
+
# -ffourcc rle \
|
|
90
|
+
# -of lavf \
|
|
91
|
+
# -lavfopts format=mov \
|
|
92
|
+
# -o #{output_path} ")
|
|
93
|
+
# system("mencoder mf://#{jpgs} \
|
|
94
|
+
# -mf w=720:h=486:fps=24 \
|
|
95
|
+
# -ovc raw \
|
|
96
|
+
# -vf scale=720:486,format=yv12 \
|
|
97
|
+
# -of lavf \
|
|
98
|
+
# -lavfopts format=mov \
|
|
99
|
+
# -o #{output_path} ")
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
class MencoderMovieCreator
|
|
106
|
+
def initialize(input, output)
|
|
107
|
+
@input = Movie.new(input)
|
|
108
|
+
@output = "#{output}/#{File.basename(input)}"
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def convert
|
|
112
|
+
exec("mencoder #{@input.path} #{setting} -o #{@output}; exit 0")
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def setting
|
|
116
|
+
MencoderProfile.iphone
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
class MencoderMovieFromImagesCreator
|
|
122
|
+
def initialize(input, output)
|
|
123
|
+
@input = ImageSequence.new(input)
|
|
124
|
+
@output = output
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def convert
|
|
128
|
+
exec('mencoder mf://#{@input.images} #{setting} -o #{@output}; exit 0')
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def setting
|
|
132
|
+
MencoderProfile.mjpeg
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
class MencoderProfile
|
|
138
|
+
class << self
|
|
139
|
+
def iphone
|
|
140
|
+
"-lavfopts format=mp4 \
|
|
141
|
+
-oac faac=yes \
|
|
142
|
+
-faacopts mpeg=4:object=2:raw=yes:br=160 \
|
|
143
|
+
-ovc x264=yes \
|
|
144
|
+
-vf filmdint=crop=1904:1048:8:32,scale=480:-10,harddup,dsize=480:320:0 \
|
|
145
|
+
-x264encopts nocabac:level_idc=30:bframes=0:global_header=yes:threads=auto:subq=7:frameref=6:partitions=all:trellis=1:chroma_me=yes:me=umh:bitrate=1200 \
|
|
146
|
+
-fps 30000/1001 \
|
|
147
|
+
-ofps 24000/1001 \
|
|
148
|
+
-sws 9 \
|
|
149
|
+
-of lavf=yes"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def mjpeg
|
|
153
|
+
"-mf w=720:h=486:fps=24 \
|
|
154
|
+
-ovc lavc \
|
|
155
|
+
-lavcopts vcodec=mjpeg \
|
|
156
|
+
-of lavf \
|
|
157
|
+
-lavfopts format=mov"
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
class EndOfQueue < RuntimeError
|
|
2
|
+
end
|
|
3
|
+
|
|
4
|
+
class RunLimitReachedError < RuntimeError
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class MessageQueue
|
|
8
|
+
|
|
9
|
+
def initialize(host, port, queue)
|
|
10
|
+
@host = host
|
|
11
|
+
@port = port
|
|
12
|
+
@queue = queue
|
|
13
|
+
@m = Starling.new("#{@host}:#{@port}")
|
|
14
|
+
report_usage
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def next
|
|
18
|
+
begin
|
|
19
|
+
@m.get("#{@queue}")
|
|
20
|
+
rescue EndOfQueue => e
|
|
21
|
+
puts "#{e.message}"
|
|
22
|
+
raise e
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def report_usage
|
|
27
|
+
puts "MovieBot started in Queue Mode\nListening to host #{@host}:#{@port} for queue named '#{@queue}'\nType Ctrl-C to quit"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class QueueRunner
|
|
32
|
+
def initialize(output, host, port, queue)
|
|
33
|
+
@output = output
|
|
34
|
+
@mq = MessageQueue.new(host, port, queue)
|
|
35
|
+
run
|
|
36
|
+
end
|
|
37
|
+
def run
|
|
38
|
+
loop do
|
|
39
|
+
input = @mq.next
|
|
40
|
+
unless input.nil?
|
|
41
|
+
if fork.nil?
|
|
42
|
+
mov = MovieMaker.new(input, @output)
|
|
43
|
+
mov.convert
|
|
44
|
+
Process.wait
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
sleep 3
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class ProcessCount
|
|
53
|
+
def initialize
|
|
54
|
+
processes.select{ |process| true unless (process =~ %r|#{@command.split.first}|).nil? }.size
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def processes
|
|
58
|
+
`ps -axwww`
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
|
+
|
|
3
|
+
# describe MovieBot::ImageConverter do
|
|
4
|
+
# before(:each) do
|
|
5
|
+
# project_home = mock("project_home")
|
|
6
|
+
# project_home.should_receive(:path).and_return("/Users/scott/DMTH_examples/CL005_PLATE/")
|
|
7
|
+
# @image_converter = MovieBot::ImageConverter.new(project_home.path)
|
|
8
|
+
# end
|
|
9
|
+
#
|
|
10
|
+
# it "should have an array of paths to frames" do
|
|
11
|
+
# @image_converter.frames.should be_a_kind_of(Array)
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
#
|
|
15
|
+
# end
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
describe MovieBot, "main method" do
|
|
20
|
+
it "should description" do
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
File without changes
|
metadata
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: scottburton11-MovieBot
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Scott Burton
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-01-18 00:00:00 -08:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: A simple movie converter, queue and directory crawler, all in one!
|
|
17
|
+
email: scottburton11@gmail.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files: []
|
|
23
|
+
|
|
24
|
+
files:
|
|
25
|
+
- History.txt
|
|
26
|
+
- Manifest.txt
|
|
27
|
+
- MovieBot.gemspec
|
|
28
|
+
- README.txt
|
|
29
|
+
- VERSION.yml
|
|
30
|
+
- bin/movie_bot
|
|
31
|
+
- lib/movie_bot
|
|
32
|
+
- lib/movie_bot/image_converter.rb
|
|
33
|
+
- lib/movie_bot/movie_maker.rb
|
|
34
|
+
- lib/movie_bot/queue_manager.rb
|
|
35
|
+
- lib/movie_bot.rb
|
|
36
|
+
- test/test_movie_bot.rb
|
|
37
|
+
- spec/movie_bot_spec.rb
|
|
38
|
+
- spec/spec_helper.rb
|
|
39
|
+
has_rdoc: false
|
|
40
|
+
homepage: http://wiki.github.com/scottburton11/moviebot/home
|
|
41
|
+
post_install_message:
|
|
42
|
+
rdoc_options: []
|
|
43
|
+
|
|
44
|
+
require_paths:
|
|
45
|
+
- lib
|
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: "0"
|
|
51
|
+
version:
|
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: "0"
|
|
57
|
+
version:
|
|
58
|
+
requirements: []
|
|
59
|
+
|
|
60
|
+
rubyforge_project:
|
|
61
|
+
rubygems_version: 1.2.0
|
|
62
|
+
signing_key:
|
|
63
|
+
specification_version: 2
|
|
64
|
+
summary: A simple movie converter, queue and directory crawler, all in one!
|
|
65
|
+
test_files: []
|
|
66
|
+
|