deepl-srt 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -1
- data/Gemfile.lock +1 -1
- data/deepl-srt.gemspec +2 -2
- data/lib/deepl_srt/srt_translate.rb +7 -1
- data/lib/deepl_srt/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc7aa689e44c0c210dea218cc96ff9d2ab6cf139cf23dbec6b8dd6185f579ab1
|
4
|
+
data.tar.gz: 62e5bf5c573f35b7ab1f0a24ea07f604a30df9693f5522de33d3b6d89a7bbf68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a97eb350ec054b2ba2e636b9942e04d5ed8a48c82dccd06892bdf046afac84727c691468739a0092e9addcbc4df8cb818165257fb02479980c0a369f289f335
|
7
|
+
data.tar.gz: a1ef9dc12ca8f9d7693f70a2d440202992c4cd2ff2251938297a89afc10956d619547d1e775a41ace816741e8a2404d2934c395dc8a354a6c2155dd8748acaa3
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/deepl-srt.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Łukasz Fuszara']
|
9
9
|
spec.email = ['lukasz@fuszara.pl']
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = '
|
11
|
+
spec.summary = 'Subtitles translator with DeepL engine'
|
12
|
+
spec.description = 'deepl_srt [api_key] [target_lang] [input path] [result_path]'
|
13
13
|
spec.homepage = 'https://github.com/lfuszara1/srt-deepl'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
|
@@ -27,11 +27,17 @@ class SrtTranslate
|
|
27
27
|
str << "#{index}\n"
|
28
28
|
str << "#{line.time_str}\n"
|
29
29
|
json = translate(line.text.join('\n'))
|
30
|
-
|
30
|
+
result = shorter(JSON.parse(json)['translations'][0]['text'])
|
31
|
+
str << "#{result}\n\n"
|
31
32
|
str
|
32
33
|
end
|
33
34
|
|
34
35
|
def translate(text)
|
35
36
|
@deepl_request.request(text, @target_lang).body
|
36
37
|
end
|
38
|
+
|
39
|
+
def shorter(line)
|
40
|
+
short = line.split.each_slice(6).map { |a| a.join ' ' }
|
41
|
+
short.join("\n")
|
42
|
+
end
|
37
43
|
end
|
data/lib/deepl_srt/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deepl-srt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Łukasz Fuszara
|
@@ -10,7 +10,7 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: deepl_srt [api_key] [target_lang] [input path] [result_path]
|
14
14
|
email:
|
15
15
|
- lukasz@fuszara.pl
|
16
16
|
executables:
|
@@ -64,5 +64,5 @@ requirements: []
|
|
64
64
|
rubygems_version: 3.2.15
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
|
-
summary:
|
67
|
+
summary: Subtitles translator with DeepL engine
|
68
68
|
test_files: []
|