mirror of
https://github.com/amiaopensource/ffmprovisr.git
synced 2025-10-16 02:39:59 +02:00
proto outline functions
This commit is contained in:
5
app/controllers/ApplicationController.rb
Normal file
5
app/controllers/ApplicationController.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class ApplicationController < Sinatra::Base
|
||||
register Sinatra::ActiveRecordExtension
|
||||
set :session_secret, "my_application_secret"
|
||||
set :views, Proc.new { File.join(root, "../views/") }
|
||||
end
|
23
app/controllers/GenerateController.rb
Normal file
23
app/controllers/GenerateController.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class GenerateController < ApplicationController
|
||||
enable :sessions
|
||||
|
||||
get '/' do
|
||||
erb :'index'
|
||||
end
|
||||
|
||||
post '/' do
|
||||
@input = params[:input]
|
||||
# @output = params[:input][:video_format]
|
||||
# session['generate'] = params[:input]
|
||||
# @output = Generate.new(session['generate'])
|
||||
@middle = Generate.new(@input)
|
||||
@output = @middle.output
|
||||
erb :'generate'
|
||||
end
|
||||
|
||||
get '/generate' do
|
||||
erb :'index'
|
||||
end
|
||||
|
||||
|
||||
end
|
36
app/models/generate.rb
Normal file
36
app/models/generate.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
class Generate
|
||||
attr_reader :output, :input
|
||||
|
||||
def initialize(input)
|
||||
@input = input
|
||||
end
|
||||
|
||||
def output
|
||||
#concat this shit together
|
||||
"ffmpeg #{video_format} #{video_input} #{video_output}"
|
||||
end
|
||||
|
||||
def video_format
|
||||
if input[:video_format] == "mp4"
|
||||
"mp4"
|
||||
elsif input[:video_format] == "flv"
|
||||
"flv"
|
||||
elsif input[:video_format] == "h264"
|
||||
"h264"
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def video_input
|
||||
#TODO deny gracefully if not . format
|
||||
# if nil, mandelbrot
|
||||
"-i #{input[:video_input]}"
|
||||
end
|
||||
|
||||
def video_output
|
||||
#TODO deny gracefully if not . format
|
||||
input[:video_output]
|
||||
end
|
||||
|
||||
end
|
34
app/views/generate.erb
Normal file
34
app/views/generate.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<link href ="stylesheets/css/bootstrap.css" rel="stylesheet">
|
||||
<link href ="stylesheets/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<p>
|
||||
<form action="/" method="POST">
|
||||
Video format:
|
||||
<select name="input[video_format]">
|
||||
<option value="nil">Select video format</option>
|
||||
<option value="mp4">Mp4</option>
|
||||
<option value="h264">h264</option>
|
||||
<option value="flv">FLV</option>
|
||||
</select>
|
||||
<br /><br />
|
||||
Video input: <input type="text" name="input[video_input]">
|
||||
<br /><br />
|
||||
Video output: <input type="text" name="input[video_output]">
|
||||
<br /><br />
|
||||
<button type="submit" class="btn">Submit</button>
|
||||
|
||||
</form>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
Command: <textarea rows="1" cols="75" action="output">
|
||||
<%= @output %>
|
||||
</textarea>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
34
app/views/index.erb
Normal file
34
app/views/index.erb
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<link href ="stylesheets/css/bootstrap.css" rel="stylesheet">
|
||||
<link href ="stylesheets/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<p>
|
||||
<form action="/" method="POST">
|
||||
Video format:
|
||||
<select name="input[video_format]">
|
||||
<option value="nil">Select video format</option>
|
||||
<option value="mp4">Mp4</option>
|
||||
<option value="h264">h264</option>
|
||||
<option value="flv">FLV</option>
|
||||
</select>
|
||||
<br /><br />
|
||||
Video input: <input type="text" name="input[video_input]">
|
||||
<br /><br />
|
||||
Video output: <input type="text" name="input[video_output]">
|
||||
<br /><br />
|
||||
<button type="submit" class="btn">Submit</button>
|
||||
|
||||
</form>
|
||||
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
Command: <textarea rows="1" cols="75" action="output">
|
||||
<%= @output %>
|
||||
</textarea>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
Reference in New Issue
Block a user