Skip to content

Commit d9302c8

Browse files
committed
fix(archive): add script to stage completed transcripts and fix transcripts pipeline
1 parent 40035dc commit d9302c8

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

bin/stage_completed_transcripts.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env ruby
2+
require 'yaml'
3+
require 'fileutils'
4+
5+
assets = YAML.load_file("_data/video_assets.yml")["items"]
6+
staging_dir = "tmp/transcript-id-staging"
7+
FileUtils.mkdir_p(staging_dir)
8+
9+
staged_count = 0
10+
Dir.glob(File.expand_path("~/Downloads/transcripts/*/*.txt")).each do |txt_file|
11+
yt_id = File.basename(txt_file, ".txt")
12+
13+
# Find the corresponding video_asset_id
14+
asset = assets.find do |a|
15+
a["platforms"]&.any? { |p| p["platform"] == "youtube" && p["asset_id"] == yt_id }
16+
end
17+
18+
if asset
19+
video_asset_id = asset["id"]
20+
dest_txt = File.join(staging_dir, "#{video_asset_id}.txt")
21+
22+
unless File.exist?(dest_txt)
23+
FileUtils.cp(txt_file, dest_txt)
24+
puts "Staged: #{yt_id} -> #{video_asset_id}.txt"
25+
staged_count += 1
26+
end
27+
end
28+
end
29+
30+
puts "Staged #{staged_count} new transcripts."

bin/transcripts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ case "$cmd" in
144144
--apply
145145
fi
146146

147-
./bin/audit_transcripts.rb
147+
bundle exec rake transcript:audit
148148
if [ "$SKIP_VALIDATE" -ne 1 ]; then
149149
run_validate
150150
fi
@@ -162,7 +162,7 @@ case "$cmd" in
162162
fi
163163
;;
164164
audit|status)
165-
./bin/audit_transcripts.rb
165+
bundle exec rake transcript:audit
166166
;;
167167
validate)
168168
run_validate

0 commit comments

Comments
 (0)