Skip to content

Instantly share code, notes, and snippets.

@hennevogel
Created July 17, 2014 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hennevogel/967ecfb4e6e527dc4954 to your computer and use it in GitHub Desktop.
Save hennevogel/967ecfb4e6e527dc4954 to your computer and use it in GitHub Desktop.
This is a script to batch assign youtube video IDs to OSEM event GUIDs
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
mapping = {
"kVYMYCvraFSdnKu_qEugfg" => "jFrqHgk2258",
"5vA7x02ejJY2hfGs3tmA8w" => "dpzVjFuKwyo" }
mapping.each do |guid, yid|
event = Event.find_by_guid(guid)
if event.nil? || !event.media_id.blank?
puts "Skipping #{guid}"
next
end
puts "Updating #{guid}"
event.update_column(:media_id, yid)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment