vtt2ass 0.2.10 → 0.2.11
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 +0 -1
- data/lib/vtt2ass/ASSStyle.rb +3 -0
- data/lib/vtt2ass/ASSStyleParams.rb +1 -1
- data/lib/vtt2ass/Application.rb +0 -3
- data/lib/vtt2ass/VTTFile.rb +12 -6
- data/lib/vtt2ass/VTTLine.rb +1 -1
- data/lib/vtt2ass/version.rb +1 -1
- data/vtt2ass.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31678ee311f3ad71017e2960d227b8a572cbc45df381902e11631598a96558cd
|
4
|
+
data.tar.gz: 22b253a6b93847211744f26cdd368d32d6a22d2063997d21928f13e1016e53d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce253cfbefd7566a3de6554639428448e85fe1dbc8289ef1ae44aa0e627682bf7d2967e617ffd14de2e4fb418cf77208e896b27c06d0937e24d286aef01d29e
|
7
|
+
data.tar.gz: 38016a471e9dc9be1a19529e56f41bcbcd9fb0f104a51192e4951834e15e556f0cfaca81a741efdd87e3a0431292e9ce13e99bf59b54bd4aceadc5389f3d34e3
|
data/Gemfile
CHANGED
data/lib/vtt2ass/ASSStyle.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
2
|
# This class defines the ASS style parameters from VTT cue settings.
|
3
3
|
class ASSStyleParams
|
4
|
-
|
4
|
+
attr_accessor :horizontal_margin, :vertical_margin, :alignment, :align
|
5
5
|
|
6
6
|
##
|
7
7
|
# Creates an instance of ASSStyleParams
|
data/lib/vtt2ass/Application.rb
CHANGED
data/lib/vtt2ass/VTTFile.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
# Imports
|
2
|
-
require 'os'
|
3
|
-
|
4
1
|
# Relative imports
|
5
2
|
require_relative 'VTTLine'
|
6
3
|
|
@@ -14,16 +11,25 @@ class VTTFile
|
|
14
11
|
def initialize(file_path)
|
15
12
|
@title = File.basename(file_path).gsub('.vtt', '')
|
16
13
|
@lines = []
|
17
|
-
separator =
|
14
|
+
separator = determine_line_ending(file_path) ? "\n\n" : "\r\n\r\n"
|
15
|
+
count = 0
|
18
16
|
File.foreach(file_path, separator) do |paragraph|
|
19
|
-
paragraph = paragraph.rstrip.gsub(
|
17
|
+
paragraph = paragraph.rstrip.gsub(/[\r\n]/, "\n")
|
20
18
|
if not paragraph.eql? "" then
|
21
|
-
|
19
|
+
vtt_line = VTTLine.new(paragraph)
|
20
|
+
@lines.push(vtt_line)
|
21
|
+
count += 1
|
22
22
|
end
|
23
23
|
end
|
24
24
|
@lines.shift
|
25
25
|
end
|
26
26
|
|
27
|
+
def determine_line_ending(file_path)
|
28
|
+
File.open(file_path, 'r') do |file|
|
29
|
+
return file.readline[/\r?\n$/] == "\n"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
27
33
|
##
|
28
34
|
# This method writes the content of the VTTFile object into a file path that is provided.
|
29
35
|
def writeToFile(file_path)
|
data/lib/vtt2ass/VTTLine.rb
CHANGED
data/lib/vtt2ass/version.rb
CHANGED
data/vtt2ass.gemspec
CHANGED
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
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.11
|
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-
|
11
|
+
date: 2021-04-17 00:00:00.000000000 Z
|
12
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
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: htmlentities
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|