패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.2.1

audiotagger

MP3 파일의 ID3 태그를 읽고 쓸 수 있는 라이브러리입니다. 데이터를 Map 객체 또는 Tag 객체로 얻을 수 있습니다.

30일 다운로드
183
좋아요
47
Pub 점수
70

패키지 설치

flutter pub add audiotagger

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Audiotagger는 MP3 파일 내 ID3 태그를 읽고 쓸 수 있도록 해주는 Flutter/Dart 패키지입니다. 제목, 아티스트, 앨범 등 메타데이터에 접근할 수 있으며, 데이터를 Map 객체 또는 구조화된 Tag 객체로 반환합니다. 오디오 관리 앱에 적합하며 외부 종속성 없이 기본적인 태그 조작을 지원합니다. 라이브러리는 가볍고 핵심 기능에 집중되어 있어, 음악 애플리케이션에서 간단한 ID3 태그 처리가 필요한 개발자에게 적합합니다.

사용 사례

  • MP3 메타데이터 편집
  • 노래 정보 읽기
  • 배치 태그 업데이트
  • 음악 앱 개발
  • 오디오 파일에서 메타데이터 추출

주요 기능

  • ID3 태그 읽기 및 쓰기
  • 맵 및 태그 개체 출력을 지원합니다
  • 가볍고 간단한 API
  • 외부 종속성 없음
  • 크로스 플랫폼 호환성

적합한 대상

  • 오디오 파일을 사용하는 플러터 개발자
  • MP3 메타데이터 관리가 필요한 앱
  • 간단한 태그 편집 도구
  • 오디오 라이브러리 통합
  • 데스크톱 및 모바일 오디오 애플리케이션

고려 사항

  • ID3 태그에 한정됨(다른 형식은 제외)
  • 고급 태그 유형에 대한 지원 없음
  • 플랫폼별 파일 액세스가 필요합니다
  • 다른 오디오 형식을 처리하지 않습니다
  • 파일 작업에 대한 수동 오류 처리가 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

audiotagger

build status pub

This library allow you to read and write ID3 tags to MP3 files.
Based on JAudiotagger library.

Library actually works only on Android.

Add dependency

dependencies:
  audiotagger: ^2.2.1

Audiotagger need access to read and write storage.
To do this you can use Permission Handler library.

Table of contents

Basic usage

Initialize a new instance of the tagger;

final tagger = new Audiotagger();

Reading operations

Read tags as Tag object

Obtain ID3 tags of the file as a Tag object.

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

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 tags as map

Obtain ID3 tags of the file as a Map.

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

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

The map has this schema: Map of Tag schema.

Read artwork

Obtain the artwork of the song as a Uint8List.

void getArtwork() async {
    final String filePath = "/storage/emulated/0/file.mp3";
    final Uint8List bytes = await tagger.readArtwork(
        path: filePath
    );
}
Read audio file as AudioFile object

Obtain informations about the MP3 file as a Tag object.

void getAudioFile() async {
    final String filePath = "/storage/emulated/0/file.mp3";
    final AudioFile audioFile = await tagger.readAudioFile(
        path: filePath
    );
}

The AudioFile object has this schema: AudioFile schema.

Read audio file as map

Obtain informations about the MP3 file as a Map.

void getAudioFileAsMap() async {
    final String filePath = "/storage/emulated/0/file.mp3";
    final Map map = await tagger.readAudioFileAsMap(
        path: filePath
    );
}

The map has this schema: Map of AudioFile schema.

Writing operations

Write tags from map

You can write the ID3 tags from a Map.
To reset a field, pass an empty string ("").
If the value is null, the field will be ignored and it will not be written.

void setTagsFromMap() async {
    final path = "storage/emulated/0/Music/test.mp3";
    final tags = <String, String>{
        "title": "Title of the song",
        "artist": "A fake artist",
        "album": "",    //This field will be reset
        "genre": null,  //This field will not be written
    };

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

The map has this schema: Map of Tag schema.

Write tags from Tag object

You can write the ID3 tags from a Tag object.
To reset a field, pass an empty string ("").
If the value is null, the field will be ignored and it will not be written.

void setTags() async {
    final path = "storage/emulated/0/Music/test.mp3";
    final tag = Tag(
        title: "Title of the song",
        artist: "A fake artist",
        album: "",    //This field will be reset
        genre: null,  //This field will not be written
    );

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

The Tag object has this schema: Tag schema.

Write single tag field

You can write a single tag field by specifying the field name.
To reset the field, pass an empty string ("").
If the value is null, the field will be ignored and it will not be written. \

void setTags() async {
    final path = "storage/emulated/0/Music/test.mp3";

    final result = await tagger.writeTag(
        path: path,
        tagField: "title",
        value: "Title of the song"
    );
}

Refer to Map of Tag schema for fields name.

Models

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

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;
String? artwork; // It represents the file path of the song artwork.
Map of Tag
<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,
    "artwork": value, // Null if obtained from readTags or readTagsAsMap
};
AudioFile class
int? length;
int? bitRate;
String? channels;
String? encodingType;
String? format;
int? sampleRate;
bool? isVariableBitRate;
Map of AudioFile
<String, dynamic?>{
    "length": length,
    "bitRate": bitRate,
    "channels": channels,
    "encodingType": encodingType,
    "format": format,
    "sampleRate": sampleRate,
    "isVariableBitRate": isVariableBitRate,
};

Copyright and license

This library is developed and maintained by Nicolò Rebaioli
:globe_with_meridians: My website
:mailbox: [niko.reba@gmail.com](mailto:niko.reba@gmail.com)

Released under MIT license

Copyright 2021 Nicolò Rebaioli

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트