vtt2ass 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e94988be1922e26d861f105404e3eff863a2df470aa3aa7fc5f35cdf26c3c71
4
- data.tar.gz: 055641cfd88eef119e3c623adbae16b9eb70a7091c26b13410d8b94c2c8e55ec
3
+ metadata.gz: d3959903aff7b00e3544a9656edf9a17f9508445db041d28518549926cca7a09
4
+ data.tar.gz: 51359298d3ff0ed985ce10f48b18c5f2b84eec19b267e0781cd2b6ef12320e22
5
5
  SHA512:
6
- metadata.gz: 785df255fc71e0479a8b124222e25033e2aca337765cdd17bf46c6ef0e11adae7fb854b01fa23959946f8d9ebd8bbfefcaf6cafc10b9a7089a52b11806f5e82a
7
- data.tar.gz: 9cd4940b1d5667136aa51d9bff670a2d98e4a966ee898110230c15d710c87898aaf596afd6a6c7173f0ef06cf26eb57e7f2b3acd1c670f95209d97be9c5d5480
6
+ metadata.gz: ae929a40df7f483e8bd76cc43920177d299756cfe9774fc850f0e7a66b877d74c40314d2d8647cabf6ba5b2c7e0743533ce9236873d28c86203a76c74c9628d8
7
+ data.tar.gz: 1a280a2a76c87e2678c6275b65c1226779799e61abd8b2909816897e5e44b18a649d0c0f364ae97249044593656120e823edf80f06836703963840321449d088
@@ -1,6 +1,6 @@
1
1
  # Relative imports
2
- require_relative 'VTTFile'
3
- require_relative 'ASSFile'
2
+ require_relative 'vtt_file'
3
+ require_relative 'ass_file'
4
4
 
5
5
  ##
6
6
  # Main application class that manages all the operations.
@@ -21,7 +21,7 @@ class Application
21
21
  end
22
22
  @quiet = options[:quiet]
23
23
  if options[:css] then
24
- @css = options[:css].gsub('\\', '/')
24
+ @css = options[:css].gsub('\\', '/').delete_suffix('/')
25
25
  end
26
26
  @line_offset = options[:line_offset]
27
27
  end
@@ -54,12 +54,21 @@ class Application
54
54
  # This method creates a new VTTFile object from the file path provided and convert its content
55
55
  # inside a new ASSFile object.
56
56
  def vtt_to_ass(file_path)
57
+ base_file_name = File.basename(file_path).gsub('.vtt', '')
58
+ css_file = nil
59
+ if defined?(@css) and File.directory?(@css) then
60
+ css_file = "#{@css}/#{base_file_name}.css"
61
+ elsif File.file?("#{file_path.gsub('.vtt', '')}.css") then
62
+ css_file = "#{file_path.gsub('.vtt', '')}.css"
63
+ else
64
+ css_file = @css
65
+ end
57
66
  vtt_file = VTTFile.new(file_path, @width, @height)
58
67
  ass_file = ASSFile.new(
59
- (defined?(@title) ? @title : File.basename(file_path).gsub('.vtt', '')),
68
+ (defined?(@title) ? @title : base_file_name),
60
69
  @width,
61
70
  @height,
62
- defined?(@css) ? @css : nil
71
+ css_file
63
72
  )
64
73
  ass_file.convertVTTtoASS(vtt_file, @font_family, @font_size, @line_offset)
65
74
  return ass_file
@@ -1,8 +1,8 @@
1
1
  # Relative imports
2
- require_relative 'ASSLine'
3
- require_relative 'ASSStyle'
4
- require_relative 'CSSFile'
5
- require_relative 'CSSRule'
2
+ require_relative 'ass_line'
3
+ require_relative 'ass_style'
4
+ require_relative 'css_file'
5
+ require_relative 'css_rule'
6
6
 
7
7
  ##
8
8
  # This class defines an ASS subtitle file.
File without changes
@@ -1,6 +1,6 @@
1
1
  # Relative imports
2
- require_relative 'ASSStyleParams'
3
- require_relative 'Validator'
2
+ require_relative 'ass_style_params'
3
+ require_relative 'validator'
4
4
  require 'redgreenblue'
5
5
 
6
6
  ##
@@ -1,5 +1,5 @@
1
1
  require 'css_parser'
2
- require_relative 'CSSRule'
2
+ require_relative 'css_rule'
3
3
 
4
4
  class CSSFile
5
5
  attr_reader :rules
File without changes
File without changes
@@ -4,5 +4,5 @@ module Vtt2ass
4
4
  ##
5
5
  # This is the version of the application.
6
6
  # This needs to be changed for each gem release.
7
- VERSION = "0.3.2"
7
+ VERSION = "0.3.3"
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # Relative imports
2
- require_relative 'VTTLine'
2
+ require_relative 'vtt_line'
3
3
 
4
4
  ##
5
5
  # This class defines a VTT subtile file.
File without changes
data/lib/vtt2ass.rb CHANGED
@@ -3,7 +3,7 @@ require 'thor'
3
3
 
4
4
  # Relative imports
5
5
  require_relative 'vtt2ass/version'
6
- require_relative 'vtt2ass/Application'
6
+ require_relative 'vtt2ass/application'
7
7
 
8
8
  class MainCommand < Thor
9
9
  def self.exit_on_failure?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vtt2ass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
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: 2022-04-30 00:00:00.000000000 Z
11
+ date: 2022-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities
@@ -153,17 +153,17 @@ files:
153
153
  - doc/top-level-namespace.html
154
154
  - exe/vtt2ass
155
155
  - lib/vtt2ass.rb
156
- - lib/vtt2ass/ASSFile.rb
157
- - lib/vtt2ass/ASSLine.rb
158
- - lib/vtt2ass/ASSStyle.rb
159
- - lib/vtt2ass/ASSStyleParams.rb
160
- - lib/vtt2ass/Application.rb
161
- - lib/vtt2ass/CSSFile.rb
162
- - lib/vtt2ass/CSSRule.rb
163
- - lib/vtt2ass/VTTFile.rb
164
- - lib/vtt2ass/VTTLine.rb
165
- - lib/vtt2ass/Validator.rb
156
+ - lib/vtt2ass/application.rb
157
+ - lib/vtt2ass/ass_file.rb
158
+ - lib/vtt2ass/ass_line.rb
159
+ - lib/vtt2ass/ass_style.rb
160
+ - lib/vtt2ass/ass_style_params.rb
161
+ - lib/vtt2ass/css_file.rb
162
+ - lib/vtt2ass/css_rule.rb
163
+ - lib/vtt2ass/validator.rb
166
164
  - lib/vtt2ass/version.rb
165
+ - lib/vtt2ass/vtt_file.rb
166
+ - lib/vtt2ass/vtt_line.rb
167
167
  - vtt2ass.gemspec
168
168
  homepage: https://gitlab.com/dkb-weeblets/vtt2ass
169
169
  licenses: