import re


def get_osu_file_name(metadata):
    """
    Construct the .osu file name from the metadata.
    """
    artist = metadata["artist"];
    title = metadata["title"];
    creator = metadata["creator"];
    diffname = metadata["diffname"];
    outname = (artist+" - " if len(artist) > 0 else "") + title + " (" + creator + ") [" + diffname + "].osu";
    outname = re.sub("[^a-zA-Z0-9\(\)\[\] \.\,\!\~\`\{\}\-\_\=\+\&\^\@\#\$\%\;\']","", outname);
    return outname;