screenkit 0.0.12 → 0.0.14
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/CHANGELOG.md +10 -0
- data/DOCUMENTATION.md +5 -6
- data/lib/screenkit/cli/episode.rb +20 -4
- data/lib/screenkit/exporter/episode.rb +7 -4
- data/lib/screenkit/exporter/segment.rb +1 -1
- data/lib/screenkit/http.rb +4 -12
- data/lib/screenkit/image_magick.rb +2 -0
- data/lib/screenkit/logfile.rb +1 -0
- data/lib/screenkit/parallel_processor.rb +5 -3
- data/lib/screenkit/redact_file.rb +18 -0
- data/lib/screenkit/tts/base.rb +4 -0
- data/lib/screenkit/tts/eleven_labs.rb +4 -0
- data/lib/screenkit/version.rb +1 -1
- data/lib/screenkit.rb +1 -0
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e300f330550b46c23a90c6433c534bb473f65cc71c49c82a97a6d9dde1a35c61
|
|
4
|
+
data.tar.gz: 8030a806d8daab8ab3df20dfc93b4b315746e330e0c2f11d16ba70725f6f6e21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad8cdfd064da26fff6013df15e41562fb8b9463493dcc26510a5f48ddf4880c1b55bcf566c82c34ff1abd77b8102d93092283b4987ff8f62d19b33249e1e6e8b
|
|
7
|
+
data.tar.gz: 9b9302661f3b0c65a7b4c365a516b2833297d2fc683a2d6d75c84e051bfa70cc1daeeb0b22aa4f53be4aad8597604944100646a4a6d96935092b49f77a2a9b3e
|
data/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,16 @@ Prefix your message with one of the following:
|
|
|
11
11
|
- [Security] in case of vulnerabilities.
|
|
12
12
|
-->
|
|
13
13
|
|
|
14
|
+
## v0.0.14
|
|
15
|
+
|
|
16
|
+
- [Fixed] Fix file redacting when no API key is defined.
|
|
17
|
+
- [Fixed] Trim transparent pixels from rendered text.
|
|
18
|
+
- [Fixed] Allow concurrency to be specified when generating voiceover.
|
|
19
|
+
|
|
20
|
+
## v0.0.13
|
|
21
|
+
|
|
22
|
+
- [Fixed] Redact API key in config log.
|
|
23
|
+
|
|
14
24
|
## v0.0.12
|
|
15
25
|
|
|
16
26
|
- [Fixed] Fix how configuration is merged.
|
data/DOCUMENTATION.md
CHANGED
|
@@ -114,8 +114,6 @@ $ docker run \
|
|
|
114
114
|
Notice that Chrome requires a lot of memory, so you need `--shm-size=2g` (or
|
|
115
115
|
more).
|
|
116
116
|
|
|
117
|
-
To create a new project:
|
|
118
|
-
|
|
119
117
|
---
|
|
120
118
|
|
|
121
119
|
## Quick Start
|
|
@@ -958,7 +956,7 @@ The engine name is camelized (e.g., `custom_engine` → `CustomEngine`,
|
|
|
958
956
|
|
|
959
957
|
> [!TIP]
|
|
960
958
|
>
|
|
961
|
-
> If you host your TTS engine on Github, use the topic `
|
|
959
|
+
> If you host your TTS engine on Github, use the topic `screenkit-tts`, so other
|
|
962
960
|
> people can find it.
|
|
963
961
|
|
|
964
962
|
---
|
|
@@ -1320,9 +1318,10 @@ bundle exec screenkit ...
|
|
|
1320
1318
|
|
|
1321
1319
|
#### TTS not working
|
|
1322
1320
|
|
|
1323
|
-
- For ElevenLabs:
|
|
1324
|
-
|
|
1325
|
-
- For `
|
|
1321
|
+
- For ElevenLabs: set `--tts-api-key` with valid prefixed key, like
|
|
1322
|
+
`eleven_labs:API_KEY`
|
|
1323
|
+
- For macOS `say`: verify voice name with `say -v ?`
|
|
1324
|
+
- For `espeak`: ensure `espeak` is installed and in PATH
|
|
1326
1325
|
|
|
1327
1326
|
#### Playwright scripts not working
|
|
1328
1327
|
|
|
@@ -69,15 +69,23 @@ module ScreenKit
|
|
|
69
69
|
def export
|
|
70
70
|
puts Banner.banner if options.banner
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
episode_config_path = File.join(options.dir, "config.yml")
|
|
73
|
+
has_project_config = File.file?(options.config)
|
|
74
|
+
has_episode_config = File.file?(episode_config_path)
|
|
75
|
+
|
|
76
|
+
if !has_project_config && !has_episode_config
|
|
77
|
+
shell.say "Error: No configuration file found.", :red
|
|
78
|
+
exit 1
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
project_config = if has_project_config
|
|
73
82
|
Config.load_yaml_file(options.config)
|
|
74
83
|
else
|
|
75
84
|
{}
|
|
76
85
|
end
|
|
77
86
|
|
|
78
|
-
episode_config =
|
|
79
|
-
|
|
80
|
-
Config.load_yaml_file(episode_config)
|
|
87
|
+
episode_config = if has_episode_config
|
|
88
|
+
Config.load_yaml_file(episode_config_path)
|
|
81
89
|
else
|
|
82
90
|
{}
|
|
83
91
|
end
|
|
@@ -95,6 +103,14 @@ module ScreenKit
|
|
|
95
103
|
)
|
|
96
104
|
|
|
97
105
|
exporter.export
|
|
106
|
+
ensure
|
|
107
|
+
exporter.output_dir.join("logs").glob("*.txt").each do |path|
|
|
108
|
+
redact_file(path, options.tts_api_key)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
no_commands do
|
|
113
|
+
include RedactFile
|
|
98
114
|
end
|
|
99
115
|
end
|
|
100
116
|
end
|
|
@@ -4,6 +4,7 @@ module ScreenKit
|
|
|
4
4
|
module Exporter
|
|
5
5
|
class Episode
|
|
6
6
|
using CoreExt
|
|
7
|
+
include RedactFile
|
|
7
8
|
include Utils
|
|
8
9
|
include Shell
|
|
9
10
|
|
|
@@ -148,7 +149,8 @@ module ScreenKit
|
|
|
148
149
|
spinner:,
|
|
149
150
|
list: filtered_segments,
|
|
150
151
|
message: "Exporting voiceovers (%{progress}/%{count})",
|
|
151
|
-
log_path: logfile.create("%{prefix}", :voiceover)
|
|
152
|
+
log_path: logfile.create("%{prefix}", :voiceover),
|
|
153
|
+
concurrency: tts_engine.concurrency
|
|
152
154
|
).run(&:export_voiceover)
|
|
153
155
|
|
|
154
156
|
log_elapsed("Generated voiceover in %{elapsed}", elapsed)
|
|
@@ -188,7 +190,7 @@ module ScreenKit
|
|
|
188
190
|
source.search(watermark.path)
|
|
189
191
|
else
|
|
190
192
|
ScreenKit.root_dir
|
|
191
|
-
.join("
|
|
193
|
+
.join("resources/transparent.png")
|
|
192
194
|
end
|
|
193
195
|
|
|
194
196
|
watermark_width, watermark_height = image_size(watermark_path)
|
|
@@ -401,10 +403,11 @@ module ScreenKit
|
|
|
401
403
|
|
|
402
404
|
# Logs initial information about the episode export process.
|
|
403
405
|
def prelude
|
|
404
|
-
logfile.json_log(
|
|
406
|
+
path = logfile.json_log(
|
|
405
407
|
:config,
|
|
406
|
-
options.merge(pwd: Dir.pwd, config:)
|
|
408
|
+
options.merge(pwd: Dir.pwd, config: config.as_json)
|
|
407
409
|
)
|
|
410
|
+
redact_file(path, options.tts_api_key)
|
|
408
411
|
|
|
409
412
|
log(
|
|
410
413
|
:info,
|
data/lib/screenkit/http.rb
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module ScreenKit
|
|
4
4
|
module HTTP
|
|
5
|
+
include RedactFile
|
|
6
|
+
|
|
5
7
|
# Sends a POST request.
|
|
8
|
+
#
|
|
6
9
|
# @param url [String] The request URL.
|
|
7
10
|
# @param params [Hash] The request parameters.
|
|
8
11
|
# @param headers [Hash] The request headers.
|
|
@@ -32,6 +35,7 @@ module ScreenKit
|
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
# Sends a JSON POST request.
|
|
38
|
+
#
|
|
35
39
|
# @param url [String] The request URL.
|
|
36
40
|
# @param params [Hash] The request parameters.
|
|
37
41
|
# @param headers [Hash] The request headers.
|
|
@@ -42,17 +46,5 @@ module ScreenKit
|
|
|
42
46
|
headers = headers.merge(content_type: "application/json")
|
|
43
47
|
post(headers:, **)
|
|
44
48
|
end
|
|
45
|
-
|
|
46
|
-
# Redacts sensitive text from a file.
|
|
47
|
-
# @param path [String] The file path.
|
|
48
|
-
# @param text [String] The text to redact.
|
|
49
|
-
# @return [void]
|
|
50
|
-
def redact_file(path, text)
|
|
51
|
-
return unless path
|
|
52
|
-
return unless File.file?(path)
|
|
53
|
-
|
|
54
|
-
content = File.read(path).gsub(text, "[REDACTED]")
|
|
55
|
-
File.write(path, content)
|
|
56
|
-
end
|
|
57
49
|
end
|
|
58
50
|
end
|
data/lib/screenkit/logfile.rb
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
module ScreenKit
|
|
4
4
|
class ParallelProcessor
|
|
5
|
-
attr_reader :spinner, :list, :message, :mutex, :count, :log_path
|
|
5
|
+
attr_reader :spinner, :list, :message, :mutex, :count, :log_path,
|
|
6
|
+
:concurrency
|
|
6
7
|
attr_accessor :progress
|
|
7
8
|
|
|
8
|
-
def initialize(spinner:, list:, message:, log_path: nil)
|
|
9
|
+
def initialize(spinner:, list:, message:, log_path: nil, concurrency: nil)
|
|
9
10
|
@list = list
|
|
10
11
|
@message = message
|
|
11
12
|
@spinner = spinner
|
|
@@ -13,6 +14,7 @@ module ScreenKit
|
|
|
13
14
|
@progress = 0
|
|
14
15
|
@count = list.size
|
|
15
16
|
@log_path = log_path
|
|
17
|
+
@concurrency = concurrency || Etc.nprocessors
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def run(&block)
|
|
@@ -20,7 +22,7 @@ module ScreenKit
|
|
|
20
22
|
indexed_list = list.map.with_index {|item, index| [item, index] }
|
|
21
23
|
arity = block.arity
|
|
22
24
|
|
|
23
|
-
indexed_list.each_slice(
|
|
25
|
+
indexed_list.each_slice(concurrency) do |slice|
|
|
24
26
|
threads = slice.map do |args|
|
|
25
27
|
thread = Thread.new do
|
|
26
28
|
update_message
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ScreenKit
|
|
4
|
+
module RedactFile
|
|
5
|
+
# Redacts sensitive text from a file.
|
|
6
|
+
# @param path [String] The file path.
|
|
7
|
+
# @param text [String] The text to redact.
|
|
8
|
+
# @return [void]
|
|
9
|
+
def redact_file(path, text)
|
|
10
|
+
return unless path
|
|
11
|
+
return unless File.file?(path)
|
|
12
|
+
return if text.to_s.strip.empty?
|
|
13
|
+
|
|
14
|
+
content = File.read(path).gsub(text, "[REDACTED]")
|
|
15
|
+
File.write(path, content)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/screenkit/tts/base.rb
CHANGED
data/lib/screenkit/version.rb
CHANGED
data/lib/screenkit.rb
CHANGED
|
@@ -18,6 +18,7 @@ module ScreenKit
|
|
|
18
18
|
require_relative "screenkit/duration"
|
|
19
19
|
require_relative "screenkit/core_ext"
|
|
20
20
|
require_relative "screenkit/content_type"
|
|
21
|
+
require_relative "screenkit/redact_file"
|
|
21
22
|
require_relative "screenkit/anchor"
|
|
22
23
|
require_relative "screenkit/banner"
|
|
23
24
|
require_relative "screenkit/time_formatter"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: screenkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nando Vieira
|
|
@@ -348,6 +348,7 @@ files:
|
|
|
348
348
|
- lib/screenkit/logfile.rb
|
|
349
349
|
- lib/screenkit/parallel_processor.rb
|
|
350
350
|
- lib/screenkit/path_lookup.rb
|
|
351
|
+
- lib/screenkit/redact_file.rb
|
|
351
352
|
- lib/screenkit/resources/callout_styles/social/blog.png
|
|
352
353
|
- lib/screenkit/resources/callout_styles/social/bsky.png
|
|
353
354
|
- lib/screenkit/resources/callout_styles/social/discord.png
|
|
@@ -420,10 +421,10 @@ metadata:
|
|
|
420
421
|
rubygems_mfa_required: 'true'
|
|
421
422
|
homepage_uri: https://github.com/fnando/screenkit
|
|
422
423
|
bug_tracker_uri: https://github.com/fnando/screenkit/issues
|
|
423
|
-
source_code_uri: https://github.com/fnando/screenkit/tree/v0.0.
|
|
424
|
-
changelog_uri: https://github.com/fnando/screenkit/tree/v0.0.
|
|
425
|
-
documentation_uri: https://github.com/fnando/screenkit/tree/v0.0.
|
|
426
|
-
license_uri: https://github.com/fnando/screenkit/tree/v0.0.
|
|
424
|
+
source_code_uri: https://github.com/fnando/screenkit/tree/v0.0.14
|
|
425
|
+
changelog_uri: https://github.com/fnando/screenkit/tree/v0.0.14/CHANGELOG.md
|
|
426
|
+
documentation_uri: https://github.com/fnando/screenkit/tree/v0.0.14/README.md
|
|
427
|
+
license_uri: https://github.com/fnando/screenkit/tree/v0.0.14/LICENSE.md
|
|
427
428
|
rdoc_options: []
|
|
428
429
|
require_paths:
|
|
429
430
|
- lib
|