vtt2ass 0.2.4 → 0.2.10
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +2 -1
- data/doc/ASSFile.html +546 -29
- data/doc/ASSLine.html +940 -0
- data/doc/ASSStyle.html +23 -147
- data/doc/ASSStyleParams.html +819 -0
- data/doc/Application.html +58 -149
- data/doc/VTTFile.html +454 -0
- data/doc/VTTLine.html +700 -0
- data/doc/Vtt2ass.html +61 -29
- data/doc/_index.html +12 -17
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +35 -8
- data/doc/index.html +35 -8
- data/doc/method_list.html +177 -49
- data/doc/top-level-namespace.html +3 -3
- data/lib/vtt2ass.rb +11 -8
- data/lib/vtt2ass/ASSFile.rb +41 -11
- data/lib/vtt2ass/{ASSSubtitle.rb → ASSLine.rb} +9 -7
- data/lib/vtt2ass/ASSStyle.rb +4 -64
- data/lib/vtt2ass/ASSStyleParams.rb +87 -0
- data/lib/vtt2ass/Application.rb +19 -53
- data/lib/vtt2ass/VTTFile.rb +42 -0
- data/lib/vtt2ass/{VTTSubtitle.rb → VTTLine.rb} +2 -2
- data/lib/vtt2ass/version.rb +6 -1
- data/vtt2ass.gemspec +7 -0
- metadata +81 -5
@@ -0,0 +1,42 @@
|
|
1
|
+
# Imports
|
2
|
+
require 'os'
|
3
|
+
|
4
|
+
# Relative imports
|
5
|
+
require_relative 'VTTLine'
|
6
|
+
|
7
|
+
##
|
8
|
+
# This class defines a VTT subtile file.
|
9
|
+
class VTTFile
|
10
|
+
attr_accessor :lines
|
11
|
+
|
12
|
+
##
|
13
|
+
# Creates a new VTTFile instance and assigns the default values of instance variables.
|
14
|
+
def initialize(file_path)
|
15
|
+
@title = File.basename(file_path).gsub('.vtt', '')
|
16
|
+
@lines = []
|
17
|
+
separator = OS.posix? ? "\r\n\r\n": "\n\n"
|
18
|
+
File.foreach(file_path, separator) do |paragraph|
|
19
|
+
paragraph = paragraph.rstrip.gsub(/\r\n/, "\n")
|
20
|
+
if not paragraph.eql? "" then
|
21
|
+
@lines.push(VTTLine.new(paragraph))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
@lines.shift
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# This method writes the content of the VTTFile object into a file path that is provided.
|
29
|
+
def writeToFile(file_path)
|
30
|
+
File.open(file_path, 'w') do |line|
|
31
|
+
line.print "\ufeff"
|
32
|
+
line.puts self.to_s
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# This method concatenates the object data in the right order for a string output.
|
38
|
+
def to_s
|
39
|
+
return "WEBVTT\n\n\n" + @lines
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
##
|
2
2
|
# This class defines a VTT subtile line.
|
3
|
-
class
|
3
|
+
class VTTLine
|
4
4
|
attr_reader :style, :time_start, :time_end, :params, :text
|
5
5
|
|
6
6
|
##
|
7
|
-
# This method creates an instance of an
|
7
|
+
# This method creates an instance of an VTTLine.
|
8
8
|
#
|
9
9
|
# * Requires +paragraph+, a VTT formatted string as input.
|
10
10
|
def initialize(paragraph)
|
data/lib/vtt2ass/version.rb
CHANGED
data/vtt2ass.gemspec
CHANGED
@@ -24,4 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_dependency 'os'
|
29
|
+
spec.add_dependency 'htmlentities'
|
30
|
+
|
31
|
+
spec.add_development_dependency 'rake'
|
32
|
+
spec.add_development_dependency 'minitest'
|
33
|
+
spec.add_development_dependency 'yard'
|
27
34
|
end
|
metadata
CHANGED
@@ -1,15 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vtt2ass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis-Philippe Fortin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
12
|
-
dependencies:
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: os
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: htmlentities
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
13
83
|
description:
|
14
84
|
email:
|
15
85
|
- timemaster.lpf@gmail.com
|
@@ -27,9 +97,13 @@ files:
|
|
27
97
|
- bin/run
|
28
98
|
- bin/setup
|
29
99
|
- doc/ASSFile.html
|
100
|
+
- doc/ASSLine.html
|
30
101
|
- doc/ASSStyle.html
|
102
|
+
- doc/ASSStyleParams.html
|
31
103
|
- doc/ASSSubtitle.html
|
32
104
|
- doc/Application.html
|
105
|
+
- doc/VTTFile.html
|
106
|
+
- doc/VTTLine.html
|
33
107
|
- doc/VTTSubtitle.html
|
34
108
|
- doc/Vtt2ass.html
|
35
109
|
- doc/Vtt2ass/Error.html
|
@@ -50,10 +124,12 @@ files:
|
|
50
124
|
- exe/vtt2ass
|
51
125
|
- lib/vtt2ass.rb
|
52
126
|
- lib/vtt2ass/ASSFile.rb
|
127
|
+
- lib/vtt2ass/ASSLine.rb
|
53
128
|
- lib/vtt2ass/ASSStyle.rb
|
54
|
-
- lib/vtt2ass/
|
129
|
+
- lib/vtt2ass/ASSStyleParams.rb
|
55
130
|
- lib/vtt2ass/Application.rb
|
56
|
-
- lib/vtt2ass/
|
131
|
+
- lib/vtt2ass/VTTFile.rb
|
132
|
+
- lib/vtt2ass/VTTLine.rb
|
57
133
|
- lib/vtt2ass/version.rb
|
58
134
|
- vtt2ass.gemspec
|
59
135
|
homepage: https://gitlab.com/dkb-weeblets/vtt2ass
|