예제 #1
0
def album(filename="album.tgit",
          of_type=Album.Type.FLAC,
          images=(),
          tracks=(),
          **meta):
    new_album = Album(filename=filename, of_type=of_type)

    for tag, value in meta.items():
        setattr(new_album, tag, value)

    for current_image in images:
        new_album.add_image(*current_image)

    for current_track in tracks:
        new_album.add_track(current_track)

    return new_album
예제 #2
0
def load_project(filename):
    album_folder = dirname(filename)
    tracks_folder = join(album_folder, TRACKS_FOLDER_NAME)
    artwork_folder = join(album_folder, ARTWORK_FOLDER_NAME)

    data = yaml.read_data(filename)
    if Version(data["version"]) < "1.10.0":
        data = _from_1_9_to_1_11(data)
    album = Album(Metadata(data), of_type=data["type"], filename=filename)

    for image in data["images"]:
        mime, filename, type_, desc = image
        album.add_image(mime, fs.read(join(artwork_folder, filename)), type_, desc)

    for track in data["tracks"]:
        album.add_track(_load_track(data["version"], tracks_folder, track))

    return album
예제 #3
0
def load_project(filename):
    album_folder = dirname(filename)
    tracks_folder = join(album_folder, TRACKS_FOLDER_NAME)
    artwork_folder = join(album_folder, ARTWORK_FOLDER_NAME)

    data = yaml.read_data(filename)
    if Version(data["version"]) < "1.10.0":
        data = _from_1_9_to_1_11(data)
    album = Album(Metadata(data), of_type=data["type"], filename=filename)

    for image in data["images"]:
        mime, filename, type_, desc = image
        album.add_image(mime, fs.read(join(artwork_folder, filename)), type_,
                        desc)

    for track in data["tracks"]:
        album.add_track(_load_track(data["version"], tracks_folder, track))

    return album