flatbed 0.0.2
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/README.markdown +5 -0
- data/Rakefile +80 -0
- data/lib/flatbed.rb +4 -0
- data/lib/flatbed/clip.rb +83 -0
- data/lib/flatbed/flatbed.rb +3 -0
- data/lib/flatbed/still_clip.rb +15 -0
- metadata +68 -0
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "rake/gempackagetask"
|
3
|
+
require "rake/rdoctask"
|
4
|
+
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
require "rake/testtask"
|
8
|
+
Rake::TestTask.new do |t|
|
9
|
+
t.libs = [File.expand_path("lib"), "test"]
|
10
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
+
t.verbose = true
|
12
|
+
end
|
13
|
+
|
14
|
+
# This builds the actual gem. For details of what all these options
|
15
|
+
# mean, and other ones you can add, check the documentation here:
|
16
|
+
#
|
17
|
+
# http://rubygems.org/read/chapter/20
|
18
|
+
#
|
19
|
+
spec = Gem::Specification.new do |s|
|
20
|
+
|
21
|
+
# Change these as appropriate
|
22
|
+
s.name = "flatbed"
|
23
|
+
s.version = "0.0.2"
|
24
|
+
s.summary = "A ruby library for video editing and assembly using ffmpeg"
|
25
|
+
s.author = "Marcus Rosentrater"
|
26
|
+
s.email = "marcus.rosentrater@gmail.com"
|
27
|
+
s.homepage = "http://github.com/meanmarcus/flatbed"
|
28
|
+
|
29
|
+
s.has_rdoc = false
|
30
|
+
# s.extra_rdoc_files = %w(Readme.markdown)
|
31
|
+
# s.rdoc_options = %w(--main Readme.markdown)
|
32
|
+
|
33
|
+
# Add any extra files to include in the gem
|
34
|
+
s.files = %w(Rakefile README.markdown) + Dir.glob("{lib}/**/*")
|
35
|
+
# s.executables = FileList["bin/**"].map { |f| File.basename(f) }
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
|
38
|
+
# If you want to depend on other gems, add them here, along with any
|
39
|
+
# relevant versions
|
40
|
+
# s.add_dependency("some_other_gem", "~> 0.1.0")
|
41
|
+
|
42
|
+
# If your tests use any gems, include them here
|
43
|
+
# s.add_development_dependency("shoulda")
|
44
|
+
# s.add_development_dependency("rspec")
|
45
|
+
# s.add_development_dependency("cucumber")
|
46
|
+
|
47
|
+
# If you want to publish automatically to rubyforge, you'll may need
|
48
|
+
# to tweak this, and the publishing task below too.
|
49
|
+
# s.rubyforge_project = "gem-this"
|
50
|
+
|
51
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3")
|
52
|
+
end
|
53
|
+
|
54
|
+
# This task actually builds the gem. We also regenerate a static
|
55
|
+
# .gemspec file, which is useful if something (i.e. GitHub) will
|
56
|
+
# be automatically building a gem for this project. If you're not
|
57
|
+
# using GitHub, edit as appropriate.
|
58
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
59
|
+
pkg.gem_spec = spec
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "Build the gemspec file #{spec.name}.gemspec"
|
63
|
+
task :gemspec do
|
64
|
+
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
|
65
|
+
File.open(file, "w") {|f| f << spec.to_ruby }
|
66
|
+
end
|
67
|
+
|
68
|
+
task :package => :gemspec
|
69
|
+
|
70
|
+
# Generate documentation
|
71
|
+
Rake::RDocTask.new do |rd|
|
72
|
+
rd.main = "Readme.markdown"
|
73
|
+
rd.rdoc_files.include("Readme.markdown", "lib/**/*.rb")
|
74
|
+
rd.rdoc_dir = "rdoc"
|
75
|
+
end
|
76
|
+
|
77
|
+
desc 'Clear out RDoc and generated packages'
|
78
|
+
task :clean => [:clobber_rdoc, :clobber_package] do
|
79
|
+
rm "#{spec.name}.gemspec"
|
80
|
+
end
|
data/lib/flatbed.rb
ADDED
data/lib/flatbed/clip.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Flatbed
|
4
|
+
class Clip
|
5
|
+
|
6
|
+
attr_accessor :clip, :clip_name, :source, :source_name
|
7
|
+
|
8
|
+
def initialize(clip, convert_from = nil)
|
9
|
+
set_source convert_from if convert_from
|
10
|
+
set_clip clip
|
11
|
+
end
|
12
|
+
|
13
|
+
def command
|
14
|
+
raise "No input file specified." if self.source.to_s.empty?
|
15
|
+
"ffmpeg #{format_options input_options}-i #{source} #{format_options output_options}#{clip}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def create
|
19
|
+
`#{command}`
|
20
|
+
end
|
21
|
+
|
22
|
+
def destroy
|
23
|
+
FileUtils.rm clip
|
24
|
+
end
|
25
|
+
|
26
|
+
def exists?
|
27
|
+
File.exists? clip
|
28
|
+
end
|
29
|
+
|
30
|
+
def options
|
31
|
+
@options ||= {
|
32
|
+
:input => {},
|
33
|
+
:output => {}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def input_options opts = {}
|
38
|
+
options[:input] ||= {}
|
39
|
+
options[:input].merge!(opts)
|
40
|
+
end
|
41
|
+
|
42
|
+
def input_options= opts
|
43
|
+
options[:input] = opts
|
44
|
+
end
|
45
|
+
|
46
|
+
def output_options opts = {}
|
47
|
+
options[:output] ||= {}
|
48
|
+
options[:output].merge!(opts)
|
49
|
+
end
|
50
|
+
|
51
|
+
def output_options= opts
|
52
|
+
options[:output] = opts
|
53
|
+
end
|
54
|
+
|
55
|
+
def set_clip(path)
|
56
|
+
self.clip = File.expand_path(path)
|
57
|
+
self.clip_name = clip.split("/").last
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_source(path)
|
61
|
+
self.source = File.expand_path(path)
|
62
|
+
self.source_name = source.split("/").last
|
63
|
+
end
|
64
|
+
|
65
|
+
def source_exists?
|
66
|
+
File.exists? source
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
def format_options(opts)
|
72
|
+
out = ""
|
73
|
+
opts.each do |h|
|
74
|
+
unless h[1]===false
|
75
|
+
out << "-#{h[0]} "
|
76
|
+
out << "#{h[1]} " unless h[1]===true
|
77
|
+
end
|
78
|
+
end
|
79
|
+
out
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flatbed
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Marcus Rosentrater
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-04-26 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: marcus.rosentrater@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- Rakefile
|
31
|
+
- README.markdown
|
32
|
+
- lib/flatbed/clip.rb
|
33
|
+
- lib/flatbed/flatbed.rb
|
34
|
+
- lib/flatbed/still_clip.rb
|
35
|
+
- lib/flatbed.rb
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/meanmarcus/flatbed
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 3
|
59
|
+
version: "1.3"
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.3.6
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: A ruby library for video editing and assembly using ffmpeg
|
67
|
+
test_files: []
|
68
|
+
|