encoder-tools 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -23
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -10
- data/Gemfile.lock +37 -83
- data/LICENSE +1 -1
- data/README.md +14 -0
- data/Rakefile +3 -43
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/encoder-tools.gemspec +28 -0
- data/lib/encoder-tools.rb +1 -0
- data/lib/encoder-tools/cli.rb +23 -12
- data/lib/encoder-tools/cli/subtitles.rb +1 -0
- data/lib/encoder-tools/cli/subtitles/base.rb +26 -3
- data/lib/encoder-tools/cli/subtitles/fix_lengths.rb +35 -21
- data/lib/encoder-tools/cli/subtitles/offset.rb +33 -12
- data/lib/encoder-tools/cli/subtitles/renumber.rb +3 -1
- data/lib/encoder-tools/cli/subtitles/spell_check.rb +73 -0
- data/lib/encoder-tools/subtitles/list.rb +5 -0
- data/lib/encoder-tools/subtitles/parser.rb +1 -1
- data/lib/encoder-tools/subtitles/subtitle.rb +9 -2
- data/lib/encoder-tools/util.rb +5 -0
- data/lib/encoder-tools/util/text_reader.rb +26 -0
- data/lib/encoder-tools/version.rb +3 -0
- metadata +95 -96
- data/README.rdoc +0 -17
- data/VERSION +0 -1
- data/spec/cli/subtitles/fix_lengths_spec.rb +0 -51
- data/spec/cli/subtitles/offset_spec.rb +0 -40
- data/spec/cli/subtitles/renumber_spec.rb +0 -23
- data/spec/fixtures/subtitles/adjusted-long-subtitles.srt +0 -16
- data/spec/fixtures/subtitles/bad-numbering-corrected.srt +0 -16
- data/spec/fixtures/subtitles/bad-numbering.srt +0 -16
- data/spec/fixtures/subtitles/kill-bill-vol-2.srt +0 -345
- data/spec/fixtures/subtitles/no-long-subtitles.srt +0 -16
- data/spec/fixtures/subtitles/short-example-offset-2.srt +0 -16
- data/spec/fixtures/subtitles/short-example-offset-minus-2.srt +0 -16
- data/spec/fixtures/subtitles/short-example-offset-plus-2.srt +0 -16
- data/spec/fixtures/subtitles/short-example.srt +0 -16
- data/spec/fixtures/subtitles/some-long-subtitles.srt +0 -16
- data/spec/options/title_spec.rb +0 -41
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -31
- data/spec/strategies/movie_spec.rb +0 -23
- data/spec/subtitles/list_spec.rb +0 -57
- data/spec/subtitles/subtitle_spec.rb +0 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f641df19d56f6051f909ba5955585d57b66665f4
|
4
|
+
data.tar.gz: e94a3bc3bea90990ba06106ae70c2c1bc40adbfd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5785981b9444bd76c50a4f36cf0006f5e0830c50f34e1d6ce299a339b43a602c8e7fd90043d1e3d748e548d461ea7fd819a93ed741471a62ad3f3434b95c684
|
7
|
+
data.tar.gz: 34aa7adc0d624e4013373e29808024f296099041fc90729c2c838ff07f5ca3283bcf310af789b4915fbe6160652e3109779ff43dddaf2d8196748dd8e0dbf71c
|
data/.gitignore
CHANGED
@@ -1,23 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
pkg
|
20
|
-
|
21
|
-
## PROJECT::SPECIFIC
|
22
|
-
.bundle
|
23
|
-
encoder-tools.gemspec
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
/vendor/
|
10
|
+
|
11
|
+
# rspec failure tracking
|
12
|
+
.rspec_status
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at me@brian-donovan.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
CHANGED
@@ -1,12 +1,6 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
gem "rake"
|
8
|
-
gem "yard"
|
9
|
-
gem "rspec", "~>1.3.0"
|
10
|
-
gem "bundler", "~>0.9.4"
|
11
|
-
gem "ruby-debug"
|
12
|
-
end
|
5
|
+
# Specify your gem's dependencies in encoder-tools.gemspec
|
6
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,83 +1,37 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
- bundler
|
39
|
-
jeweler:
|
40
|
-
group:
|
41
|
-
- :test
|
42
|
-
version: ">= 0"
|
43
|
-
require:
|
44
|
-
- jeweler
|
45
|
-
specs:
|
46
|
-
- json_pure:
|
47
|
-
version: 1.2.0
|
48
|
-
- bundler:
|
49
|
-
version: 0.9.4
|
50
|
-
- git:
|
51
|
-
version: 1.2.5
|
52
|
-
- linecache:
|
53
|
-
version: "0.43"
|
54
|
-
- ruby-debug-base:
|
55
|
-
version: 0.10.3
|
56
|
-
- json:
|
57
|
-
version: 1.1.9
|
58
|
-
- net-ssh:
|
59
|
-
version: 2.0.15
|
60
|
-
- net-scp:
|
61
|
-
version: 1.0.1
|
62
|
-
- gemcutter:
|
63
|
-
version: 0.1.3
|
64
|
-
- rspec:
|
65
|
-
version: 1.3.0
|
66
|
-
- yard:
|
67
|
-
version: 0.5.3
|
68
|
-
- rubyforge:
|
69
|
-
version: 2.0.3
|
70
|
-
- jeweler:
|
71
|
-
version: 1.4.0
|
72
|
-
- thor:
|
73
|
-
version: 0.13.1
|
74
|
-
- rake:
|
75
|
-
version: 0.8.7
|
76
|
-
- columnize:
|
77
|
-
version: 0.3.1
|
78
|
-
- ruby-debug:
|
79
|
-
version: 0.10.3
|
80
|
-
hash: 075129d1fa532f8d303254e1ef70185e252d1ce4
|
81
|
-
sources:
|
82
|
-
- Rubygems:
|
83
|
-
uri: http://gemcutter.org
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
encoder-tools (1.0.0)
|
5
|
+
thor (~> 0.18.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
rake (10.1.1)
|
12
|
+
rspec (3.7.0)
|
13
|
+
rspec-core (~> 3.7.0)
|
14
|
+
rspec-expectations (~> 3.7.0)
|
15
|
+
rspec-mocks (~> 3.7.0)
|
16
|
+
rspec-core (3.7.0)
|
17
|
+
rspec-support (~> 3.7.0)
|
18
|
+
rspec-expectations (3.7.0)
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
+
rspec-support (~> 3.7.0)
|
21
|
+
rspec-mocks (3.7.0)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.7.0)
|
24
|
+
rspec-support (3.7.0)
|
25
|
+
thor (0.18.1)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bundler (~> 1.16)
|
32
|
+
encoder-tools!
|
33
|
+
rake (~> 10.0)
|
34
|
+
rspec (~> 3.0)
|
35
|
+
|
36
|
+
BUNDLED WITH
|
37
|
+
1.16.0
|
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoder-tools
|
2
|
+
|
3
|
+
Tools for ripping, encoding, and subtitling movies and TV shows.
|
4
|
+
|
5
|
+
|
6
|
+
### Pull Requests
|
7
|
+
|
8
|
+
Contributions via pull requests are very welcome! Follow the steps in
|
9
|
+
Developing above, then add your feature or bugfix with tests to cover it, push
|
10
|
+
to a branch, and open a pull request.
|
11
|
+
|
12
|
+
### Copyright
|
13
|
+
|
14
|
+
Copyright (c) 2014 Brian Donovan. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,46 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
3
|
|
4
|
-
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "encoder-tools"
|
8
|
-
gem.summary = %Q{Some tools to make encoding from DVDs easier}
|
9
|
-
gem.description = %Q{Tools for ripping, encoding, and subtitling movies and TV shows}
|
10
|
-
gem.email = "brian.donovan@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/eventualbuddha/encoder-tools"
|
12
|
-
gem.authors = ["Brian Donovan"]
|
13
|
-
gem.add_dependency "thor", ">= 0"
|
14
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
-
gem.add_development_dependency "yard", ">= 0"
|
16
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
-
end
|
18
|
-
Jeweler::GemcutterTasks.new
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
-
end
|
22
|
-
|
23
|
-
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
28
|
-
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
34
|
-
|
35
|
-
task :spec => :check_dependencies
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
36
5
|
|
37
6
|
task :default => :spec
|
38
|
-
|
39
|
-
begin
|
40
|
-
require 'yard'
|
41
|
-
YARD::Rake::YardocTask.new
|
42
|
-
rescue LoadError
|
43
|
-
task :yardoc do
|
44
|
-
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
45
|
-
end
|
46
|
-
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "encoder/tools"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "encoder-tools/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "encoder-tools"
|
8
|
+
spec.version = EncoderTools::VERSION
|
9
|
+
spec.authors = ["Brian Donovan"]
|
10
|
+
spec.email = ["me@brian-donovan.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Tools for ripping, encoding, and subtitling movies and TV shows}
|
13
|
+
spec.description = %q{Tools for ripping, encoding, and subtitling movies and TV shows}
|
14
|
+
spec.homepage = "https://github.com/eventualbuddha/encoder-tools"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "thor", "~> 0.18.1"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
+
end
|
data/lib/encoder-tools.rb
CHANGED
data/lib/encoder-tools/cli.rb
CHANGED
@@ -1,30 +1,41 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require 'thor/group'
|
3
2
|
|
4
3
|
module EncoderTools
|
5
4
|
class CLI < Thor
|
6
|
-
autoload :Base,
|
7
|
-
autoload :Subtitles,
|
5
|
+
autoload :Base, 'encoder-tools/cli/base'
|
6
|
+
autoload :Subtitles, 'encoder-tools/cli/subtitles'
|
8
7
|
|
9
|
-
desc "renumber [--input
|
8
|
+
desc "renumber [--input=FILE] [--output=FILE]", "Renumber badly-numbered SRT subtitle text"
|
10
9
|
method_option :input, :type => :string, :required => false, :aliases => %w[-i]
|
11
10
|
method_option :output, :type => :string, :required => false, :aliases => %w[-o]
|
12
11
|
def renumber
|
13
12
|
CLI::Subtitles::Renumber.run(self, options)
|
14
13
|
end
|
15
14
|
|
16
|
-
desc "offset [--
|
17
|
-
method_option :input,
|
18
|
-
method_option :output,
|
19
|
-
|
20
|
-
|
15
|
+
desc "offset [--set OFFSET] [--add OFFSET] [--subtract OFFSET]", "Change the SRT subtitle offset to OFFSET or by +/-OFFSET"
|
16
|
+
method_option :input, :type => :string, :required => false, :aliases => %w[-i]
|
17
|
+
method_option :output, :type => :string, :required => false, :aliases => %w[-o]
|
18
|
+
method_option :set, :type => :string, :required => false
|
19
|
+
method_option :add, :type => :string, :required => false
|
20
|
+
method_option :subtract, :type => :string, :required => false
|
21
|
+
def offset
|
22
|
+
CLI::Subtitles::Offset.run(self, options)
|
21
23
|
end
|
22
24
|
|
23
|
-
desc "fix-lengths
|
24
|
-
method_option :input,
|
25
|
-
method_option :output,
|
25
|
+
desc "fix-lengths", "Interactively fix subtitle lengths over N seconds (defaults to #{CLI::Subtitles::FixLengths::DEFAULT_THRESHOLD})"
|
26
|
+
method_option :input, :type => :string, :required => true, :aliases => %w[-i]
|
27
|
+
method_option :output, :type => :string, :required => true, :aliases => %w[-o]
|
28
|
+
method_option :threshold, :type => :numeric, :required => true, :aliases => %w[-t], :default => CLI::Subtitles::FixLengths::DEFAULT_THRESHOLD
|
26
29
|
def fix_lengths
|
27
30
|
CLI::Subtitles::FixLengths.run(self, options)
|
28
31
|
end
|
32
|
+
|
33
|
+
desc "spell-check [--dict DICT]", "Fix spelling in the subtitle file"
|
34
|
+
method_option :input, :type => :string, :required => false, :aliases => %w[-i]
|
35
|
+
method_option :output, :type => :string, :required => false, :aliases => %w[-o]
|
36
|
+
method_option :dict, :type => :string, :required => false, :aliases => %w[-d]
|
37
|
+
def spell_check
|
38
|
+
CLI::Subtitles::SpellCheck.run(self, options)
|
39
|
+
end
|
29
40
|
end
|
30
41
|
end
|