enigmamachine 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +82 -7
- data/VERSION +1 -1
- data/enigmamachine.gemspec +1 -1
- data/lib/enigmamachine.rb +3 -1
- data/lib/enigmamachine/views/index.erb +9 -10
- data/lib/enigmamachine/views/videos/video.erb +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -3,19 +3,94 @@
|
|
3
3
|
Enigmamachine is a video processor which queues and encodes videos according
|
4
4
|
to target profiles that you define. Videos must be on a locally mounted
|
5
5
|
filesystem. The processor takes the path to the video, and executes
|
6
|
-
|
6
|
+
one or more ffmpeg commands on the video. There is a handy web interface for
|
7
7
|
defining encoding tasks, and a restful web service which takes encoding commands.
|
8
8
|
|
9
9
|
Enigmamachine is written using Sinatra, Thin, and Eventmachine.
|
10
10
|
|
11
|
-
==
|
11
|
+
== Why would you want one?
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
If you're not running a server, you probably don't need enigmamachine, because
|
14
|
+
there are already lots of great client-side batch processors for all kinds of
|
15
|
+
different operating systems. However, if you are running a web application,
|
16
|
+
and you want to process uploaded video, enigmamachine offers you a convenient
|
17
|
+
fire-and-forget video encoder.
|
18
|
+
|
19
|
+
The main problem with encoding video on a server is that it takes a really,
|
20
|
+
really long time - you don't want to do it within the scope of a single HTTP
|
21
|
+
request, because you want the user's browser to return to their control as
|
22
|
+
soon as the upload is finished. If the video took ten minutes to upload,
|
23
|
+
you don't want to keep their browser (and your webapp) busy for a
|
24
|
+
further ten minutes while the encoding happens.
|
25
|
+
|
26
|
+
The right way to deal with the uploaded video is to fire up a new thread which
|
27
|
+
can take over responsibility for encoding the video, while your web app goes
|
28
|
+
on its merry way. Unfortunately, this is difficult in some languages (PHP, for
|
29
|
+
example, doesn't have lightweight threading support), and even in languages
|
30
|
+
with good threading support it still sort of sucks. With Enigmamachine, all you
|
31
|
+
need to do to trigger encoding of a video is shoot off an HTTP request, and
|
32
|
+
everything else is handled for you.
|
33
|
+
|
34
|
+
== Using it
|
35
|
+
|
36
|
+
Once you've installed the gem (see below), you can do something like:
|
37
|
+
|
38
|
+
mkdir enigma
|
39
|
+
cd enigma
|
40
|
+
enigmamachine start # -d to daemonize
|
41
|
+
|
42
|
+
Then check it out in your browser, at http://localhost:2002.
|
43
|
+
|
44
|
+
Your application receives a video, and you do an HTTP call like:
|
45
|
+
|
46
|
+
POST http://localhost:2002/videos
|
47
|
+
|
48
|
+
with the params:
|
49
|
+
|
50
|
+
params["video"] # the full path to a file on your local filesystem
|
51
|
+
params["encoder_id"] # the id of an encoder defined in your database
|
52
|
+
|
53
|
+
The enigmamachine will run all encoding tasks on the video. If a new video is
|
54
|
+
uploaded while the first one is still encoding, it will be placed in a queue.
|
55
|
+
Videos are encoded sequentially as they arrive.
|
56
|
+
|
57
|
+
== Encoders and Encoding Tasks
|
58
|
+
|
59
|
+
|
60
|
+
TODO
|
61
|
+
|
62
|
+
|
63
|
+
== Installation
|
64
|
+
|
65
|
+
Enigmamachine is written in Ruby and uses the Sinatra web framework, the
|
66
|
+
Datamapper ORM library, and the Eventmachine event-processing library. If
|
67
|
+
you're not a Ruby person, you don't need to care about any of this.
|
68
|
+
Enigmamachine can be triggered by any language that can send a POST request -
|
69
|
+
so all you PHPistas, python-lovers, droopy-moustachists, or blue-suited
|
70
|
+
java types can all use it just as easy as us fashionable-haircut-language
|
71
|
+
people.
|
72
|
+
|
73
|
+
You can install it as a gem by doing:
|
74
|
+
|
75
|
+
gem install enigmamachine
|
76
|
+
|
77
|
+
If this command doesn't make any sense to you, it's because you don't know that
|
78
|
+
"gems" are ruby code packages, somewhat like apt-get except for ruby code only.
|
79
|
+
You can install rubygems on righteous operating systems by typing
|
80
|
+
|
81
|
+
apt-get install rubygems # as root
|
82
|
+
|
83
|
+
Then "gem install " should theoretically work. You'll also need a copy of
|
84
|
+
ffmpeg installed and available in your path.
|
85
|
+
|
86
|
+
== Status
|
87
|
+
|
88
|
+
This thing is still pre-release.
|
89
|
+
|
90
|
+
I'm just working on getting the gem dependencies correct, so you may need to
|
91
|
+
manually install a few things to get it to work. You'll also need a working
|
92
|
+
copy of ffmpeg available on your path.
|
16
93
|
|
17
|
-
The biggest problem is that it was done on a whim (i.e. without test-first
|
18
|
-
development) since it was just a sketch at first - this needs to be fixed.
|
19
94
|
|
20
95
|
== Note on Patches/Pull Requests
|
21
96
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/enigmamachine.gemspec
CHANGED
data/lib/enigmamachine.rb
CHANGED
@@ -94,7 +94,7 @@ class EnigmaMachine < Sinatra::Base
|
|
94
94
|
# Shows the enigma status page.
|
95
95
|
#
|
96
96
|
get '/' do
|
97
|
-
@videos = Video.all(:limit => 50, :order => [:created_at.
|
97
|
+
@videos = Video.all(:limit => 50, :order => [:created_at.desc])
|
98
98
|
erb :index
|
99
99
|
end
|
100
100
|
|
@@ -156,6 +156,8 @@ class EnigmaMachine < Sinatra::Base
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
+
# Deletes an encoder
|
160
|
+
#
|
159
161
|
delete '/encoders/:id' do |id|
|
160
162
|
@encoder = Encoder.get(id)
|
161
163
|
@encoder.destroy!
|
@@ -1,13 +1,12 @@
|
|
1
1
|
<div class="post">
|
2
|
-
<h1 class="title">Your enigma machine</h1>
|
2
|
+
<h1 class="title">Your own enigma machine</h1>
|
3
3
|
<div class="entry">
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<% end %>
|
4
|
+
<% unless @videos.empty? %>
|
5
|
+
<p>Some recently added videos:</p>
|
6
|
+
<ul>
|
7
|
+
<%= partial :'videos/video', :collection => @videos %>
|
8
|
+
</ul>
|
9
|
+
<% end %>
|
11
10
|
</div>
|
12
|
-
</div>
|
13
|
-
|
11
|
+
</div>
|
12
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% video = videos_video %>
|
2
2
|
<li>
|
3
|
-
<%=h video.file %> -
|
4
|
-
created at <%=h video.created_at.strftime("%m/%d/%Y at %H:%M:%S")%><br/>
|
3
|
+
<strong><%= video.state %></strong> - <%=h video.file %> -
|
4
|
+
created at <%=h video.created_at.strftime("%m/%d/%Y at %H:%M:%S")%><br/>
|
5
5
|
</li>
|
6
6
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enigmamachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- dave
|