def choice_c(moods, db):
    print "Choose a mood from the options below:"
    for mood in moods:
        print mood

    chosenMood = raw_input('Enter choice: ')
    while chosenMood not in moods:
        chosenMood = raw_input('Please enter one of the options above: ')

    print "Max length of your playlist: "
    x = True
    while x:
        maxlen = raw_input("> ")
        try:
            maxlen = int(maxlen)
            x = False
        except:
            print "Cannot be converted to integer, try again."
    # make playlist
    p = Playlist(db, moods)
    p.add_mood(chosenMood)
    p.generate_list_mood()

    plist = p.get_list(maxlen)
    for s in plist:
        print str(s)

    print "Save as .m3u? y/n"
    save = raw_input("> ")
    if save == "y":
        m3u = open("playlist.m3u", "wb")
        for song in plist:
            print >> m3u, song
Exemple #2
0
def choice_c(moods, db):
    print "Choose a mood from the options below:"
    for mood in moods:
        print mood

    chosenMood = raw_input('Enter choice: ')
    while chosenMood not in moods:
        chosenMood = raw_input('Please enter one of the options above: ')

    print "Max length of your playlist: "
    x = True
    while x:
        maxlen = raw_input("> ")
        try:
            maxlen = int(maxlen)
            x = False
        except:
            print "Cannot be converted to integer, try again."
    # make playlist
    p = Playlist(db, moods)
    p.add_mood(chosenMood)
    p.generate_list_mood()
        
    plist = p.get_list(maxlen)
    for s in plist:
        print str(s)

    print "Save as .m3u? y/n"
    save = raw_input("> ")
    if save == "y":
        m3u = open("playlist.m3u","wb")
        for song in plist:
            print>>m3u, song
def run_sandbox():
    print "****************\nWelcome to the sandboxed MoodMusic\n****************"
    print "\nYou are using our DB of thousands of songs so that you can test our machine learning algorithms\n"

    #Makes the DB_Helper use Tom's Sandbox DB
    db = DB_Helper()

    print "Choose a mood from the options below:"
    moods = DB_Helper().all_moods()
    for mood in moods:
        print mood

    chosenMood = raw_input('Enter choice: ')
    while chosenMood not in moods:
        chosenMood = raw_input('Please enter one of the options above: ')

    print "Max length of your playlist: "
    x = True
    while x:
        maxlen = raw_input("> ")
        try:
            maxlen = int(maxlen)
            x = False
        except:
            print "Cannot be converted to integer, try again."
    # make playlist
    p = Playlist(db, moods)
    p.add_mood(chosenMood)
    p.generate_list_mood()

    plist = p.get_list(maxlen)
    for s in plist:
        print str(s)

    print "Save as .m3u? y/n"
    save = raw_input("> ")
    if save == "y":
        m3u = open("playlist.m3u", "wb")
        for song in plist:
            print >> m3u, song
Exemple #4
0
def run_sandbox():
    print "****************\nWelcome to the sandboxed MoodMusic\n****************"
    print "\nYou are using our DB of thousands of songs so that you can test our machine learning algorithms\n"

    #Makes the DB_Helper use Tom's Sandbox DB
    db = DB_Helper()

    print "Choose a mood from the options below:"
    moods = DB_Helper().all_moods()
    for mood in moods:
        print mood

    chosenMood = raw_input('Enter choice: ')
    while chosenMood not in moods:
        chosenMood = raw_input('Please enter one of the options above: ')

    print "Max length of your playlist: "
    x = True
    while x:
        maxlen = raw_input("> ")
        try:
            maxlen = int(maxlen)
            x = False
        except:
            print "Cannot be converted to integer, try again."
    # make playlist
    p = Playlist(db, moods)
    p.add_mood(chosenMood)
    p.generate_list_mood()
    
    plist = p.get_list(maxlen)
    for s in plist:
        print str(s)

    print "Save as .m3u? y/n"
    save = raw_input("> ")
    if save == "y":
        m3u = open("playlist.m3u","wb")
        for song in plist:
            print>>m3u, song