appydave-tools 0.11.8 → 0.11.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/bin/subtitle_master.rb +1 -1
- data/lib/appydave/tools/subtitle_master/_doc.md +18 -4
- data/lib/appydave/tools/subtitle_master/clean.rb +13 -4
- data/lib/appydave/tools/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +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: f510d56c366a201d0769ce2687b3bc6d541ca86ca279444015196df022d907c3
|
4
|
+
data.tar.gz: 064a5daa6e27708d59bd4b6d71f6ec2fca41852e1738629b4a2767eb93e81b96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38220bd9663ce88119f724d053e24bb392148d9de398752e5e5748e73933e6021724066aff1fafc9bbe9f4eebece5ddb3b250e41c24a10bcba59de0fbec76be6
|
7
|
+
data.tar.gz: c9ac5c67c2fc177eb6ce02fe5e19a9b5c0caf67c041727d4226ee0d47a23e20931f9865c529dd468ff7f9e97729e1e3bfb7cd04deaeb3954c4d3e2c80891d240
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.11.8](https://github.com/appydave/appydave-tools/compare/v0.11.7...v0.11.8) (2024-11-26)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* alter gemspec ([046b267](https://github.com/appydave/appydave-tools/commit/046b26727e2934ae0cecac38f48c18abaa61c91b))
|
7
|
+
|
1
8
|
## [0.11.7](https://github.com/appydave/appydave-tools/compare/v0.11.6...v0.11.7) (2024-11-26)
|
2
9
|
|
3
10
|
|
data/bin/subtitle_master.rb
CHANGED
@@ -31,7 +31,7 @@ class SubtitleMasterCLI
|
|
31
31
|
|
32
32
|
def clean_subtitles(args)
|
33
33
|
options = parse_options(args, 'clean')
|
34
|
-
cleaner = Appydave::Tools::SubtitleMaster::Clean.new(options[:file])
|
34
|
+
cleaner = Appydave::Tools::SubtitleMaster::Clean.new(file_path: options[:file])
|
35
35
|
result = cleaner.clean
|
36
36
|
write_output(result, options[:output])
|
37
37
|
end
|
@@ -6,7 +6,6 @@ Older Chat
|
|
6
6
|
New Features
|
7
7
|
- https://chatgpt.com/c/670470b8-a0c4-8002-9678-d4d69c680481
|
8
8
|
|
9
|
-
|
10
9
|
## SubtitleMaster - Clean Component
|
11
10
|
|
12
11
|
The `SubtitleMaster::Clean` component is designed to process subtitle (SRT) files to improve their readability and compatibility with various platforms like YouTube. The main functionalities of this component include:
|
@@ -15,12 +14,27 @@ The `SubtitleMaster::Clean` component is designed to process subtitle (SRT) file
|
|
15
14
|
- **Normalizing Subtitle Lines**: Merges fragmented subtitle lines into coherent sentences. It adjusts the timestamps to ensure that each subtitle entry spans the correct duration, combining lines that were incorrectly split by the subtitle creation software.
|
16
15
|
- **Handling Timestamps**: Updates the end timestamp of each merged subtitle to reflect the actual end time of the last occurrence of the text, ensuring accurate timing for each subtitle entry.
|
17
16
|
|
18
|
-
|
17
|
+
### Usage
|
18
|
+
|
19
|
+
The component can be initialized in two ways:
|
20
|
+
|
21
|
+
1. With a file path (typical for CLI usage):
|
22
|
+
```ruby
|
23
|
+
cleaner = SubtitleMaster::Clean.new(file_path: 'path/to/file.srt')
|
24
|
+
```
|
25
|
+
|
26
|
+
2. With direct SRT content (useful for programmatic usage):
|
27
|
+
```ruby
|
28
|
+
cleaner = SubtitleMaster::Clean.new(srt_content: srt_content_string)
|
29
|
+
```
|
30
|
+
|
31
|
+
### Command Line Usage
|
19
32
|
|
20
33
|
```bash
|
21
34
|
./bin/subtitle_master.rb clean -f path/to/example.srt -o path/to/example_cleaned.srt
|
22
35
|
|
23
36
|
# Example using alias
|
24
|
-
|
25
37
|
ad_subtitle_master clean -f transcript/a45-banned-from-midjourney-16-alternatives.srt -o a45-transcript.srt
|
26
|
-
```
|
38
|
+
```
|
39
|
+
|
40
|
+
This component reads the SRT file, processes the content to remove tags and normalize lines, and outputs a cleaned and formatted subtitle file that is easier to read and upload to platforms.
|
@@ -5,13 +5,22 @@ module Appydave
|
|
5
5
|
module SubtitleMaster
|
6
6
|
# Clean and normalize subtitles
|
7
7
|
class Clean
|
8
|
-
def initialize(file_path)
|
9
|
-
|
8
|
+
def initialize(file_path: nil, srt_content: nil)
|
9
|
+
if file_path && srt_content
|
10
|
+
raise ArgumentError, 'You cannot provide both a file path and an SRT content stream.'
|
11
|
+
elsif file_path.nil? && srt_content.nil?
|
12
|
+
raise ArgumentError, 'You must provide either a file path or an SRT content stream.'
|
13
|
+
end
|
14
|
+
|
15
|
+
@content = if file_path
|
16
|
+
File.read(file_path, encoding: 'UTF-8')
|
17
|
+
else
|
18
|
+
srt_content
|
19
|
+
end
|
10
20
|
end
|
11
21
|
|
12
22
|
def clean
|
13
|
-
content =
|
14
|
-
content = remove_underscores(content)
|
23
|
+
content = remove_underscores(@content)
|
15
24
|
normalize_lines(content)
|
16
25
|
end
|
17
26
|
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "appydave-tools",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.9",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "appydave-tools",
|
9
|
-
"version": "0.11.
|
9
|
+
"version": "0.11.9",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.3",
|
data/package.json
CHANGED