示例#1
0
def get_path_of_componist(componist_id):
    if componist_id is None:
        ColorPrint.print_c('No componist ID given, so quitting',
                           ColorPrint.RED)
        return
    conn, c = connect()
    return get_componist_path_c(componist_id, c)
示例#2
0
def migrate_path_person(table):
    sql = 'SELECT FirstName, LastName, Path, ID FROM ' + table +  \
          ' ORDER BY LastName'
    items = get_items(sql)
    con, c = connect()
    for item in items:
        update_path_person(table, c, con, item[3], item[2], item[0], item[1])
示例#3
0
def migrate_path_album():
    sql = 'SELECT Title, Path, ID FROM Album' +  \
          ' ORDER BY Title'
    items = get_items(sql)
    con, c = connect()
    for item in items:
        update_path_album(item[2], item[1], c, con)
    print('albums: ' + str(len(items)))
示例#4
0
def process_album(path,
                  componist_id=None,
                  performer_id=None,
                  mother_id=None,
                  is_collectie=0):
    """
    haal stukken (cuesheets en music files) op voor een album
    """
    # if len(path.split('[')) > 1:
    #     print('from: ' + __file__, currentframe().f_lineno)
    #     ColorPrint.print_c('cue_path mag geen accolades of vierkante haken bevatten - quitting', ColorPrint.RED)
    #     return -1
    path = decode_semi_colon(path)
    if not os.path.exists(path):
        print('from: ' + __file__, currentframe().f_lineno)
        ColorPrint.print_c('This directory does not exist - quitting',
                           ColorPrint.RED)
        return
    # if has_music_files(path):
    #     print('from: ' + __file__, currentframe().f_lineno)
    #     ColorPrint.print_c('No music files in this directory - quitting',
    #                        ColorPrint.RED)
    #     return

    conn, c = connect()
    w = path.split('/')
    album_title = w[-1].replace("_", " ")
    p = path[len(AUDIO_ROOT):]
    album_id = insert_album(
        title=album_title,
        path=p,
        is_collectie=is_collectie,
        c=c,
        conn=conn,
        album_id=mother_id,
    )[0]
    print('from: ' + __file__, currentframe().f_lineno)
    ColorPrint.print_c("created album id: {}".format(album_id),
                       ColorPrint.LIGHTCYAN)
    insert_pieces(path, album_id, conn, c)
    if componist_id:
        insert_componist_by_id(componist_id, c, conn, album_id)
    if performer_id:
        insert_performer_by_id(performer_id, c, conn, album_id)
    conn.close()
    return album_id
示例#5
0
def process_pieces(path, album_id):
    conn, c = connect()
    insert_pieces(path, album_id, conn, c)
示例#6
0
def componist_from_album(album_id):
    conn, c = connect()
    cid = get_componist_id_from_album(album_id, c)
    return cid
示例#7
0
def insert_composer2(name):
    conn, c = connect()
    return insert_componist(name, c, conn)
示例#8
0
def get_path_by_componistid(album_id):
    conn, c = connect()
    return get_componist_path_by_id(album_id, c)
示例#9
0
def get_path_by_albumid(album_id):
    conn, c = connect()
    return get_album_path_by_id(album_id, c)
示例#10
0
def get_path_of_album(album_id):
    if album_id is None:
        ColorPrint.print_c('No album ID given, so quitting', ColorPrint.RED)
        return
    conn, c = connect()
    return get_album_path_by_id(album_id, c)
示例#11
0
def rename_titles(path):
    conn, c = connect()
    rename_all_titles(path, SKIP_DIRS, c, conn)
示例#12
0
def count_album_by_path(p):
    conn, c = connect()
    found = get_album_count_by_path(p, c, conn)
    return found['Count']
示例#13
0
def album_by_path(p):
    conn, c = connect()
    return get_album_by_path(p, c)