Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: foo_customdb: Custom Database (Read 77993 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

foo_customdb: Custom Database

Reply #25
You create the field properties:

You can remove this action when they are transferred. Make sure they are properly transferred with a column displaying the fieldname %rating_cd%

Finally you want to setup a way to tag files using the contextmenu:





Regarding an SQLite editor... Well, there's a few, but why do you want to do it? You should only do updating through foobar2000. Anyway, if you are curious, you should read up on the SQL syntax and use the sqlite3.exe you can download from SQLite's official homepage.
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #26
This series of screenshots is very useful.  I will check out the biometrics plugin.  For the time being I rather like the idea of using artist-album-track as the key, since it will apply to any duplicates.  That concept is very powerful -- as you've pointed out -- since you annotate based on album, or artist, or artist-album, etc, covering multiple tracks with each key.

Anyhow, the help I am really after is how I get the custom tags written into the files themselves.  For example, in 5 years' time I decide I don't want to use this component anymore, and I want my custom ratings written into ID3 tags for permanence, how do I do it?  You did state two methods in your original post, but I can't get either to work.  Some screenshots showing those methods would be great, again using the RATING_CD example -- i.e. writing the custom RATING_CD information into the file's ID3 tag so that you can then e.g. see it in foobar2000's Properties like any other tag.

Thanks!

Mike

P.S. I'll check out the SQLlite DB viewer -- reason is that I want my data to be as open as accessible as possible, and if it ever came to it (e.g. foobar2000 and customdb component vanished overnight) I would still be able to extract my data from the database file itself.  I'd just like to poke around 

Edit to correct typo

foo_customdb: Custom Database

Reply #27
Anyhow, the help I am really after is how I get the custom tags written into the files themselves.  For example, in 5 years' time I decide I don't want to use this component anymore, and I want my custom ratings written into ID3 tags for permanence, how do I do it?  You did state two methods in your original post, but I can't get either to work.  Some screenshots showing those methods would be great, again using the RATING_CD example -- i.e. writing the custom RATING_CD information into the file's ID3 tag so that you can then e.g. see it in foobar2000's Properties like any other tag.

[/quote]
Just keep a backup of the SQLite database. If foobar2000 config is destroyed, you just recreate the pages with the same values. That's the power of using an identifier in the files that are unique to the files and not to something internal in the db (e.g. the file location, which I think is one of the official playcount's weaknesses).
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #28
Thanks.  Works well.  I'm also curious about another method of writing custom tags to files which you mentioned in your OP:

Quote from: odyssey link=msg=0 date=
You simply define an action and define the "Set value:" to "$if(%fingerprint_fooid%,%tag_stored_in_file%,)".


I couldn't get that to work (I replaced %fingerprint_fooid% with %rating_cd% because I don't use the fingerprint method).  After some playing to try and get the right settings, I ended up with a context menu item that crashed foobar2000, so that when I restarted foobar2000, the bad context menu item was still there, but the corresponding setting in customdb was NOT.  So, I had no way (I could see) of removing the bad context menu item.  Since I am still testing, I could just delete the customdb database file and start from scratch.

How would I remove that bad menu item without having to delete my entire custom DB?  This makes me slightly nervous -- database corruption I don't know how to fix.

Thanks,

Mike

foo_customdb: Custom Database

Reply #29
Thanks.  Works well.  I'm also curious about another method of writing custom tags to files which you mentioned in your OP:

Quote
You simply define an action and define the "Set value:" to "$if(%fingerprint_fooid%,%tag_stored_in_file%,)".


This is not a way to transfer tags from customdb to files. There is only one way (maybe more, but I didn't test them) to do that, and I already explained that. The action menu is ONLY for storing tags in the customdb, hence you shouldn't write the customdb-field to itself as you are currently trying to.

Also remember always to restart foobar2000 when the component tells you to.

Quote from:  link=msg=667274 date=0
How would I remove that bad menu item without having to delete my entire custom DB?  This makes me slightly nervous -- database corruption I don't know how to fix.

The foobar2000 configuration and customdb-file are not dependant on each other. As I also explained before, if you mess up the foobar2000 config, it doesn't (at least it shouldn't) invalidate the customdb database-file.

Just to clear up, the "bad context menu" does not reside in the customdb-file - it's purely in foobar2000 config, so deleting the database does not get rid of it.

Anyway, always backup your data. Use a backupservice that uses versioning so you can always go back to a certain point in time. There are many great services offering this on internet.
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #30
This is not a way to transfer tags from customdb to files. There is only one way (maybe more, but I didn't test them) to do that, and I already explained that. The action menu is ONLY for storing tags in the customdb, hence you shouldn't write the customdb-field to itself as you are currently trying to.


OK, I now see that this method mentioned in your OP was to move tags from the file to customdb, not the other way.

The foobar2000 configuration and customdb-file are not dependant on each other. As I also explained before, if you mess up the foobar2000 config, it doesn't (at least it shouldn't) invalidate the customdb database-file.

Just to clear up, the "bad context menu" does not reside in the customdb-file - it's purely in foobar2000 config, so deleting the database does not get rid of it.


So the various actions you define in the customdb settings are stored in the foobar2000 config, not the customdb database?  The problem I was having is that I set up a new context menu item in customdb, which created an entry in the customdb dialog and a corresponding new context menu appeared.  I then used that new context menu, and it caused foobar2000 to crash.  When I restarted foobar2000, the entry in the customdb dialog was gone, but the context menu was still showing.  So, how would you get rid of that phantom context menu?  Me deleting the customdb database and restarting did seem to address the problem, though maybe it was some coincidence.

On another issue, if I decide that using a biometric-based database key is too much hassle (extra components, more to go wrong or be obsoleted), and settle on the simplicity of an artist-album-title combo for the key, what happens when you rename a track (e.g. to correct a typo)?  Presumably the tags for the old combo are still stored in the db, but no track points to those tags?  That is how I think it would probably work.  My next question would be: is there a way of locating any orphaned tags, i.e. those which are not referenced by any track in the foobar2000 library?  I don't like the idea of hidden garbage building up in any database.

Thanks,

Mike

foo_customdb: Custom Database

Reply #31
On another issue, if I decide that using a biometric-based database key is too much hassle (extra components, more to go wrong or be obsoleted), and settle on the simplicity of an artist-album-title combo for the key, what happens when you rename a track (e.g. to correct a typo)?  Presumably the tags for the old combo are still stored in the db, but no track points to those tags?  That is how I think it would probably work.  My next question would be: is there a way of locating any orphaned tags, i.e. those which are not referenced by any track in the foobar2000 library?  I don't like the idea of hidden garbage building up in any database.

You got it right. You have to decide what you think is the best way for you. You can use file-location (similar to official playcount) to store ratings, which can be lost when you move files, use the title identifier with the risk of loss when you rename it or as i suggest use the fingerprint that will ALWAYS be the same for a particular file no matter where it resides. You can even erase the tag, which will hide the tags, but once you've fingerprinted the file, the tags will re-appear.

That said, I hardly doubt foo_biometrics will become obsolete. It's not exactly an ongoing development (rather an experiment), but it's musicmusic that's behind the component (developer of columnsui), so I'm fairly sure it will be updated regularly if new SDK's requires it.
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #32
OK, and to address the question of how to clean up a custom db to find and remove any old tags that are no longer referenced by any track in your collection?  I'm guessing this is going to be difficult, so that you'll be left with a lot of "space debris" floating around in your database.

With the fingerprint key scheme, is there an easy way to ensure that each track is analysed, and fingerprint written, or is it a manual process?  E.g. if I add a new track to my collection, do I have to remember to fingerprint it, or will the component be triggered on a new import?

Mike

P.S. it looks like customdb is at least being actively developed still -- it's quite new?  Does the author ever drop in to these forums?

foo_customdb: Custom Database

Reply #33
OK, and to address the question of how to clean up a custom db to find and remove any old tags that are no longer referenced by any track in your collection?  I'm guessing this is going to be difficult, so that you'll be left with a lot of "space debris" floating around in your database.

Sounds like you're a perfectionist  Me too.... However, I think you should just try to get used to a certain amount of "orphaned" entrys in the db. It shouldn't slow down the database that much as it's relatively few values we're talking about.

With the fingerprint key scheme, is there an easy way to ensure that each track is analysed, and fingerprint written, or is it a manual process?  E.g. if I add a new track to my collection, do I have to remember to fingerprint it, or will the component be triggered on a new import?

YES  with foo_new_file_stamper_mod. You just set it to "Save fingerprints to file" in it's property-page, and any new added file will be analyzed. It works really really well! (Umm... except that if you, like me, have net-streams defined in files e.g. asx, biometrics will crash on it).

To analyze all your existing files, create an autoplaylist with
Code: [Select]
FINGERPRINT_FOOID MISSING AND %length_seconds% GREATER 10


P.S. it looks like customdb is at least being actively developed still -- it's quite new?  Does the author ever drop in to these forums?

No, not really and it hasn't had an update since this spring. I still hope for multivalue support and no restarting foobar2000.
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #34
OK, and to address the question of how to clean up a custom db to find and remove any old tags that are no longer referenced by any track in your collection?  I'm guessing this is going to be difficult, so that you'll be left with a lot of "space debris" floating around in your database.

component can take care of that (database tab):

foo_customdb: Custom Database

Reply #35
Thanks, guys.

To analyze all your existing files, create an autoplaylist with
Code: [Select]
FINGERPRINT_FOOID MISSING AND %length_seconds% GREATER 10


How do I create such a custom autoplaylist?  I have so far only worked out how to do it from the Album List context menu, but that is tied to a branch in that list.  I've been wondering how to create a completely free-form autoplaylist like the above.

Mike

Edit: Aha.  Do you just right-click on the All Music (root) branch and create autoplaylist from there?

foo_customdb: Custom Database

Reply #36
Now another question ;-)

I am moving towards a system where I have my own ratings embedded into tags in the file (let's say, in tag "mike rating").

And then each other user of my PC can listen to my music, and use my ratings by default, but they can also override my ratings with their own (stored in customdb under tag "user rating").

So, the logic is: if "user rating" exists, use that.  Otherwise, use "mike rating".

I've worked out how to display this "combined" rating in a column, using this pattern:

$if(%user rating%,$repeat(●,%user rating%)$repeat(o,$sub(5,%user rating%)),$if(%mike rating%,$repeat(●,%mike rating%)$repeat(o,$sub(5,%mike rating%)),ooooo))

However, I now want to filter the users' autoplaylists based on this "combined" rating, too.

For just me (in my own account), I'd use the following in the filter:

%mike rating% GREATER 1

(since my highest rating is 3*)

However, what do I use as the filter for a "combined" rating for the user accounts?  I can't see that you can use IF/THEN logic in the filter.  Perhaps I need an auto-calculated field (calculate using the IF/THEN logic), and filter on that?

Thanks for any help!

Mike

foo_customdb: Custom Database

Reply #37
Hey guys, I have a question about this plugin,

When I first read about this, I got a really cool idea. I like to store lots of additional (and would like to store more) information about artists, composers, etc that are not vital. (For example artist date of birth, death, composer country, reviews, biographies, etc... into the Custom DB instead of directly to tags

I was thinking of using Python grabber scripts to get and store the information in the custom DB.
Can this be done fairly easily? Meaning I'd like the custom DB tags to act and behave somewhat like regular tags.

Thanks!

foo_customdb: Custom Database

Reply #38
I was thinking of using Python grabber scripts to get and store the information in the custom DB.

That's a really cool idea! Actually you should be able to inject values directly in the db-file if you need to do external work (at least i managed to do so, even while foobar2000 was running using the official sqlite3.exe)

Can this be done fairly easily? Meaning I'd like the custom DB tags to act and behave somewhat like regular tags.

They do  If you define a field with %composer_cd%, then it will show anywhere you use this tag (except for masstagger afair).
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #39
However, I now want to filter the users' autoplaylists based on this "combined" rating, too.

However, what do I use as the filter for a "combined" rating for the user accounts?  I can't see that you can use IF/THEN logic in the filter.  Perhaps I need an auto-calculated field (calculate using the IF/THEN logic), and filter on that?

How about %mike_rating% GREATER 1 OR %user_rating% GREATER 1 ??? You should take a look at the help pages to understand the query-logic.
Can't wait for a HD-AAC encoder :P

foo_customdb: Custom Database

Reply #40
I was thinking of using Python grabber scripts to get and store the information in the custom DB.

good idea
while sqlite3 module is included in python 2.5 (used by python grabber) it's not included in python grabber
however it works seamlessly, and I'll include it optionaly in my future/modified scripts based on key %album artist% %album% (%title%)

foo_customdb: Custom Database

Reply #41
How about %mike_rating% GREATER 1 OR %user_rating% GREATER 1 ??? You should take a look at the help pages to understand the query-logic.


OK, I got it.  The logic is not quite as you say, because if %user rating% has been set then it overrides %mike rating%, rather than adds to %mike rating%.

The following seems to do what I want:

(%user rating% GREATER 1) OR (%user rating% MISSING AND %mike rating% GREATER 1)

Incidentally, I make a distinction between "MISSING" and "EQUAL 0".  If the user has explicitly set the user rating to 0, that is a positive statement that he/she doesn't like the track.  If the user rating is just missing, it is probably just because the user hasn't got around to applying a rating yet (or is happy to accept my rating).

Mike

foo_customdb: Custom Database

Reply #42
OK, and to address the question of how to clean up a custom db to find and remove any old tags that are no longer referenced by any track in your collection?  I'm guessing this is going to be difficult, so that you'll be left with a lot of "space debris" floating around in your database.

component can take care of that (database tab):



Just tried this, and it doesn't seem to do anything to clear out unlinked data.  I changed a track name so that it no longer matched the key in the database, and so that its custom rating vanished from display.  No other tracks matched the old key either.  So there is orphaned data in the database now.  I ran the above tool, trying each of the three options, and the orphaned data remained.  When I renamed the track to what it was, the rating came back.

So, I don't really think the above tool is for this purpose.

Mike

foo_customdb: Custom Database

Reply #43
It doesn't say: "Remove entries without key", does it?
If you remove your custom tag field value or custom tag field itself, its db entry(ies) will gone when using the tool

foo_customdb: Custom Database

Reply #44
It doesn't say: "Remove entries without key", does it?


No, but I was only following your suggestion ;-)

If you remove your custom tag field value or custom tag field itself, its db entry(ies) will gone when using the tool


Remove where?  I'm really interested in finding and removing any data in the database that doesn't match to any key in any track in your collection, and I'm not sure anything yet suggested will enable this?

Mike


foo_customdb: Custom Database

Reply #45
Here is hotness algorithm for foo_custom:

Code: [Select]
$puts(baselinefrequency,90)$puts(baselinedecay,28)$puts(lp,[%last_played%])$puts(fp,[%first_played%])$puts(pc,[%play_count%])$puts(rating,[%rating%])$puts(avgrating,3)$puts(lp_mod,$sub($add($add($mul($year($get(lp)),365),$mul($month($get(lp)),30)),$day_of_month($get(lp))),730000))$puts(fp_mod,$sub($add($add($mul($year($get(fp)),365),$mul($month($get(fp)),30)),$day_of_month($get(fp))),730000))$puts(date_diff,$sub($add($add($mul($year(%now%),365),$mul($month(%now%),30)),$day_of_month(%now%)),730000))$puts(baselinefrequency,$mul($get(baselinefrequency),24))$puts(baselinedecay,$mul($get(baselinedecay),24))$puts(lp_age,$add($substr($get(lp),12,13),$mul(24,$get(lp_mod))))$puts(fp_age,$add($substr($get(fp),12,13),$mul(24,$get(fp_mod))))$puts(age,$sub($get(lp_age),$get(fp_age)))$puts(now_age,$add($time(%now%),$mul(24,$get(date_diff))))$puts(recentness,$sub($get(now_age),$get(lp_age)))$puts(decay,$div($div($mul($get(pc),$get(baselinefrequency),$get(baselinedecay),$if2($get(rating),$get(avgrating)),100),$mul($max($get(age),$get(baselinefrequency)),$get(avgrating))),100))$puts(rawhotness,$div($mul($max($sub($get(decay),$get(recentness)),0),100),$get(decay)))$puts(forecast,$div($mul($max($sub($get(decay),$add($div($max(0,$sub($get(baselinedecay),$get(recentness))),2),$get(recentness))),0),100),$get(decay)))$put(hotness,$div($add($get(rawhotness),$get(forecast)),2))


I'm trying to adapt this for my purpose.  I have two ratings, one in tag %mike_rating% which is stored in the file, and another in custom tag %user_rating% which is stored in the custom_db database.  The logic I use around the place, e.g. in filters, is to use %user_rating% if it exists, else use %mike_rating%.

So I've tried to amend the appropriate part in the above algorithm as follows:

Code: [Select]
$puts(rating,$if2(%user_rating%,%mike_rating%)


However, this doesn't seem to work.  What syntax should I be using here?

Thanks,

Mike

foo_customdb: Custom Database

Reply #46
i'm just wondering.... how many people are using this and how (un)stable is it for you? i know it says "unstable" in the first post but i've had 2 crashes within the first hour of use which is just ridiculous.

foo_customdb: Custom Database

Reply #47
what have you been doing?
if it says please restart foobar, than restart foobar
also don't use field names that you usually use for tags
maybe even trying something with your script caused those crashes?

foo_customdb: Custom Database

Reply #48
i hadn't even got as far as trying to manipulate the db with any scripts. it just bombed out when playing music in the background. i was just a little bit concerned about wasting time scripting for it if it's really that bad. maybe i just got unlucky. anyway, i'm trying version 0.0.8c and no problems so far (touch wood).

foo_customdb: Custom Database

Reply #49
It's been very stable for me.  I'm wondering whether anyone has tried it with the new beta?

Incidentally, I think I figured out what the syntax should be for my post just above:

Code: [Select]
$puts(rating,$if(%user_rating%,[%user_rating%],[%mike_rating%]))


Mike