Exemplo n.º 1
0
def add_video(request):
    video_url = request.args.get('video_url', '')
    name = request.args.get('name', '')
    if not name:
      name = ""
    try:
        video = Video(
            name = name,
            video_url =  video_url
            )
        video.save()
    except:
        print "Unexpected error:", sys.exc_info()
    dict_notify = {'notify': "video_added", "id": str(video['id']) }
    pipe_left.send(cPickle.dumps(dict_notify))
    return ""
Exemplo n.º 2
0
def delete_video():
    unique_ids = request.args.get('unique_id', '')
    unique_ids = unique_ids.split(',')
    for unique_id in unique_ids:
      item = Video.objects(id = unique_id)
      item.delete()
      dict_notify = {'notify': "video_deleted", "id": unique_id }
      pipe_left.send(cPickle.dumps(dict_notify))
    return ""