コード例 #1
0
def nest_music_file(drive: Drive, file: dict, destination: Path):
    artist, album, title = (sanitize_name(file[name])
                            for name in ['artist', 'album', 'title'])

    filepath = (destination / artist / album / title).with_suffix(
        file['path'].suffix)
    output = sanitize_path(filepath)

    drive.rename(file['path'], output)
コード例 #2
0
def flat_music_file(drive: Drive, file: dict, destination: Path):
    artist, album, title = (sanitize_name(file[name]) for name in ['artist', 'album', 'title'])

    name = f'{artist} - {album} - {title}'
    suffix = file['path'].suffix
    filepath = destination / (name + suffix)
    output = sanitize_path(filepath)

    drive.rename(file['path'], output)
コード例 #3
0
ファイル: test_sanitize.py プロジェクト: oroschz/arkive
def test_sanitize_name():
    assert sanitize_name("My/File") == "MyFile"
コード例 #4
0
ファイル: test_sanitize.py プロジェクト: oroschz/arkive
def test_sanitize_name_when_input_is_completely_illegal():
    assert sanitize_name("***") == "BLANK"
コード例 #5
0
ファイル: test_sanitize.py プロジェクト: oroschz/arkive
def test_sanitize_name_when_input_is_emtpy():
    assert sanitize_name("") == "BLANK"
コード例 #6
0
ファイル: test_sanitize.py プロジェクト: oroschz/arkive
def test_sanitize_name_when_input_is_none():
    assert sanitize_name(None) == "BLANK"