Skip to content

Instantly share code, notes, and snippets.

@mmeigooni
Last active December 18, 2015 08:00
Show Gist options
  • Save mmeigooni/5751121 to your computer and use it in GitHub Desktop.
Save mmeigooni/5751121 to your computer and use it in GitHub Desktop.
def archive_channel(id)
channel = Channel.find(id)
fullscreen = User.find("4df13267aa7f960021000001")
channel.remove_user( channel.channel_master.uid ) if channel.channel_master.present?
channel.update_channel({name:"archived_#{channel.name}", youtube_uid:"archived_#{channel.youtube_id}" })
channel.update_attributes(name:"archived_#{channel.name}", network_id: "4e68f7e0dfaebd0001000110", youtube_id:"archived_#{channel.youtube_id}")
channel.add_user( fullscreen.uid )
channel.videos.each { |vid| vid.update_attributes(youtube_video_id:"archived_#{vid.youtube_video_id}", title:"archived_#{vid.title}")}
end
# Only use this when a channel has no earnings
def delete_channel(id)
channel = Channel.find(id)
channel.remove_user( channel.channel_master.uid ) if channel.channel_master.present?
channel.delete
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment