audiotagger 1.0.1 copy "audiotagger: ^1.0.1" to clipboard
audiotagger: ^1.0.1 copied to clipboard

outdated

Library to read and write ID3 tags to MP3 files. You can get data as Map object or Tag object.

audiotagger #

build status pub

This library allow yoy to read and write ID3 tags to MP3 files.

Library actually works only on Android.

Add dependency #

dependencies:
  audiotagger: ^1.0.1

Table of contents #

Basic usage for any operation #

Initialize a new instance of the tagger;

final tagger = new Audiotagger();

Any operation has a checkPermission boolean parameter. By setting it to true, the tagger will check for storage read and write permission, before to start the operations.

Reading operations #

Read tags as map #

You can get a Map of the ID3 tags.

void getTagsAsMap() async {
    final String filePath = "/storage/emulated/0/file.mp3";
    final Map map = await tagger.readTagsAsMap({
        path: filePath,
        checkPermission: true,
    });
}

This method does not read the artwork of the song. To do this, use the readArtwork method.

The map has this schema:Tag schema.

Read tags as Tag object #

You can get a Tag object of the ID3 tags.

void getTags() async {
    final String filePath = "/storage/emulated/0/file.mp3";
    final Tag tag = await tagger.readTags({
        path: filePath,
        checkPermission: true,
    });
}

This method does not read the artwork of the song. To do this, use the readArtwork method.

The Tag object has this schema: Tag schema.

Read artwork #

To get the artwork of the song, use this method.

void getArtwork() async {
    final String filePath = "/storage/emulated/0/file.mp3";
    final Uint8List bytes = await tagger.readArtwork({
        path: filePath,
        checkPermission: true,
    });
}

It return a Uint8List of the bytes of the artwork.

Writing operations #

Write tags from map #

You can write the ID3 tags from a Map.

void setTagsFromMap() async {
    final path = "storage/emulated/0/Music/test.mp3";
    final tags = <String, String>{
        "title": "Viva la vita",
        "artist": "Renato Pozzetto",
        "album": "Viva la vita - album",
    };

    final result = await tagger.writeTagsFromMap(
        path: path,
        tags: tags,
        checkPermission: true,
    );
}

The map has this schema:Tag schema.

Write tags from Tag object #

You can write the ID3 tags from a Tag object.

void setTags() async {
    final path = "storage/emulated/0/Music/test.mp3";
    final tags = <String, String>{
        "title": "Viva la vita",
        "artist": "Renato Pozzetto",
        "album": "Viva la vita - album",
    };
    final tag = Tag.fromMap(tags);

    final result = await tagger.writeTags(
        path: path,
        tag: tag,
        checkPermission: true,
    );
}

The Tag object has this schema: Tag schema.

Models #

These are the schemes of the Map asked and returned by Audiotagger and of the Tag class.

Map of tags #

<String, String>{
    "title": value,
    "artist": value,
    "genre": value,
    "trackNumber": value,
    "trackTotal": value,
    "discNumber": value,
    "discTotal": value,
    "lyrics": value,
    "comment": value,
    "album": value,
    "albumArtist": value,
    "year": value,
};

Tag class #

    String title;
    String artist;
    String genre;
    String trackNumber;
    String trackTotal;
    String discNumber;
    String discTotal;
    String lyrics;
    String comment;
    String album;
    String albumArtist;
    String year;
    Uint8List artwork;

This library is developed and maintained by Nicolò Rebaioli
🌐 My website
📫 niko.reba@gmail.com

Released under MIT license

Copyright 2019 Nicolò Rebaioli

47
likes
0
points
251
downloads

Publisher

unverified uploader

Weekly Downloads

Library to read and write ID3 tags to MP3 files. You can get data as Map object or Tag object.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, permission_handler

More

Packages that depend on audiotagger

Packages that implement audiotagger