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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56100721d8f193fbedbee1c8d42cacafa030e1c4d1c0dfcc5b30cedcf5bc1b6a
4
- data.tar.gz: 139bfb18996b5e79b9ceab0a3422ed1df5654c36c9b11975c0cb82593652af8c
3
+ metadata.gz: f510d56c366a201d0769ce2687b3bc6d541ca86ca279444015196df022d907c3
4
+ data.tar.gz: 064a5daa6e27708d59bd4b6d71f6ec2fca41852e1738629b4a2767eb93e81b96
5
5
  SHA512:
6
- metadata.gz: 9cf505367ba249d0bec9fac8d655633b2a00c9ee058c9cab27c7895ee948ad9863ecb2253537d3d9cccca71f5d7261a5b678dc68c1b22e8876bf177092db3c34
7
- data.tar.gz: 0ad0849d0e3f4972a0ddcf765e09af61322017d9cf971521f4bd51748565822176360d395bff0aa230f8562b3e4109c41d7777a159fa086c17cb1f446a1d4489
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
 
@@ -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
- 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.
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
- @file_path = file_path
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 = File.read(@file_path, encoding: 'UTF-8')
14
- content = remove_underscores(content)
23
+ content = remove_underscores(@content)
15
24
  normalize_lines(content)
16
25
  end
17
26
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Appydave
4
4
  module Tools
5
- VERSION = '0.11.8'
5
+ VERSION = '0.11.9'
6
6
  end
7
7
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.11.8",
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.8",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appydave-tools",
3
- "version": "0.11.8",
3
+ "version": "0.11.9",
4
4
  "description": "AppyDave YouTube Automation Tools",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appydave-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.8
4
+ version: 0.11.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys