Skip to content

Commit

Permalink
Add thumbnails for Child Talks via ThumbnailExtractor and `Download…
Browse files Browse the repository at this point in the history
…er` (#498)
  • Loading branch information
marcoroth authored Dec 7, 2024
1 parent 9573fe8 commit 88bc5b6
Show file tree
Hide file tree
Showing 617 changed files with 291 additions and 96 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ jobs:
- name: Run Seed Smoke Test
run: bin/rails test test/tasks/db_seed_test.rb

- name: Verify all thumbnails for child talks are present
run: bin/rails verify_thumbnails
deploy:
needs: [lint, test, seed_smoke_test]
name: Deploy
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ gem "iso-639"
# A minimal client of Bluesky/ATProto API
gem "minisky", "~> 0.4.0"

# Extract Collaborator Objects from your Active Records, a new concept called Associated Objects
gem "active_record-associated_object"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[mri windows]
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ GEM
active_link_to (1.0.5)
actionpack
addressable
active_record-associated_object (0.8.2)
activerecord (>= 6.1)
activejob (8.0.0)
activesupport (= 8.0.0)
globalid (>= 0.3.6)
Expand Down Expand Up @@ -590,6 +592,7 @@ PLATFORMS

DEPENDENCIES
active_job-performs (~> 0.3.1)
active_record-associated_object
ahoy_matey
annotaterb
appsignal
Expand Down
61 changes: 54 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,68 @@ require_relative "config/application"

Rails.application.load_tasks

def run(command)
puts command
output = `#{command}`
desc "Verify all talks with start_cue have thumbnails"
task verify_thumbnails: :environment do |t, args|
thumbnails_count = 0
child_talks_with_missing_thumbnails = []

Talk.where(meta_talk: true).flat_map(&:child_talks).each do |child_talk|
if child_talk.static_metadata
if child_talk.static_metadata.start_cue.present? && child_talk.static_metadata.start_cue != "TODO"
if child_talk.thumbnail_extractor.thumbnail_path.exist?
thumbnails_count += 1
else
puts "missing thumbnail for child_talk: #{child_talk.video_id} at: #{child_talk.thumbnail_extractor.thumbnail_path}"
child_talks_with_missing_thumbnails << child_talk
end
end
else
puts "missing static_metadata for child_talk: #{child_talk.video_id}"
child_talks_with_missing_thumbnails << child_talk
end
end

if child_talks_with_missing_thumbnails.any?
raise "missing #{child_talks_with_missing_thumbnails.count} thumbnails"
else
puts "All #{thumbnails_count} thumbnails present!"
end
end

desc "Download mp4 files for all meta talks"
task download_meta_talks: :environment do |t, args|
Talk.where(meta_talk: true).each do |meta_talk|
meta_talk.downloader.download!
end
end

puts output
desc "Download mp4 files for all meta talks with missing thumbnails"
task download_missing_meta_talks: :environment do |t, args|
meta_talks = Talk.where(meta_talk: true)
extractable_meta_talks = meta_talks.select { |talk| talk.thumbnail_extractor.extractable? }
missing_talks = extractable_meta_talks.reject { |talk| talk.thumbnail_extractor.extracted? }
missing_talks_without_downloads = missing_talks.reject { |talk| talk.downloader.downloaded? }

output
puts "Found #{missing_talks_without_downloads.size} missing talks without downloaded videos."

missing_talks_without_downloads.each do |talk|
talk.downloader.download!
end
end

desc "Fetch thumbnails for meta talks for all cues"
task extract_thumbnails: :environment do |t, args|
Talk.where(meta_talk: true).each do |meta_video|
meta_video.thumbnail_extractor.extract!
end
end

desc "Export Conference assets"
task :export_assets, [:conference_name] => :environment do |t, args|
sketchtool = "/Applications/Sketch.app/Contents/Resources/sketchtool/bin/sketchtool"
sketch_file = "./RubyVideo.sketch"

response = JSON.parse(run("#{sketchtool} list artboards #{sketch_file}"))
response = JSON.parse(Command.run("#{sketchtool} list artboards #{sketch_file}"))
pages = response["pages"]

conference_pages = pages.select { |page| page["artboards"].any? && Static::Playlist.where(title: page["name"]).any? }
Expand Down Expand Up @@ -49,7 +96,7 @@ task :export_assets, [:conference_name] => :environment do |t, args|
item_ids = artboard_exports.map { |artboard| artboard["id"] }.join(",")
target_directory = Rails.root.join("app", "assets", "images", "events", event.organisation.slug, event.slug)

run "#{sketchtool} export artboards #{sketch_file} --items=#{item_ids} --output=#{target_directory} --save-for-web=YES --formats=webp"
Command.run "#{sketchtool} export artboards #{sketch_file} --items=#{item_ids} --output=#{target_directory} --save-for-web=YES --formats=webp"
end
end

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 88bc5b6

Please sign in to comment.