audiotagger 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

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

1.0.0 #

example/README.md

audiotagger_example #

Demonstrates how to use the audiotagger plugin.

Actually works only on Android.

The app has has an output widget and 3 buttons.

Explanation #

Initially the utput widget will be a Text widget with writed Ready..

By clicking Read tags you'll fire tagger.readTagsAsMap method, and the output will be showed you as a JSON string in Text widget.
This widget will replace the output one.

By clicking Read artwork you'll fire tagger.readArtwork method, and the output will show you the image in the output widget.

By clicking Write tags you'll fire tagger.writeTagsFromMap method, and the output will be showed you in Text widget. The text will be true if the operation success, false instead.
This widget will replace the output one.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  audiotagger: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:audiotagger/audiotagger.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
22
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
permission_handler ^3.2.2 3.2.2
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test