Skip to main content
Topic: Adding extra variables to the database (Read 2932 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Adding extra variables to the database

See the topic.

I want to play around with an intelligent playlist manager, kind of like listen-to.com with some brains.  I need to add a few fields (2 ints and a date) to the db, but I can't quite figure out how to do so in the sdk.  Is there a way?

thanks.

 

Adding extra variables to the database

Reply #1
Need more information.

Adding extra variables to the database

Reply #2
If you need help or information it's common knowledge that you take your time and write a valid post that actually makes sense.

Adding extra variables to the database

Reply #3
I really hate to be the voice of reason here (I really wish you could have explained better...), however, seeing as I understand the question enough to answer it, it's just too tempting.

To add a field to the database, you first need to get a handle to the database entry for the file. This should be an instance of the metadb_handle class. Then create an instance of the file_info class (or a derivative from file_info_helper.h). Call db_entry->handle_query(&info), where info is the file_info instance and db_entry is the metadb_handle. Then, to set (or add a new) field, just call info->meta_set("name","value"). It only accepts strings, so you'll have to write a set of conversion functions for anything else you want to use.

For anything else, i'd suggest looking at the source to the masstagger, as well as the file_info.h header.

Adding extra variables to the database

Reply #4
Meta fields are subject to user tampering, and can/will be written to the files as tags. Most info fields are not, but are subject to being erased when the user performs an info reload on the file, as they will not be replaced by the file's input handler. Perhaps you could hook the database and intercept this, but I wouldn't know how to do it, and it seems like it would be a nasty hack.

Adding extra variables to the database

Reply #5
Sorry about the lack of clarity in my previous post, but it was the middle of a sleepless night, when you end up writing things in ways that you shouldn't.  So thanks to everyone who tried to help me, even if you were reaching blindly through a fog.

My problem is that my music collection totals about 19k files, which means there are quite a few songs that I just simply forget about, and a number of songs I only want to listen to when I'm in a certain mood.  So I want to track what is played for a while, and, off the information displayed, build a modified shuffle that generally plays the most popular songs, but eventually sneaks in other songs; providing a balance between what I want to hear and what I don't.  Additionally, I would like to be able to build the shuffle off of another field that specifies the 'mood' that the song fits.

I realize that the easiest way to do this would be to just build playlists, but that seems pretty inelegant.  Thus, my question.

Adding extra variables to the database

Reply #6
You could ask synapse guys to make a foobar plugin.
Their Brain Winamp Plugin does something similar to that.
http://www.synapseai.com/waplugin.asp

 
SimplePortal 1.0.0 RC1 © 2008-2019