titlekit 1.1.0 → 1.2.0
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 +4 -4
- data/bin/titlekit +15 -11
- data/lib/titlekit/version.rb +1 -1
- metadata +1 -3
- data/bin/template_job.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daba468f20a7f7d7cef392ee6469b2b3c8f21bd6
|
4
|
+
data.tar.gz: 83ad88d2d77442f19af7a6adf435f567c6936aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44a1f50dfd96ee8f4c0b8023e782cff367329c4df8b11aa3de27ad4be28e71fd3f0ed3f525953ddc51e48e1a7050f25d23931edacaedbc738e19232732a56113
|
7
|
+
data.tar.gz: 2ab38376f98f319cc14a2b4f103195df08ef61e4c5f53941c23a68432e54d78a4fdd79746467ab101ada8b0581f880a4a9d076628ca2e6f3284f3ea93f090616
|
data/README.md
CHANGED
@@ -43,13 +43,13 @@ unknown encoding)
|
|
43
43
|
end
|
44
44
|
```
|
45
45
|
|
46
|
-
### Template
|
46
|
+
### Commandline Template Generator
|
47
47
|
|
48
|
-
To get you started quickly with
|
48
|
+
To get you started quickly with edit scripts for subtitles, you can use a console command provided by Titlekit:
|
49
49
|
|
50
|
-
$ titlekit
|
50
|
+
$ titlekit templates
|
51
51
|
|
52
|
-
|
52
|
+
If there are no subtitle files present in your current directory, this will generate a file called `process_generic.rb`, if there are subtitle files present, it will generate a file called `process_[your-subtitle-filename].rb` for each subtitle file that was found. In either case all of these files will contain a basic but complete scaffolding script for processing your subtitle file with Titlekit. In the case of the non-generic templates, they will already contain the correct filename for the input file. Together with some concise in-line comments, these templates are meant to help you quickly start off with your task.
|
53
53
|
|
54
54
|
### All features by example
|
55
55
|
|
data/bin/titlekit
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
if ARGV.length > 0 && ARGV[0] == 'template'
|
3
|
+
if ARGV.length > 0 && (ARGV[0] == 'template' || ARGV[0] == 'templates')
|
4
4
|
|
5
|
-
|
5
|
+
filenames = []
|
6
|
+
filenames += Dir.glob('**/*.srt')
|
7
|
+
filenames += Dir.glob('**/*.ssa')
|
8
|
+
filenames += Dir.glob('**/*.ass')
|
9
|
+
filenames += ['generic.srt'] if filenames.empty?
|
6
10
|
|
7
|
-
|
11
|
+
filenames.each do |filename|
|
12
|
+
|
13
|
+
content = <<HERETEMPLATE
|
8
14
|
require 'titlekit'
|
9
15
|
|
10
16
|
job = Titlekit::Job.new
|
@@ -12,7 +18,7 @@ job = Titlekit::Job.new
|
|
12
18
|
job.have do
|
13
19
|
|
14
20
|
# Specify the file you already have; Also works with .ssa and .ass
|
15
|
-
file('
|
21
|
+
file('#{filename}')
|
16
22
|
|
17
23
|
# Change this to your encoding, uncomment if you don't know
|
18
24
|
encoding('utf-8')
|
@@ -28,7 +34,7 @@ end
|
|
28
34
|
job.want do
|
29
35
|
|
30
36
|
# Specify the file to be created; Also works with .ssa and .ass
|
31
|
-
file('
|
37
|
+
file('processed_#{filename}')
|
32
38
|
|
33
39
|
# Change this to your desired target encoding
|
34
40
|
encoding('utf-8')
|
@@ -50,13 +56,11 @@ end
|
|
50
56
|
|
51
57
|
HERETEMPLATE
|
52
58
|
|
53
|
-
|
54
|
-
|
55
|
-
puts "Created generic job script '#{filename}' in current directory;"
|
56
|
-
puts "Edit and then run with 'ruby #{filename}'"
|
59
|
+
IO.write("process_#{filename}.rb", content)
|
57
60
|
|
61
|
+
puts "Created template 'process_#{filename}.rb' in current directory"
|
62
|
+
end
|
58
63
|
else
|
59
64
|
puts 'Your either provided an unknown option, or none at all;'
|
60
|
-
puts '
|
61
|
-
puts 'E.g. \'titlekit template myscript\''
|
65
|
+
puts 'Try out \'titlekit template\' (\'titlekit templates\' works too).'
|
62
66
|
end
|
data/lib/titlekit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: titlekit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Repp
|
@@ -69,7 +69,6 @@ dependencies:
|
|
69
69
|
description: Featureful Ruby 2 library for SRT / ASS / SSA subtitles
|
70
70
|
email: simon@openideas.com
|
71
71
|
executables:
|
72
|
-
- template_job.rb
|
73
72
|
- titlekit
|
74
73
|
extensions: []
|
75
74
|
extra_rdoc_files: []
|
@@ -80,7 +79,6 @@ files:
|
|
80
79
|
- LICENSE
|
81
80
|
- README.md
|
82
81
|
- Rakefile
|
83
|
-
- bin/template_job.rb
|
84
82
|
- bin/titlekit
|
85
83
|
- lib/titlekit.rb
|
86
84
|
- lib/titlekit/have.rb
|
data/bin/template_job.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'titlekit'
|
2
|
-
|
3
|
-
job = Titlekit::Job.new
|
4
|
-
|
5
|
-
job.have do
|
6
|
-
|
7
|
-
# Specify the file you already have; Also works with .ssa and .ass
|
8
|
-
file('original.srt')
|
9
|
-
|
10
|
-
# Change this to your encoding, uncomment if you don't know
|
11
|
-
encoding('utf-8')
|
12
|
-
|
13
|
-
# Uncomment and edit to set a reference in the existing subtitles
|
14
|
-
# reference(:first, srt_timecode: '00:00:00,000')
|
15
|
-
|
16
|
-
# Uncomment and edit to set another reference in the existing subtitles
|
17
|
-
# reference(:second, srt_timecode: '00:00:00,000')
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
job.want do
|
22
|
-
|
23
|
-
# Specify the file to be created; Also works with .ssa and .ass
|
24
|
-
file('target.srt')
|
25
|
-
|
26
|
-
# Change this to your desired target encoding
|
27
|
-
encoding('utf-8')
|
28
|
-
|
29
|
-
# Uncomment and edit to set a new target timecode for the first reference
|
30
|
-
# reference(:first, srt_timecode: '00:00:00,000')
|
31
|
-
|
32
|
-
# Uncomment and edit to also set the second target timecode
|
33
|
-
# reference(:second, srt_timecode: '00:00:00,000')
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
if job.run
|
38
|
-
puts 'Job completed without errors!'
|
39
|
-
else
|
40
|
-
puts 'There were errors:'
|
41
|
-
puts job.report.join("\n")
|
42
|
-
end
|
43
|
-
|