Exemplo n.º 1
0
def addSong():
    path = app.openBox('select a song to add', fileTypes=[('Audio', '*.mp3')])
    if path:
        name = ntpath.basename(path)
        app.infoBox('test', path + '\n' + name)
        bangericity = 0.0
        while True:
            bangericity = app.floatBox(
                'bangericity input', 'enter a\
             bangericity from 0 to 100')
            if bangericity is None:
                # user cancelled
                break
            # validate bangericity
            if 0 <= bangericity and bangericity <= 100:
                break
            app.errorBox(
                'invalid bangericity box', 'Error: bangericity must be\
             between 0 and 100')
        if bangericity is not None:
            try:
                db.addSong(path, name, bangericity)
            except FileExistsError:
                app.errorBox(
                    'duplicate song error box',
                    'Error: A song with this name already exists. The song will\
                     not be added.')
            updateSongTable()
Exemplo n.º 2
0
songDir = 'D:\\OneDrive\\Music\\7-7-18 additions'
songNames = os.listdir(songDir)


def songPath(name):
    return os.path.join(songDir, name)


songPaths = [songPath(name) for name in songNames]
i = 0
for songPath in songPaths:
    songName = ntpath.basename(songPath)
    bangericity = bangericities[i]
    i += 1
    db.addSong(songPath, songName, bangericity)
'''
<Song(name="Dear You - Yuduki", bangericity="85.0")>,
 <Song(name="Sendan Life - Hanamori Yumiri", bangericity="87.0")>,
 <Song(name="Asymmetry - Reol", bangericity="92.0")>,
 <Song(name="Imaginary Like the Justice - GUMI", bangericity="90.0")>,
 <Song(name="Bad Apple!!", bangericity="88.0")>,
 <Song(name="Virtual Paradise - AK x LYNX ft. Veela", bangericity="89.0")>,
 <Song(name="Wareta Ringo - Shinsekai Yori ED1", bangericity="88.0")>,
 <Song(name="Koi Wa Chaos No Shimobe Nari full - Haiyore Nyaruko OP", bangericity="90.0")>,
 <Song(name="ひとり full - Darling in the FranXX ED 4", bangericity="90.0")>,
 <Song(name="A Cruel Angel's Thesis - Neon Genesis Evangelion OP", bangericity="85.0")>,
 <Song(name="Parallel Line - Sayuri", bangericity="87.0")>,
 <Song(name="Noushou Sakuretsu Girl - Hatsune Miku", bangericity="90.0")>,
 <Song(name="Sorewa Chiisana Hikari No Youna full - Erased ED", bangericity="90.0")>,
 <Song(name="Hitorigoto - Eromanga Sensei OP1", bangericity="90.0")>,