Ejemplo n.º 1
0
def unSaveVideo(conn, youtube_id, user_id):
    cursor = conn.cursor()
    # Find the node to remove, identify the node it points to
    cursor.execute("SELECT id, next_id FROM user_youtube_map WHERE user_id = %s and youtube_id = \"%s\"" % \
                       (user_id, youtube_id))
    unsave_nodes = cursor.fetchall()
    if not unsave_nodes:
        return
    unsave_node_id, unsave_node_next_id = unsave_nodes[0]

    # Find the node that points the node we will be removing
    cursor.execute("SELECT id FROM user_youtube_map WHERE next_id = %s" % \
                       unsave_node_id)
    unsave_pointers = cursor.fetchall()
    if unsave_pointers:
        unsave_pointer_id = unsave_pointers[0][0]
        cursor.execute("UPDATE user_youtube_map SET next_id = %s where id = %s" % \
                           (unsave_node_next_id or 'NULL', unsave_pointer_id))

    viddb.delete(conn, 'user_youtube_map','id=%s' % unsave_node_id)
Ejemplo n.º 2
0
def clearUserTags(conn, userID):
    viddb.delete(conn,
                 'tags',
                 'user_id = %s' %\
                     (userID))
Ejemplo n.º 3
0
def untagVideo(conn, userID, ytID, tagName):
    viddb.delete(conn,
                 'tags',
                 'user_id = %s AND youtube_id = "%s" AND tag_name = "%s"' %\
                     (userID, ytID, tagName))