mcutter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/Gemfile +8 -0
- data/Rakefile +2 -0
- data/bin/mcutter +3 -0
- data/lib/mcutter.rb +5 -0
- data/lib/mcutter/cli.rb +40 -0
- data/lib/mcutter/core_ext/misc.rb +27 -0
- data/lib/mcutter/version.rb +3 -0
- data/mcutter.gemspec +28 -0
- data/spec/cli_spec.rb +6 -0
- data/spec/misc_spec.rb +10 -0
- data/spec/spec_helper.rb +13 -0
- metadata +124 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/mcutter
ADDED
data/lib/mcutter.rb
ADDED
data/lib/mcutter/cli.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require "thor"
|
2
|
+
require "fileutils"
|
3
|
+
require "mcutter/core_ext/misc"
|
4
|
+
|
5
|
+
module MCutter
|
6
|
+
class CLI < Thor
|
7
|
+
include Thor::Actions
|
8
|
+
include FileUtils
|
9
|
+
|
10
|
+
default_task :cut
|
11
|
+
# class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
|
12
|
+
# class_option "verbose", :type => :boolean, :banner => "Enable verbose output mode", :aliases => "-V"
|
13
|
+
|
14
|
+
desc "cut", "Cut source files"
|
15
|
+
def cut
|
16
|
+
open('timeline.txt').each do |line|
|
17
|
+
file, starts_seconds, ends_seconds, ofile = *line.split(" ", 4)
|
18
|
+
duration_seconds = (ends_seconds.to_sec - starts_seconds.to_sec).to_hh_mm_ss
|
19
|
+
run "ffmpeg -i #{file} -threads 3 -y -vcodec copy -ss #{starts_seconds} -t #{duration_seconds} #{ofile}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "init", "Create timeline file & directories"
|
24
|
+
def init
|
25
|
+
mkdir_p "src"
|
26
|
+
mkdir_p "out"
|
27
|
+
touch "timeline.txt"
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def setup
|
33
|
+
MCutter.setup
|
34
|
+
end
|
35
|
+
|
36
|
+
def method_missing(name, *args)
|
37
|
+
$stderr.puts 'Could not find command "%s".' % name; exit 1
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Zero2
|
2
|
+
def zero2
|
3
|
+
(self / 10.0).to_s.gsub('.', '')
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
class Fixnum
|
8
|
+
include Zero2
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
class Float
|
13
|
+
include Zero2
|
14
|
+
def to_hh_mm_ss
|
15
|
+
mm, ss = self.divmod(60)
|
16
|
+
hh, mm = mm.divmod(60)
|
17
|
+
"#{hh.zero2}:#{mm.zero2}:#{ss.zero2}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class String
|
22
|
+
def to_sec
|
23
|
+
h, m, s = self.split(':', 3).map {|e| e.to_f}
|
24
|
+
h*3600 + m*60 + s
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
data/mcutter.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "mcutter/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "mcutter"
|
7
|
+
s.version = Mcutter::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Roman V. Babenko"]
|
10
|
+
s.email = ["romanvbabenko@gmail.com"]
|
11
|
+
s.homepage = "http://romanvbabenko.com"
|
12
|
+
s.summary = %q{Movie cutter}
|
13
|
+
s.description = %q{Just Movie cutter}
|
14
|
+
|
15
|
+
s.rubyforge_project = "mcutter"
|
16
|
+
|
17
|
+
s.add_dependency "thor"
|
18
|
+
|
19
|
+
s.add_development_dependency "bundler", ">= 1.0.0"
|
20
|
+
s.add_development_dependency "rspec", "~> 2.5.0"
|
21
|
+
s.add_development_dependency "fuubar"
|
22
|
+
s.add_development_dependency "autotest"
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
end
|
data/spec/cli_spec.rb
ADDED
data/spec/misc_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
$:.unshift File.expand_path('..', __FILE__)
|
4
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
5
|
+
|
6
|
+
require "mcutter"
|
7
|
+
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.mock_with :rspec
|
12
|
+
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mcutter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Roman V. Babenko
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-03-14 00:00:00 +02:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: thor
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.0.0
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.5.0
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: fuubar
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: autotest
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id005
|
71
|
+
description: Just Movie cutter
|
72
|
+
email:
|
73
|
+
- romanvbabenko@gmail.com
|
74
|
+
executables:
|
75
|
+
- mcutter
|
76
|
+
extensions: []
|
77
|
+
|
78
|
+
extra_rdoc_files: []
|
79
|
+
|
80
|
+
files:
|
81
|
+
- .gitignore
|
82
|
+
- Gemfile
|
83
|
+
- Rakefile
|
84
|
+
- bin/mcutter
|
85
|
+
- lib/mcutter.rb
|
86
|
+
- lib/mcutter/cli.rb
|
87
|
+
- lib/mcutter/core_ext/misc.rb
|
88
|
+
- lib/mcutter/version.rb
|
89
|
+
- mcutter.gemspec
|
90
|
+
- spec/cli_spec.rb
|
91
|
+
- spec/misc_spec.rb
|
92
|
+
- spec/spec_helper.rb
|
93
|
+
has_rdoc: true
|
94
|
+
homepage: http://romanvbabenko.com
|
95
|
+
licenses: []
|
96
|
+
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "0"
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project: mcutter
|
117
|
+
rubygems_version: 1.5.0
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Movie cutter
|
121
|
+
test_files:
|
122
|
+
- spec/cli_spec.rb
|
123
|
+
- spec/misc_spec.rb
|
124
|
+
- spec/spec_helper.rb
|