Dennis Rieke
Dennis Rieke

Reputation: 201

How to get the rating tag of a .m4a file in C#

I work with TagLib# to get the ratings of my .mp3 files this part is working so far, but I have absolutely no idea how to get the rating of a m4a file.

This is how i get the rating of a .mp3 file, but it doesn't work for m4a:

TagLib.File file = TagLib.File.Create(Dateipfad);
Tag tag = file.GetTag(TagLib.TagTypes.Id3v2);
TagLib.Id3v2.PopularimeterFrame rating = TagLib.Id3v2.PopularimeterFrame.Get((TagLib.Id3v2.Tag)tag, "Windows Media Player 9 Series", true);
byte rate = rating.Rating;

How can I get the rating of an m4a file?

Upvotes: 1

Views: 1839

Answers (2)

r2b2s
r2b2s

Reputation: 213

use https://atldotnet.codeplex.com/ for reading tag from a lot of format (mp3,m4a...)

and TagLib# for read/write (instal it from NuGet)

Upvotes: 0

MrSinatra
MrSinatra

Reputation: 36

I'm not an expert, but mp3tag, winamp, and twonky use the %rate% atom.

windows explorer writes to its own proprietary atom, but idk which one. (trying to figure that out is how I found this page)

iTunes afaik only keeps ratings in its DB and doesn't write them to tags.

mp3 uses id3, while m4a uses atoms.

Upvotes: 2

Related Questions