File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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."
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments