GNOME Bugzilla – Bug 500034
Save Rating and Play Count to files
Last modified: 2009-01-13 22:32:41 UTC
Under preferences, I opted for Banshee to write metadata to files. However, I found that Banshee does not write "play count" to the ID3 tag of the mp3 that I'm playing.
Also, Banshee doesn't seem to read the existing play counts in files. This is a problem as I am moving between players and won't have smart playlists any more.
This is interesting; I didn't even know such a thing were supported in ID3 tags. From a quick perusal, it seems that this isn't tracked by any other programs. Do you know of any programs that store the play count in the ID3 tags?
No; I spent a while looking through popular Linux media players and didn't come across any that do track play count via updates to the ID3 tag. I was really happy when I came across Banshee because it presented me with the option to "write metadata to file" which was something that no other player offered. Note: There are ID3 parsers/editors like TagLib (http://developer.kde.org/~wheeler/taglib.html), id3lib (http://id3lib.sourceforge.net/) and eyed3 (http://eyed3.nicfit.net/) that can display and edit ID3 tag fields including the playcount and popularity-meter, but don't seem to be used by these players.
Most media players use a specialized database/library to track playcount, popularity etc, except I think that is wrong because it implies that people lose all the interesting attributes about their music. This sucks when:
1) They move between media players and lose all their tags.
2) Their music player database gets corrupted and they lose all their tags because they backed up their music, but not the player database (http://www.dashes.com/anil/2007/01/my-library-is-d-1.html).
I guess the only reason not to do this would be if the music is available in a read-only manner (e.g.: a single multimedia storage server accessed over a LAN).
There was a bug with how we wrote Artist out to the files, but that's fixed now. Renaming this bug to the part that's not yet fixed.
ID3v2 and TagLib# support saving the play count and rating in files. Maybe this should be another option ('Write play counts and ratings to files') since it's saving personal information, essentially.
In terms of moving from one player to another, we have migrations that do that - what player are you coming from?
mutagen (from quodlibet) can display such additional frames in mp3 headers. I used foobar in Windows which can create arbitrarily named tags. The tag "RATING" e.g. is displayed as "TXXX=RATING=4", so the type/name of the frame is "TXXX" and the value is "RATING=4".
I'd also love this option because all my music is already tagged!
*** Bug 538770 has been marked as a duplicate of this bug. ***
Created attachment 112934 [details] [review]
Import rating from ID3 tags
I created a patch that reads the rating from ID3v2 tags. It does NOT write changed ratings back to the file.
Please review the code - it's my first code in C#.
Greetings to all
Unfortunately the importing gets quite slow by this patch. Any ideas why?
Ok, this was a problem with our API. Setting the Rating of a DatabaseTrackInfo object was triggering it to Save, which is why things were slow. I've committed a fix to trunk so that setting Rating doesn't automatically save (use SavedRating property if you want that behavior). Sorry about that, svn up and things should be much faster!
Thank you for your patch.
There are a few code formatting issues (indentation, spacing, etc.). Please have a look at the HACKING file for all the details.
I also have a question : why is the line move in DatabaseImportManager.cs necessary ? I don't see the difference.
If I remember right, there was an execution error (or maybe a performance problem) without this change. Maybe that changed in the new version.
I will have a look at it when I have more time.
Ok, I'm sorry for the long time that has passed. Finally I made it to adapt the formatting style (as far as I recognized differences). It also seems that the change in DatabaseImportManager.cs is unnecessary, so I removed it. This version of the patch works with banshee 1.4.1.
Created attachment 123715 [details] [review]
Import rating from ID3 tags
I would also really like to see ratings (or popularity-meter, whatever it is called in the metadata itself) written to files. However, my question is whether this is only really workable with mp3 audio files, or is this technique supported by other audio or video container formats (such as OGG, AVI, etc)?
It should be possible with other containers as well. At least FLAC *natively* supports custom tags whereas in MP3 the solution is to add a user field consisting of the tag name, a separator and the tag data (at least on a low level).
Only the tag library doesn't support a convenient way of accessing custom tags for arbitrary containers (afaik), so you probably you would have to implement it for each format (or maybe for certain groups of formats).
I currently don't use banshee but foobar2000 (in VirtualBox) since I added another custom tag / column to my files / player and the updates to banshee would be rather involving (at least for me).
I have the following error when trying to compile with the patch :
./Banshee.Streaming/StreamTagger.cs(174,54): error CS0618: `TagLib.Id3v2.TextInformationFrame.FieldList' is obsolete: `Use TextInformationFrame.Text'
Compilation failed: 1 error(s), 0 warnings
I'm using mono 2.0.1 and taglib-sharp 220.127.116.11.
I was using mono 1.9.1 and I got only a warning (which I didn't notice) and the compilation finished successfully.
I'll have a look at it.
Created attachment 124130 [details] [review]
Import rating from ID3 tags
I replaced the usage of the obsolete FieldList by a call of ToString. I don't like the solution because ToString contains the field description and the content, so I have to parse it, but I cannot see a better solution (except FieldList :-/).
Now it should compile without problems.
I think Nick's patch for this in bug #532650 does effectively the same thing (and more), does it not? Stephan, is there anything his patch should take from yours?
Not really. I still miss a feature to display an user defined tag in an extra column, but that's another story.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.
*** This bug has been marked as a duplicate of 532650 ***