vtt2ass 0.2.8 → 0.2.9
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/README.md +1 -0
- data/lib/vtt2ass.rb +3 -0
- data/lib/vtt2ass/Application.rb +9 -2
- data/lib/vtt2ass/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b91fbc9f2fc64b1fb2fe4e981c02a9f1c30916b53e3447ceb271d8f04962178
|
4
|
+
data.tar.gz: 12c4c09991e48d86904b40566c9e11059427822eb152cd1f41a095187edcad9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f7e485f5302ad380cbd9514ebfd661dcec6a5f4c73dcee87266d1c06219f277c670552f58bd15f0884e631b7e37328c710b1b5ae0f3505bf431db609c9ce6ab
|
7
|
+
data.tar.gz: 1cbd943d67c01bac59987028ceb25127f6f6d5888ad0c96148c48698ec411d27006683b257daae76c43eb24dbec3fdc9464e14633e288f687872f2fde3672f5f
|
data/README.md
CHANGED
@@ -42,6 +42,7 @@ Specific options:
|
|
42
42
|
-o, --output PATH Specify a custom output directory (default: './')
|
43
43
|
-f, --font-family FONT Specify a font family for the subtitles (default: 'Open Sans Semibold')
|
44
44
|
-s, --font-size SIZE Specify a font size for the subtitles (default: 52)
|
45
|
+
-t, --title TITLE Specify a title for you file. If the input is a directory, all files will share the same title.
|
45
46
|
-v, --version Show version
|
46
47
|
```
|
47
48
|
|
data/lib/vtt2ass.rb
CHANGED
@@ -29,6 +29,9 @@ module Vtt2ass
|
|
29
29
|
opts.on("-s", "--font-size SIZE", Integer, "Specify a font size for the subtitles (default: 52)") do |font_size|
|
30
30
|
options[:font_size] = font_size
|
31
31
|
end
|
32
|
+
opts.on("-t", "--title TITLE", String, "Specify a title for you file. If the input is a directory, all files will share the same title.") do |title|
|
33
|
+
options[:title] = title
|
34
|
+
end
|
32
35
|
opts.on("-v", "--version", "Show version") do
|
33
36
|
puts Vtt2ass::VERSION
|
34
37
|
exit
|
data/lib/vtt2ass/Application.rb
CHANGED
@@ -19,6 +19,9 @@ class Application
|
|
19
19
|
@height = 1080
|
20
20
|
@font_family = options[:font_family] ? options[:font_family] : 'Open Sans Semibold'
|
21
21
|
@font_size = options[:font_size] ? options[:font_size] : 52
|
22
|
+
if options[:title] then
|
23
|
+
@title = options[:title]
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
##
|
@@ -28,7 +31,7 @@ class Application
|
|
28
31
|
def start
|
29
32
|
if File.directory?(@input) then
|
30
33
|
Dir["#{@input}/*.vtt"].each do |file_path|
|
31
|
-
vtt_to_ass(file_path).writeToFile(File.basename(file_path).gsub('.vtt', '.ass'))
|
34
|
+
vtt_to_ass(file_path).writeToFile(@output + File.basename(file_path).gsub('.vtt', '.ass'))
|
32
35
|
end
|
33
36
|
elsif File.file?(@input) then
|
34
37
|
vtt_to_ass(@input).writeToFile(@output + File.basename(@input).gsub('.vtt', '.ass'))
|
@@ -39,7 +42,11 @@ class Application
|
|
39
42
|
|
40
43
|
def vtt_to_ass(file_path)
|
41
44
|
vtt_file = VTTFile.new(file_path)
|
42
|
-
ass_file = ASSFile.new(
|
45
|
+
ass_file = ASSFile.new(
|
46
|
+
(defined?(@title) ? @title : File.basename(file_path).gsub('.vtt', '')),
|
47
|
+
@width,
|
48
|
+
@height
|
49
|
+
)
|
43
50
|
ass_file.convertVTTtoASS(vtt_file, @font_family, @font_size)
|
44
51
|
return ass_file
|
45
52
|
end
|
data/lib/vtt2ass/version.rb
CHANGED