def up_richard(self, ep): host = pw.richard[ep.show.client.richard_id] endpoint = 'http://{hostname}/api/v2'.format(hostname=host['host']) v_id = get_video_id(ep.public_url) video_data = get_video(api_url=endpoint, auth_token=host['api_key'], video_id=v_id) if video_data['state'] == STATE_LIVE: print "Already STATE_LIVE, 403 coming." else: video_data['state'] = 1 try: update_video(endpoint, auth_token=host['api_key'], video_id=v_id, video_data=video_data) except Http4xxException as exc: print exc print "told you this was coming." except MissingRequiredData as exc: print exc # this shouldn't happen, prolly debugging something. import code code.interact(local=locals()) return True
def up_richard(self, ep): host = pw.richard[ep.show.client.richard_id] endpoint = "http://{hostname}/api/v2".format(hostname=host["host"]) v_id = get_video_id(ep.public_url) video_data = get_video(api_url=endpoint, auth_token=host["api_key"], video_id=v_id) if video_data["state"] == STATE_LIVE: print "Already STATE_LIVE, 403 coming." else: video_data["state"] = 1 try: update_video(endpoint, auth_token=host["api_key"], video_id=v_id, video_data=video_data) except Http4xxException as exc: print exc print "told you this was coming." except MissingRequiredData as exc: print exc # this shouldn't happen, prolly debugging something. import code code.interact(local=locals()) return True
def mk_key(self, ep, f): # make a key for rackspace cdn object key value store # <category-slug>/<video-id>_<title-of-video>.mp4 # if we have that data handy. key = '' if ep.show.client.category_key: # warning: this does not take into account pvo collisions # https://github.com/willkg/richard/blob/master/richard/videos/utils.py#L20 def generate_unique_slug(obj, slug_from, slug_field='slug'): key += slugify( ep.show.client.category_key ) + '/' if ep.public_url: key += get_video_id( ep.public_url) + "_" key += ep.slug[:50] + "." + f['ext'] return key
def mk_key(self, ep, f): # make a key for rackspace cdn object key value store # <category-slug>/<video-id>_<title-of-video>.mp4 # if we have that data handy. # otherwise client/show/slug key = '' if ep.show.client.category_key: # warning: this does not take into account pvo collisions # https://github.com/willkg/richard/blob/master/richard/videos/utils.py#L20 def generate_unique_slug(obj, slug_from, slug_field='slug'): key += slugify(ep.show.client.category_key) + '/' else: key += ep.show.client.slug + '/' + ep.show.client.slug + '/' if ep.public_url: key += get_video_id(ep.public_url) + "_" key += ep.slug[:50] + "." + f['ext'] return key
def up_richard(self, ep): host = pw.richard[ep.show.client.richard_id] endpoint = 'http://{hostname}/api/v1'.format(hostname=host['host']) api = API(endpoint) # vid = ep.public_url.split('/video/')[1].split('/')[0] vid = get_video_id(ep.public_url) response = api.video(vid).get( username=host['user'], api_key=host['api_key']) video_data = get_content(response) video_data['state'] = 1 try: update_video(endpoint, host['user'], host['api_key'], vid, video_data) except MissingRequiredData, e: # this shouldn't happen, prolly debugging something. import code code.interact(local=locals())