titlekit 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +3 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +22 -0
  6. data/README.md +335 -0
  7. data/Rakefile +8 -0
  8. data/lib/titlekit/have.rb +90 -0
  9. data/lib/titlekit/job.rb +446 -0
  10. data/lib/titlekit/parsers/ass.rb +175 -0
  11. data/lib/titlekit/parsers/ass.treetop +72 -0
  12. data/lib/titlekit/parsers/srt.rb +139 -0
  13. data/lib/titlekit/parsers/srt.treetop +73 -0
  14. data/lib/titlekit/parsers/ssa.rb +201 -0
  15. data/lib/titlekit/parsers/ssa.treetop +72 -0
  16. data/lib/titlekit/specification.rb +131 -0
  17. data/lib/titlekit/utilities.rb +3 -0
  18. data/lib/titlekit/version.rb +3 -0
  19. data/lib/titlekit/want.rb +24 -0
  20. data/lib/titlekit.rb +9 -0
  21. data/spec/ass_spec.rb +113 -0
  22. data/spec/automatic_grouping/automatic_grouping_spec.rb +55 -0
  23. data/spec/automatic_grouping/dual_tracks/expected.srt +15 -0
  24. data/spec/automatic_grouping/dual_tracks/one.srt +11 -0
  25. data/spec/automatic_grouping/dual_tracks/out.srt +15 -0
  26. data/spec/automatic_grouping/dual_tracks/two.srt +11 -0
  27. data/spec/automatic_grouping/single_track/expected.srt +24 -0
  28. data/spec/automatic_grouping/single_track/one.srt +11 -0
  29. data/spec/automatic_grouping/single_track/out.srt +24 -0
  30. data/spec/automatic_grouping/single_track/two.srt +11 -0
  31. data/spec/encoding_detection/a/in.ass +0 -0
  32. data/spec/encoding_detection/b/in.srt +2389 -0
  33. data/spec/encoding_detection/b/out.srt +2389 -0
  34. data/spec/encoding_detection/c/in.srt +5320 -0
  35. data/spec/encoding_detection/c/out.srt +5320 -0
  36. data/spec/encoding_detection/encoding_detection_spec.rb +81 -0
  37. data/spec/files/ass/authentic.ass +0 -0
  38. data/spec/files/ass/hard.ass +37 -0
  39. data/spec/files/ass/simple.ass +28 -0
  40. data/spec/files/srt/authentic.srt +2708 -0
  41. data/spec/files/srt/coordinates.srt +13 -0
  42. data/spec/files/srt/simple.srt +12 -0
  43. data/spec/files/ssa/simple.ssa +26 -0
  44. data/spec/files/try/unsupported-output.try +0 -0
  45. data/spec/files/try/unsupported.try +7 -0
  46. data/spec/format_conversion/ass_srt/expected.srt +2327 -0
  47. data/spec/format_conversion/ass_srt/in.ass +485 -0
  48. data/spec/format_conversion/ass_srt/out.srt +2327 -0
  49. data/spec/format_conversion/format_conversion_spec.rb +112 -0
  50. data/spec/format_conversion/srt_ass/expected.ass +19 -0
  51. data/spec/format_conversion/srt_ass/in.srt +12 -0
  52. data/spec/format_conversion/srt_ass/out.ass +19 -0
  53. data/spec/format_conversion/srt_ssa/expected.ssa +19 -0
  54. data/spec/format_conversion/srt_ssa/in.srt +12 -0
  55. data/spec/format_conversion/srt_ssa/out.ssa +19 -0
  56. data/spec/format_conversion/ssa_srt/expected.srt +9 -0
  57. data/spec/format_conversion/ssa_srt/in.ssa +26 -0
  58. data/spec/format_conversion/ssa_srt/out.srt +9 -0
  59. data/spec/job_spec.rb +162 -0
  60. data/spec/simultaneous_subtitles/dual/ass/expected.ass +22 -0
  61. data/spec/simultaneous_subtitles/dual/ass/out.ass +22 -0
  62. data/spec/simultaneous_subtitles/dual/one.srt +11 -0
  63. data/spec/simultaneous_subtitles/dual/srt/expected.srt +27 -0
  64. data/spec/simultaneous_subtitles/dual/srt/out.srt +27 -0
  65. data/spec/simultaneous_subtitles/dual/ssa/expected.ssa +22 -0
  66. data/spec/simultaneous_subtitles/dual/ssa/out.ssa +22 -0
  67. data/spec/simultaneous_subtitles/dual/two.srt +11 -0
  68. data/spec/simultaneous_subtitles/simultaneous_subtitles_spec.rb +220 -0
  69. data/spec/simultaneous_subtitles/triple/ass/expected.ass +25 -0
  70. data/spec/simultaneous_subtitles/triple/ass/out.ass +25 -0
  71. data/spec/simultaneous_subtitles/triple/one.srt +11 -0
  72. data/spec/simultaneous_subtitles/triple/srt/expected.srt +55 -0
  73. data/spec/simultaneous_subtitles/triple/srt/out.srt +55 -0
  74. data/spec/simultaneous_subtitles/triple/ssa/expected.ssa +25 -0
  75. data/spec/simultaneous_subtitles/triple/ssa/out.ssa +25 -0
  76. data/spec/simultaneous_subtitles/triple/three.srt +11 -0
  77. data/spec/simultaneous_subtitles/triple/two.srt +11 -0
  78. data/spec/simultaneous_subtitles/triple_plus/ass/expected.ass +93 -0
  79. data/spec/simultaneous_subtitles/triple_plus/ass/out.ass +93 -0
  80. data/spec/simultaneous_subtitles/triple_plus/five.srt +11 -0
  81. data/spec/simultaneous_subtitles/triple_plus/four.srt +11 -0
  82. data/spec/simultaneous_subtitles/triple_plus/one.srt +11 -0
  83. data/spec/simultaneous_subtitles/triple_plus/six.srt +11 -0
  84. data/spec/simultaneous_subtitles/triple_plus/srt/expected.srt +149 -0
  85. data/spec/simultaneous_subtitles/triple_plus/srt/out.srt +149 -0
  86. data/spec/simultaneous_subtitles/triple_plus/ssa/expected.ssa +93 -0
  87. data/spec/simultaneous_subtitles/triple_plus/ssa/out.ssa +93 -0
  88. data/spec/simultaneous_subtitles/triple_plus/three.srt +11 -0
  89. data/spec/simultaneous_subtitles/triple_plus/two.srt +11 -0
  90. data/spec/spec_helper.rb +7 -0
  91. data/spec/specifications_spec.rb +138 -0
  92. data/spec/srt_spec.rb +134 -0
  93. data/spec/ssa_spec.rb +90 -0
  94. data/spec/timecode_correction/double_reference/expected.srt +13 -0
  95. data/spec/timecode_correction/double_reference/in.srt +12 -0
  96. data/spec/timecode_correction/double_reference/out.srt +13 -0
  97. data/spec/timecode_correction/framerate/expected.srt +5 -0
  98. data/spec/timecode_correction/framerate/in.srt +4 -0
  99. data/spec/timecode_correction/framerate/out.srt +5 -0
  100. data/spec/timecode_correction/framerate_plus_reference/expected.srt +13 -0
  101. data/spec/timecode_correction/framerate_plus_reference/in.srt +12 -0
  102. data/spec/timecode_correction/framerate_plus_reference/out.srt +13 -0
  103. data/spec/timecode_correction/single_reference/expected.srt +13 -0
  104. data/spec/timecode_correction/single_reference/in.srt +12 -0
  105. data/spec/timecode_correction/single_reference/out.srt +13 -0
  106. data/spec/timecode_correction/timecode_correction_spec.rb +124 -0
  107. data/spec/transcoding/gb2312-ascii/in.srt +12 -0
  108. data/spec/transcoding/iso-8859-1_utf-8/expected.srt +12 -0
  109. data/spec/transcoding/iso-8859-1_utf-8/in.srt +11 -0
  110. data/spec/transcoding/iso-8859-1_utf-8/out.srt +12 -0
  111. data/spec/transcoding/transcoding_spec.rb +116 -0
  112. data/spec/transcoding/utf-8_gbk/expected.srt +12 -0
  113. data/spec/transcoding/utf-8_gbk/in.srt +11 -0
  114. data/spec/transcoding/utf-8_gbk/out.srt +12 -0
  115. data/spec/transcoding/windows-1252_utf-8/expected.srt +12 -0
  116. data/spec/transcoding/windows-1252_utf-8/in.srt +11 -0
  117. data/spec/transcoding/windows-1252_utf-8/out.srt +12 -0
  118. data/titlekit.gemspec +28 -0
  119. metadata +313 -0
@@ -0,0 +1,112 @@
1
+ require File.join(File.expand_path(__dir__), '../spec_helper')
2
+
3
+ describe Titlekit::Job do
4
+
5
+ describe 'Format conversion' do
6
+
7
+ context 'From ASS to SRT' do
8
+ before(:all) do
9
+ @in = File.join(__dir__, 'ass_srt', 'in.ass')
10
+ @out = File.join(__dir__, 'ass_srt', 'out.srt')
11
+ @expected = File.join(__dir__, 'ass_srt', 'expected.srt')
12
+
13
+ File.delete(@out) if File.exist?(@out)
14
+ end
15
+
16
+ it 'runs the job' do
17
+ job = Titlekit::Job.new
18
+
19
+ have = job.have
20
+ have.file(@in)
21
+
22
+ want = job.want
23
+ want.file(@out)
24
+
25
+ expect(job.run).to be_true
26
+ end
27
+
28
+ it 'delivers the expected output' do
29
+ expect(FileUtils.compare_file(@out, @expected)).to be_true
30
+ end
31
+ end
32
+
33
+ context 'From SRT to ASS' do
34
+ before(:all) do
35
+ @in = File.join(__dir__, 'srt_ass', 'in.srt')
36
+ @out = File.join(__dir__, 'srt_ass', 'out.ass')
37
+ @expected = File.join(__dir__, 'srt_ass', 'expected.ass')
38
+
39
+ File.delete(@out) if File.exist?(@out)
40
+ end
41
+
42
+ it 'runs the job' do
43
+ job = Titlekit::Job.new
44
+
45
+ have = job.have
46
+ have.file(@in)
47
+
48
+ want = job.want
49
+ want.file(@out)
50
+
51
+ expect(job.run).to be_true
52
+ end
53
+
54
+ it 'delivers the expected output' do
55
+ expect(FileUtils.compare_file(@out, @expected)).to be_true
56
+ end
57
+ end
58
+
59
+ context 'From SRT to SSA' do
60
+ before(:all) do
61
+ @in = File.join(__dir__, 'srt_ssa', 'in.srt')
62
+ @out = File.join(__dir__, 'srt_ssa', 'out.ssa')
63
+ @expected = File.join(__dir__, 'srt_ssa', 'expected.ssa')
64
+
65
+ File.delete(@out) if File.exist?(@out)
66
+ end
67
+
68
+ it 'runs the job' do
69
+ job = Titlekit::Job.new
70
+
71
+ have = job.have
72
+ have.file(@in)
73
+
74
+ want = job.want
75
+ want.file(@out)
76
+
77
+ expect(job.run).to be_true
78
+ end
79
+
80
+ it 'delivers the expected output' do
81
+ expect(FileUtils.compare_file(@out, @expected)).to be_true
82
+ end
83
+ end
84
+
85
+ context 'From SSA to SRT' do
86
+ before(:all) do
87
+ @in = File.join(__dir__, 'ssa_srt', 'in.ssa')
88
+ @out = File.join(__dir__, 'ssa_srt', 'out.srt')
89
+ @expected = File.join(__dir__, 'ssa_srt', 'expected.srt')
90
+
91
+ File.delete(@out) if File.exist?(@out)
92
+ end
93
+
94
+ it 'runs the job' do
95
+ job = Titlekit::Job.new
96
+
97
+ have = job.have
98
+ have.file(@in)
99
+
100
+ want = job.want
101
+ want.file(@out)
102
+
103
+ expect(job.run).to be_true
104
+ end
105
+
106
+ it 'delivers the expected output' do
107
+ expect(FileUtils.compare_file(@out, @expected)).to be_true
108
+ end
109
+ end
110
+
111
+ end
112
+ end
@@ -0,0 +1,19 @@
1
+ [Script Info]
2
+ ScriptType: v4.00+
3
+
4
+ [V4+ Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
6
+ Style: Default,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
7
+ Style: Top,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,8,20,20,20,1
8
+ Style: Middle,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,5,20,20,20,1
9
+ Style: EDF393,Arial,16,&H0093F3ED,&H0093F3ED,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
10
+ Style: F5E665,Arial,16,&H0065E6F5,&H0065E6F5,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
11
+ Style: FFC472,Arial,16,&H0072C4FF,&H0072C4FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
12
+ Style: FFA891,Arial,16,&H0091A8FF,&H0091A8FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
13
+ Style: 89BABE,Arial,16,&H00BEBA89,&H00BEBA89,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
14
+
15
+ [Events]
16
+ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.36,0:00:07.30,Default,,0000,0000,0000,,Commencing shaving the yak.
18
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,WAT?
19
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,- I ...\N- Enough!!!
@@ -0,0 +1,12 @@
1
+ 1
2
+ 00:00:02,364 --> 00:00:07,300
3
+ Commencing shaving the yak.
4
+
5
+ 2
6
+ 00:00:24,000 --> 00:00:37,800
7
+ WAT?
8
+
9
+ 3
10
+ 00:00:24,000 --> 00:00:37,800
11
+ - I ...
12
+ - Enough!!!
@@ -0,0 +1,19 @@
1
+ [Script Info]
2
+ ScriptType: v4.00+
3
+
4
+ [V4+ Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
6
+ Style: Default,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
7
+ Style: Top,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,8,20,20,20,1
8
+ Style: Middle,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,5,20,20,20,1
9
+ Style: EDF393,Arial,16,&H0093F3ED,&H0093F3ED,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
10
+ Style: F5E665,Arial,16,&H0065E6F5,&H0065E6F5,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
11
+ Style: FFC472,Arial,16,&H0072C4FF,&H0072C4FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
12
+ Style: FFA891,Arial,16,&H0091A8FF,&H0091A8FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
13
+ Style: 89BABE,Arial,16,&H00BEBA89,&H00BEBA89,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
14
+
15
+ [Events]
16
+ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.36,0:00:07.30,Default,,0000,0000,0000,,Commencing shaving the yak.
18
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,WAT?
19
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,- I ...\N- Enough!!!
@@ -0,0 +1,19 @@
1
+ [Script Info]
2
+ ScriptType: v4.00
3
+
4
+ [V4 Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
6
+ Style: Default,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,2,70,70,40,0,0
7
+ Style: Middle,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,10,70,70,40,0,0
8
+ Style: Top,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,6,70,70,40,0,0
9
+ Style: EDF393,Arial,16,9696237,9696237,9696237,-2147483640,0,0,1,3,0,2,70,70,40,0,0
10
+ Style: F5E665,Arial,16,6678261,6678261,6678261,-2147483640,0,0,1,3,0,2,70,70,40,0,0
11
+ Style: FFC472,Arial,16,7521535,7521535,7521535,-2147483640,0,0,1,3,0,2,70,70,40,0,0
12
+ Style: FFA891,Arial,16,9545983,9545983,9545983,-2147483640,0,0,1,3,0,2,70,70,40,0,0
13
+ Style: 89BABE,Arial,16,12499593,12499593,12499593,-2147483640,0,0,1,3,0,2,70,70,40,0,0
14
+
15
+ [Events]
16
+ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.36,0:00:07.30,Default,,0000,0000,0000,,Commencing shaving the yak.
18
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,WAT?
19
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,- I ...\N- Enough!!!
@@ -0,0 +1,12 @@
1
+ 1
2
+ 00:00:02,364 --> 00:00:07,300
3
+ Commencing shaving the yak.
4
+
5
+ 2
6
+ 00:00:24,000 --> 00:00:37,800
7
+ WAT?
8
+
9
+ 3
10
+ 00:00:24,000 --> 00:00:37,800
11
+ - I ...
12
+ - Enough!!!
@@ -0,0 +1,19 @@
1
+ [Script Info]
2
+ ScriptType: v4.00
3
+
4
+ [V4 Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
6
+ Style: Default,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,2,70,70,40,0,0
7
+ Style: Middle,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,10,70,70,40,0,0
8
+ Style: Top,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,6,70,70,40,0,0
9
+ Style: EDF393,Arial,16,9696237,9696237,9696237,-2147483640,0,0,1,3,0,2,70,70,40,0,0
10
+ Style: F5E665,Arial,16,6678261,6678261,6678261,-2147483640,0,0,1,3,0,2,70,70,40,0,0
11
+ Style: FFC472,Arial,16,7521535,7521535,7521535,-2147483640,0,0,1,3,0,2,70,70,40,0,0
12
+ Style: FFA891,Arial,16,9545983,9545983,9545983,-2147483640,0,0,1,3,0,2,70,70,40,0,0
13
+ Style: 89BABE,Arial,16,12499593,12499593,12499593,-2147483640,0,0,1,3,0,2,70,70,40,0,0
14
+
15
+ [Events]
16
+ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.36,0:00:07.30,Default,,0000,0000,0000,,Commencing shaving the yak.
18
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,WAT?
19
+ Dialogue: 0,0:00:24.00,0:00:37.80,Default,,0000,0000,0000,,- I ...\N- Enough!!!
@@ -0,0 +1,9 @@
1
+ 1
2
+ 00:00:06,600 --> 00:00:08,900
3
+ {\a10}See you again... Best wishes
4
+
5
+
6
+ 2
7
+ 00:00:11,840 --> 00:00:14,740
8
+ {\a2}Story Script & Direction - MIYAZAKI Hayao
9
+
@@ -0,0 +1,26 @@
1
+ [Script Info]
2
+ ; This is a Sub Station Alpha v4 script.
3
+ ; For Sub Station Alpha info and downloads,
4
+ ; go to http://www.eswat.demon.co.uk/
5
+ ; or email kotus@eswat.demon.co.uk
6
+ Title: Spirited Away
7
+ Original Script: Ian Roberts
8
+ Original Translation: Eisuke Ishibashi
9
+ ScriptType: v4.00
10
+ Collisions: Normal
11
+ PlayResY: 480
12
+ PlayDepth: 0
13
+ Wav: 0, 28688,H:\3.wav
14
+ LastWav: 1
15
+ Timer: 100.0000
16
+
17
+ [V4 Styles]
18
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
19
+ Style: ICredit,Gill Sans Condensed,36,16777215,65535,65535,-2147483640,-1,0,1,3,0,2,70,70,40,0,0
20
+ Style: IDefault,Gill Sans Condensed,30,65535,65535,65535,-2147483640,-1,0,1,3,0,2,70,70,40,0,0
21
+ Style: IScreenText,Gill Sans Condensed,30,16744576,65535,65535,-2147483640,-1,0,1,3,5,2,70,70,40,0,0
22
+
23
+ [Events]
24
+ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
25
+ Dialogue: Marked=0,0:00:06.60,0:00:08.90,IScreenText,,0000,0000,0000,,{\a10}See you again... Best wishes
26
+ Dialogue: Marked=0,0:00:11.84,0:00:14.74,ICredit,,0000,0000,0100,,{\a2}Story, Script & Direction - MIYAZAKI Hayao
@@ -0,0 +1,9 @@
1
+ 1
2
+ 00:00:06,600 --> 00:00:08,900
3
+ {\a10}See you again... Best wishes
4
+
5
+
6
+ 2
7
+ 00:00:11,840 --> 00:00:14,740
8
+ {\a2}Story Script & Direction - MIYAZAKI Hayao
9
+
data/spec/job_spec.rb ADDED
@@ -0,0 +1,162 @@
1
+ require File.join(File.expand_path(__dir__), 'spec_helper')
2
+
3
+ describe Titlekit::Job do
4
+
5
+ describe '#new' do
6
+ it 'creates a new instance' do
7
+ expect(Titlekit::Job.new).to be_a_kind_of(Titlekit::Job)
8
+ end
9
+ end
10
+
11
+ describe '#have' do
12
+ context 'without a block' do
13
+ let(:have) do
14
+ Titlekit::Job.new.have
15
+ end
16
+
17
+ it 'returns an instance of Have' do
18
+ expect(have).to be_a_kind_of(Titlekit::Have)
19
+ end
20
+ end
21
+
22
+ context 'with a block, passing no variable' do
23
+ let(:have) do
24
+ Titlekit::Job.new.have do
25
+ encoding('utf-8')
26
+ file('spec/files/srt/simple.srt')
27
+ fps(25)
28
+ end
29
+ end
30
+
31
+ it 'returns an instance of Have' do
32
+ expect(have).to be_a_kind_of(Titlekit::Have)
33
+ end
34
+
35
+ it 'assigns specification properties in the block' do
36
+ expect(have.encoding).to eq('utf-8')
37
+ expect(have.file).to be
38
+ expect(have.fps).to eq(25)
39
+ end
40
+ end
41
+
42
+ context 'with a block, passing a variable' do
43
+ let(:have) do
44
+ Titlekit::Job.new.have do |have|
45
+ have.encoding('utf-8')
46
+ have.file('spec/files/srt/simple.srt')
47
+ have.fps(25)
48
+ end
49
+ end
50
+
51
+ it 'returns an instance of Have' do
52
+ expect(have).to be_a_kind_of(Titlekit::Have)
53
+ end
54
+
55
+ it 'assigns specification properties in the block' do
56
+ expect(have.encoding).to eq('utf-8')
57
+ expect(have.file).to be
58
+ expect(have.fps).to eq(25)
59
+ end
60
+ end
61
+ end
62
+
63
+ describe '#want' do
64
+ context 'without a block' do
65
+ let(:want) do
66
+ Titlekit::Job.new.want
67
+ end
68
+
69
+ it 'returns an instance of Want' do
70
+ expect(want).to be_a_kind_of(Titlekit::Want)
71
+ end
72
+ end
73
+
74
+ context 'with a block, passing no variable' do
75
+ let(:want) do
76
+ Titlekit::Job.new.want do
77
+ encoding('utf-8')
78
+ file('out.srt')
79
+ fps(23.976)
80
+ end
81
+ end
82
+
83
+ it 'returns an instance of Want' do
84
+ expect(want).to be_a_kind_of(Titlekit::Want)
85
+ end
86
+
87
+ it 'assigns specification properties in the block' do
88
+ expect(want.encoding).to eq('utf-8')
89
+ expect(want.file).to eq('out.srt')
90
+ expect(want.fps).to eq(23.976)
91
+ end
92
+ end
93
+
94
+ context 'with a block, passing a variable' do
95
+ let(:want) do
96
+ Titlekit::Job.new.want do |want|
97
+ want.encoding('utf-8')
98
+ want.file('out.srt')
99
+ want.fps(23.976)
100
+ end
101
+ end
102
+
103
+ it 'returns an instance of Want' do
104
+ expect(want).to be_a_kind_of(Titlekit::Want)
105
+ end
106
+
107
+ it 'assigns specification properties in the block' do
108
+ expect(want.encoding).to eq('utf-8')
109
+ expect(want.file).to eq('out.srt')
110
+ expect(want.fps).to eq(23.976)
111
+ end
112
+ end
113
+ end
114
+
115
+ describe '#run' do
116
+
117
+ context 'with input files that don\'t exist' do
118
+ it 'gracefully aborts the job' do
119
+ job = Titlekit::Job.new
120
+ job.have { file('something/that/without/doubt/wont/exist.srt') }
121
+ job.want { file('something/that/does/not/matter/anyway.ass') }
122
+
123
+ expect(job.run).to be_false
124
+ expect(job.report.join).to include('Failure while reading')
125
+ end
126
+ end
127
+
128
+ context 'with output files that can\'t be created' do
129
+ it 'gracefully aborts the job' do
130
+ job = Titlekit::Job.new
131
+ job.have { file('spec/files/srt/simple.srt') }
132
+ job.want { file('!@#$%^&*()|?/\\.ass') }
133
+
134
+ expect(job.run).to be_false
135
+ expect(job.report.join).to include('Failure while writing')
136
+ end
137
+ end
138
+
139
+ context 'with an input format that is not supported' do
140
+ it 'gracefully aborts the job' do
141
+ job = Titlekit::Job.new
142
+ job.have { file('spec/files/try/unsupported.try') }
143
+ job.want { file('!@#$%^&*()|?/\.ass') }
144
+
145
+ expect(job.run).to be_false
146
+ expect(job.report.join).to include('Failure while importing TRY')
147
+ end
148
+ end
149
+
150
+ context 'with an output format that is not supported' do
151
+ it 'gracefully aborts the job' do
152
+ job = Titlekit::Job.new
153
+ job.have { file('spec/files/srt/simple.srt') }
154
+ job.want { file('spec/files/try/unsupported-output.try') }
155
+
156
+ expect(job.run).to be_false
157
+ expect(job.report.join).to include('Failure while exporting TRY')
158
+ end
159
+ end
160
+
161
+ end
162
+ end
@@ -0,0 +1,22 @@
1
+ [Script Info]
2
+ ScriptType: v4.00+
3
+
4
+ [V4+ Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
6
+ Style: Default,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
7
+ Style: Top,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,8,20,20,20,1
8
+ Style: Middle,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,5,20,20,20,1
9
+ Style: EDF393,Arial,16,&H0093F3ED,&H0093F3ED,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
10
+ Style: F5E665,Arial,16,&H0065E6F5,&H0065E6F5,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
11
+ Style: FFC472,Arial,16,&H0072C4FF,&H0072C4FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
12
+ Style: FFA891,Arial,16,&H0091A8FF,&H0091A8FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
13
+ Style: 89BABE,Arial,16,&H00BEBA89,&H00BEBA89,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
14
+
15
+ [Events]
16
+ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.00,0:00:10.00,Default,,0000,0000,0000,,We are using two subtitles simultaneously
18
+ Dialogue: 0,0:00:02.00,0:00:10.00,Top,,0000,0000,0000,,Somos utilizando dos subtítulos simultáneamente
19
+ Dialogue: 0,0:00:12.00,0:00:20.00,Default,,0000,0000,0000,,That is correct
20
+ Dialogue: 0,0:00:12.00,0:00:20.50,Top,,0000,0000,0000,,Esto es correcto
21
+ Dialogue: 0,0:00:22.00,0:00:30.00,Default,,0000,0000,0000,,They are not fully aligned, though
22
+ Dialogue: 0,0:00:23.00,0:00:31.00,Top,,0000,0000,0000,,No son alineado sin embargo
@@ -0,0 +1,22 @@
1
+ [Script Info]
2
+ ScriptType: v4.00+
3
+
4
+ [V4+ Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
6
+ Style: Default,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
7
+ Style: Top,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,8,20,20,20,1
8
+ Style: Middle,Arial,16,&H00FFFFFF,&H00FFFFFF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,5,20,20,20,1
9
+ Style: EDF393,Arial,16,&H0093F3ED,&H0093F3ED,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
10
+ Style: F5E665,Arial,16,&H0065E6F5,&H0065E6F5,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
11
+ Style: FFC472,Arial,16,&H0072C4FF,&H0072C4FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
12
+ Style: FFA891,Arial,16,&H0091A8FF,&H0091A8FF,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
13
+ Style: 89BABE,Arial,16,&H00BEBA89,&H00BEBA89,&H40000000,&H40000000,0,0,0,0,100,100,0,0.00,1,3,0,2,20,20,20,1
14
+
15
+ [Events]
16
+ Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.00,0:00:10.00,Default,,0000,0000,0000,,We are using two subtitles simultaneously
18
+ Dialogue: 0,0:00:02.00,0:00:10.00,Top,,0000,0000,0000,,Somos utilizando dos subtítulos simultáneamente
19
+ Dialogue: 0,0:00:12.00,0:00:20.00,Default,,0000,0000,0000,,That is correct
20
+ Dialogue: 0,0:00:12.00,0:00:20.50,Top,,0000,0000,0000,,Esto es correcto
21
+ Dialogue: 0,0:00:22.00,0:00:30.00,Default,,0000,0000,0000,,They are not fully aligned, though
22
+ Dialogue: 0,0:00:23.00,0:00:31.00,Top,,0000,0000,0000,,No son alineado sin embargo
@@ -0,0 +1,11 @@
1
+ 1
2
+ 00:00:02,000 --> 00:00:10,000
3
+ We are using two subtitles simultaneously
4
+
5
+ 2
6
+ 00:00:12,000 --> 00:00:20,000
7
+ That is correct
8
+
9
+ 3
10
+ 00:00:22,000 --> 00:00:30,000
11
+ They are not fully aligned, though
@@ -0,0 +1,27 @@
1
+ 1
2
+ 00:00:02,000 --> 00:00:10,000
3
+ <font color="#EDF393">We are using two subtitles simultaneously</font>
4
+ <font color="#F5E665">Somos utilizando dos subtítulos simultáneamente</font>
5
+
6
+ 2
7
+ 00:00:12,000 --> 00:00:20,000
8
+ <font color="#EDF393">That is correct</font>
9
+ <font color="#F5E665">Esto es correcto</font>
10
+
11
+ 3
12
+ 00:00:20,000 --> 00:00:20,500
13
+ <font color="#F5E665">Esto es correcto</font>
14
+
15
+ 4
16
+ 00:00:22,000 --> 00:00:23,000
17
+ <font color="#EDF393">They are not fully aligned, though</font>
18
+
19
+ 5
20
+ 00:00:23,000 --> 00:00:30,000
21
+ <font color="#EDF393">They are not fully aligned, though</font>
22
+ <font color="#F5E665">No son alineado sin embargo</font>
23
+
24
+ 6
25
+ 00:00:30,000 --> 00:00:31,000
26
+ <font color="#F5E665">No son alineado sin embargo</font>
27
+
@@ -0,0 +1,27 @@
1
+ 1
2
+ 00:00:02,000 --> 00:00:10,000
3
+ <font color="#EDF393">We are using two subtitles simultaneously</font>
4
+ <font color="#F5E665">Somos utilizando dos subtítulos simultáneamente</font>
5
+
6
+ 2
7
+ 00:00:12,000 --> 00:00:20,000
8
+ <font color="#EDF393">That is correct</font>
9
+ <font color="#F5E665">Esto es correcto</font>
10
+
11
+ 3
12
+ 00:00:20,000 --> 00:00:20,500
13
+ <font color="#F5E665">Esto es correcto</font>
14
+
15
+ 4
16
+ 00:00:22,000 --> 00:00:23,000
17
+ <font color="#EDF393">They are not fully aligned, though</font>
18
+
19
+ 5
20
+ 00:00:23,000 --> 00:00:30,000
21
+ <font color="#EDF393">They are not fully aligned, though</font>
22
+ <font color="#F5E665">No son alineado sin embargo</font>
23
+
24
+ 6
25
+ 00:00:30,000 --> 00:00:31,000
26
+ <font color="#F5E665">No son alineado sin embargo</font>
27
+
@@ -0,0 +1,22 @@
1
+ [Script Info]
2
+ ScriptType: v4.00
3
+
4
+ [V4 Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
6
+ Style: Default,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,2,70,70,40,0,0
7
+ Style: Middle,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,10,70,70,40,0,0
8
+ Style: Top,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,6,70,70,40,0,0
9
+ Style: EDF393,Arial,16,9696237,9696237,9696237,-2147483640,0,0,1,3,0,2,70,70,40,0,0
10
+ Style: F5E665,Arial,16,6678261,6678261,6678261,-2147483640,0,0,1,3,0,2,70,70,40,0,0
11
+ Style: FFC472,Arial,16,7521535,7521535,7521535,-2147483640,0,0,1,3,0,2,70,70,40,0,0
12
+ Style: FFA891,Arial,16,9545983,9545983,9545983,-2147483640,0,0,1,3,0,2,70,70,40,0,0
13
+ Style: 89BABE,Arial,16,12499593,12499593,12499593,-2147483640,0,0,1,3,0,2,70,70,40,0,0
14
+
15
+ [Events]
16
+ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.00,0:00:10.00,Default,,0000,0000,0000,,We are using two subtitles simultaneously
18
+ Dialogue: 0,0:00:02.00,0:00:10.00,Top,,0000,0000,0000,,Somos utilizando dos subtítulos simultáneamente
19
+ Dialogue: 0,0:00:12.00,0:00:20.00,Default,,0000,0000,0000,,That is correct
20
+ Dialogue: 0,0:00:12.00,0:00:20.50,Top,,0000,0000,0000,,Esto es correcto
21
+ Dialogue: 0,0:00:22.00,0:00:30.00,Default,,0000,0000,0000,,They are not fully aligned, though
22
+ Dialogue: 0,0:00:23.00,0:00:31.00,Top,,0000,0000,0000,,No son alineado sin embargo
@@ -0,0 +1,22 @@
1
+ [Script Info]
2
+ ScriptType: v4.00
3
+
4
+ [V4 Styles]
5
+ Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
6
+ Style: Default,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,2,70,70,40,0,0
7
+ Style: Middle,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,10,70,70,40,0,0
8
+ Style: Top,Arial,16,16777215,16777215,16777215,-2147483640,0,0,1,3,0,6,70,70,40,0,0
9
+ Style: EDF393,Arial,16,9696237,9696237,9696237,-2147483640,0,0,1,3,0,2,70,70,40,0,0
10
+ Style: F5E665,Arial,16,6678261,6678261,6678261,-2147483640,0,0,1,3,0,2,70,70,40,0,0
11
+ Style: FFC472,Arial,16,7521535,7521535,7521535,-2147483640,0,0,1,3,0,2,70,70,40,0,0
12
+ Style: FFA891,Arial,16,9545983,9545983,9545983,-2147483640,0,0,1,3,0,2,70,70,40,0,0
13
+ Style: 89BABE,Arial,16,12499593,12499593,12499593,-2147483640,0,0,1,3,0,2,70,70,40,0,0
14
+
15
+ [Events]
16
+ Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
17
+ Dialogue: 0,0:00:02.00,0:00:10.00,Default,,0000,0000,0000,,We are using two subtitles simultaneously
18
+ Dialogue: 0,0:00:02.00,0:00:10.00,Top,,0000,0000,0000,,Somos utilizando dos subtítulos simultáneamente
19
+ Dialogue: 0,0:00:12.00,0:00:20.00,Default,,0000,0000,0000,,That is correct
20
+ Dialogue: 0,0:00:12.00,0:00:20.50,Top,,0000,0000,0000,,Esto es correcto
21
+ Dialogue: 0,0:00:22.00,0:00:30.00,Default,,0000,0000,0000,,They are not fully aligned, though
22
+ Dialogue: 0,0:00:23.00,0:00:31.00,Top,,0000,0000,0000,,No son alineado sin embargo
@@ -0,0 +1,11 @@
1
+ 1
2
+ 00:00:02,000 --> 00:00:10,000
3
+ Somos utilizando dos subtítulos simultáneamente
4
+
5
+ 2
6
+ 00:00:12,000 --> 00:00:20,500
7
+ Esto es correcto
8
+
9
+ 3
10
+ 00:00:23,000 --> 00:00:31,000
11
+ No son alineado sin embargo