akitaonrails-shift_subtitle 1.1.0

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.
@@ -0,0 +1,20 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'srt_time'))
3
+
4
+ describe "Shift Subtitle" do
5
+ before do
6
+ @srt_time = SrtTime.new(:operation => :"+", :amount => 2.5)
7
+ end
8
+
9
+ it "should be able to convert a file and compare to the static fixture" do
10
+ input_file = File.join(File.dirname(__FILE__), 'fixtures', 'input.srt')
11
+ output_file = File.join(File.dirname(__FILE__), 'fixtures', 'output.srt')
12
+
13
+ output_static = File.read(output_file)
14
+ output = ""
15
+ File.readlines(input_file).each do |line|
16
+ output << @srt_time.convert_line(line)
17
+ end
18
+ output_static.should == output
19
+ end
20
+ end
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ profile
4
+ --timeout
5
+ 20
6
+ --diff
@@ -0,0 +1,5 @@
1
+ require 'spec'
2
+ require 'spec/mocks'
3
+
4
+ Spec::Runner.configure do |config|
5
+ end
@@ -0,0 +1,25 @@
1
+ require File.join(File.dirname(__FILE__), 'spec_helper')
2
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'srt_time'))
3
+
4
+ describe SrtTime do
5
+ it "should be able to shift right the time adding a float amount" do
6
+ @srt_time = SrtTime.new(:operation => :"+", :amount => 1.6)
7
+ @srt_time.convert_time("00:00:01,500").should == "00:00:03,100"
8
+ @srt_time.convert_time("00:00:01,050").should == "00:00:02,650"
9
+ @srt_time.convert_time("00:01:24,051").should == "00:01:25,651"
10
+ @srt_time.convert_time("00:01:59,400").should == "00:02:01,000"
11
+ end
12
+
13
+ it "should be able to shift left the time subtracting a float amount" do
14
+ @srt_time = SrtTime.new(:operation => :"-", :amount => 1.6)
15
+ @srt_time.convert_time("00:00:01,500").should == "23:59:59,900"
16
+ @srt_time.convert_time("00:00:01,050").should == "23:59:59,450"
17
+ @srt_time.convert_time("00:01:24,051").should == "00:01:22,451"
18
+ @srt_time.convert_time("00:01:59,400").should == "00:01:57,800"
19
+ end
20
+
21
+ it "should convert a srt time range line in the correct format" do
22
+ @srt_time = SrtTime.new(:operation => :"+", :amount => 1.6)
23
+ @srt_time.convert_line("00:00:01,500 --> 00:00:02,100").should == "00:00:03,100 --> 00:00:03,700\n"
24
+ end
25
+ end
@@ -0,0 +1,41 @@
1
+ shift_subtitle_gemspec = Gem::Specification.new do |s|
2
+ s.name = %q{shift_subtitle}
3
+ s.version = SrtTime::VERSION::STRING
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Fabio Akita"]
7
+ s.date = %q{Time.now.strftime("%Y/%d/%m")}
8
+ s.default_executable = %q{shift_subtitle}
9
+ s.description = %q{Easy way to shift time from your SRT subtitle files.}
10
+ s.email = %q{fabioakita@gmail.com}
11
+ s.executables = ["shift_subtitle"]
12
+ s.files = Dir.glob("{bin,lib,spec,tasks}/**/*")
13
+ s.has_rdoc = false
14
+ s.homepage = %q{http://www.akitaonrails.com}
15
+ s.require_paths = ["lib"]
16
+ s.rubygems_version = %q{1.3.5}
17
+ s.summary = %q{Time shifter for SRT subtitles.}
18
+ end
19
+
20
+ Rake::GemPackageTask.new(shift_subtitle_gemspec) do |pkg|
21
+ pkg.gem_spec = shift_subtitle_gemspec
22
+ end
23
+
24
+ namespace :gem do
25
+ namespace :spec do
26
+ desc "Update shift_subtitle.gemspec"
27
+ task :generate do
28
+ File.open("shift_subtitle.gemspec", "w") do |f|
29
+ f.puts(shift_subtitle_gemspec.to_ruby)
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ desc "Generate package and install"
36
+ task :install => :package do
37
+ sh "sudo gem install --local pkg/shift_subtitle-#{SrtTime::VERSION::STRING}"
38
+ end
39
+
40
+ desc "Remove all generated artifacts"
41
+ task :clean => :clobber_package
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: akitaonrails-shift_subtitle
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Fabio Akita
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-21 00:00:00 -03:00
13
+ default_executable: shift_subtitle
14
+ dependencies: []
15
+
16
+ description: Easy way to shift time from your SRT subtitle files.
17
+ email: fabioakita@gmail.com
18
+ executables:
19
+ - shift_subtitle
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - bin/shift_subtitle
26
+ - bin/shift_subtitle.cmd
27
+ - lib/srt_time/version.rb
28
+ - lib/srt_time.rb
29
+ - spec/fixtures/input.srt
30
+ - spec/fixtures/output.srt
31
+ - spec/shift_subtitle_spec.rb
32
+ - spec/spec.opts
33
+ - spec/spec_helper.rb
34
+ - spec/srt_time_spec.rb
35
+ - tasks/gems.rake
36
+ has_rdoc: true
37
+ homepage: http://www.akitaonrails.com
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
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.5
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Time shifter for SRT subtitles.
64
+ test_files: []
65
+