sanket143 / id3

A cross platform dart package to extract meta data from mp3 files.
https://pub.dev/packages/id3/
MIT License
13 stars 6 forks source link

getting only first letter. #2

Closed 4-alok closed 4 years ago

4-alok commented 4 years ago
void info() {
MP3Instance mp3instance = new MP3Instance("/storage/emulated/0/Download/Army_320-(Mr-Jat.in).mp3");
    if(mp3instance.parseTagsSync()){
      print(mp3instance.getMetaTags());
      print(mp3instance.metaTags['Title']);
      print(mp3instance.metaTags['Artist']);
      print(mp3instance.metaTags['Album']);
      print(mp3instance.metaTags['Year']);
      print(mp3instance.metaTags['Genre']);
    }
}

Console output

I/flutter ( 6995): {Version: v2.3.0, Title: A
I/flutter ( 6995): A
I/flutter ( 6995): S
I/flutter ( 6995): H
I/flutter ( 6995): 2
I/flutter ( 6995): M

or may be i am wrong somewhere

Park57 commented 4 years ago

I have the same problem but the function remove the 2 firsts letters

if you find the solution tell me please ;)

4-alok commented 4 years ago

I shifted to flutter_audio_query, you may try this.

technoqz commented 4 years ago

Curious.. it work from a console, but in flutter it shows only version... and maybe part of a song title.

technoqz commented 4 years ago

If replace cleanFrame function with this then it works for me in Flutter, but i can't guarantee for all =)

List<int> cleanFrame(List<int> bytes) {
  if (bytes.length > 3) {
    List<int> newBytes = [];
    newBytes.addAll(bytes.sublist(3));
    newBytes.removeWhere((item) => item < 1);
    return newBytes;
  } else {
    return bytes;
  }
}
Maurosen commented 4 years ago

Thx this works for me

sanket143 commented 4 years ago

@technoqz that looks good. How about we do this to clean it beforehand?

List<int> cleanFrame(List<int> bytes) {
  List<int> temp = new List<int>.from(bytes);

  temp.removeWhere((item) => item < 1); 

  if (temp.length > 3) {
    return temp.sublist(3);
  } else {
    return temp;
  }
}

I haven't encountered any issues until now but can you test with the files you tested your patch with and make a PR with either version that works.