How to save a rating in a song?

I want to be able to store information about a song that was opened using my application. I would like the user to be able to give a song a rating, and this rating is downloaded every time users open this file using my application.

I also need to know if ratings should be stored in a database or XML file.

+7
c # database xml winforms
source share
7 answers

The C # ID3 library is a .Net class library for editing id3 tags (v1-2.4). I would save the ratings directly in the mp3 comments section, since id3v1 does not have many of the storage functions that id3v2 does. If you want to store additional information for each mp3, how about placing a unique identifier in mp3, and then using this database search?

I would be wary of adding custom tags to mp3, as this is an easy way to destroy a large library. Also, I went this route earlier, and while I liked the programming knowledge that came out of it, trying something like the iTunes SDK or Last FM might be the best route.

+5
source share

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

I don't think XML is a good idea. XML shines in exchanging data and storing a very small amount of information. In this case, the user can rate thousands of tracks (I personally have online radio that allow ratings), and you can have a lot of other information to store track information.

Export and import using XML export procedures, if necessary. Do not use it as the primary data store.

+4
source share

I would save it in a file, since it is easier to store it with the mp3 file itself. If all you do is store ratings, would you rather set an ID3 rating field instead?

+2
source share

For this type of very simple memory, I don’t think it really is that important. About XML is a very simple deployment and editing outside of your application. con, its editable outside of your application (maybe good, maybe bad, depends on your situation)

Perhaps another option (just because you can ;-) is OODBMS, check out DB4Objects , it is really addictive and very, very cool.

+1
source share

As mentioned earlier, it is better to store such information in the media file itself. And my suggestion is to use TagLib # lib for this (the best metadata media I can find). Very powerful and easy to use.

+1
source share

I would save the ratings in an XML file, so it’s easy to edit from the outside, easy to read in .NET, and you don’t have to worry about delivering a database for something simple with your application.

Something like this might work for you:

<Songs> <Song Title="{SongTitle}"> <Path>{Song path}</Path> <Rating>3</Rating> </Song> </Songs> 
0
source share

If the song format supports suitable metadata (e.g. MP3), follow Kevin’s guidelines for using metadata. This is by far the best way to do this, and this is what metadata is for.

If not, then it really depends on your application. If you want to share ranking information - especially through a web service, then I would go for XML: it would be trivial to supply your XML data as one big feed, for example.

XML (or most other text formats) also has the advantage that they can be easily edited by a person in a text editor.

The database will have its advantages if you had a more closed system, you need speed and fast indexing and / or have other tables that you also want to save (for example, data about albums and groups).

0
source share

All Articles