you can just add actions in the settings of custom database. then in your script you can call those actions using fb.RunContextCommand([your_action])
Thanks. I got it working but it's kinda ugly:
function on_playback_time()
{
if (wait == 0) newsongready = 1;
if (newsongready == 1 && song_handled == 0)
{
g_metadb = fb.GetNowPlaying();
g_metadb.UpdateFileInfoSimple("artistinfo",lastfm_data[1][1]);
g_metadb.UpdateFileInfoSimple("albuminfo",lastfm_data[2][1]);
fb.trace("mdbc: "+lastfm_data[1][1]+" / "+lastfm_data[2][1]);
song_handled = 2;
fb.trace(song_handled+fb.TitleFormat(" art: %artistinfo% alb: %albuminfo%").Eval());
}
else if (song_handled == 2)
{
if (fb.TitleFormat("$if(%artistinfo%,$if(%albuminfo%,1,0),0)").Eval() == 1)
{
fb.RunContextCommand("Customdb SetArtistCount");
fb.RunContextCommand("Customdb SetAlbumCount");
song_handled = 1;
g_metadb.UpdateFileInfoSimple("artistinfo","");
g_metadb.UpdateFileInfoSimple("albuminfo","");
fb.trace(song_handled+fb.TitleFormat(" art: %artistinfo% alb: %albuminfo%").Eval());
}
}
}
As you see, I have to first put my data to tags, then (when it's ready) use contextmenu to store it from tags to customdb and remove tags. If somebody knows better way of doing this I would be pleased.