Created
July 17, 2014 09:52
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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