Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I store a rating in a song?

I want to be able to store information about a song that has been opened using my application. I would like for the user to be able to give the song a rating and this rating be loaded every time the users opens that file using my application.

I also need to know whether I should store the ratings in a database or an xml file.

like image 869
Bob Dylan Avatar asked Jun 27 '09 04:06

Bob Dylan


2 Answers

C# ID3 Library is a .Net class library for editing id3 tags (v1-2.4). I would store the ratings directly into the comments section of the mp3 since id3v1 does not have many of the storage features that id3v2 does. If you want to store additional information for each mp3, what about placing a unique identifier on the mp3 and then having that do a database lookup?

I would be cautious about adding custom tags to mp3s as it is an easy way to ruin a large library. Also, I have gone down this road before and while I enjoyed the programming knowledge that came out of it, trying something like the iTunes SDK or Last FM might be a better route.

like image 147
Kevin Lamb Avatar answered Sep 19 '22 21:09

Kevin Lamb


I would use a single-file, zero-config database. SQL Server Compact in your case.

I don't think XML is a good idea. XML shines in data interchange and storing very small amounts of information. In this case a user may rate thousands of tracks ( I have personally in online radios that allow ratings), and you may have lots of other information to store about the track.

Export and import using XML export procedures if you have to. Don't use it as your main datastore.

like image 28
kervin Avatar answered Sep 23 '22 21:09

kervin