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: Force updating metadata cache  (Read 2035 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Force updating metadata cache

I'm writing component that plays headless raw PCM files.
https://github.com/dofuuz/foo_input_raw

X
It plays file correctly. Changing preference affects playback as intended.

But file's information(Length, Sample rate, Channels, Bits per sample, Bitrate) is fixed to it's first load.
Changing preference won't update general file infos.

I tried to use decode_get_dynamic_info() but it does not update properties detail.

Is there any way to refresh/delete metadata cache on changing preference?
Or force updating on playback time?

Re: Force updating metadata cache

Reply #1
Not unless you want to change the file's modification time. Or force the user to reload the info manually.

Re: Force updating metadata cache

Reply #2
Or force the user to reload the info manually.
I cannot find menu entry to force reload from fb2k.
Should I add it to component? Is there any example for this?

Re: Force updating metadata cache

Reply #3
Or force the user to reload the info manually.
I cannot find menu entry to force reload from fb2k.
Should I add it to component? Is there any example for this?
Shift + Right click on the relevant tracks -> Tagging -> Reload info from file(s).
Pressing Shift might not be necessary depending on your settings for the context menu.

Re: Force updating metadata cache

Reply #4
Actually you can force update cached metadata from code. I for example do that with External Tags. Not sure it's a good idea for a decoder but here's a piece of code to achieve it:
Code: [Select]
static void refresh_metadata(metadb_handle_ptr p_track, const file_info &p_info, const foobar2000_io::t_filestats p_filestats)
{
    if (p_track.is_valid()) {
        auto mio = metadb_io_v2::get();
        service_ptr_t<metadb_hint_list> hint_list = mio->create_hint_list();
        metadb_hint_list_v3::ptr hint_list_v3;
        hint_list_v3 ^= hint_list;
        hint_list_v3->add_hint_forced(p_track, p_info, p_filestats, true);
        fb2k::inMainThread( [=] {hint_list->on_done();} );
    }
}

Re: Force updating metadata cache

Reply #5
In addition to the methods above, you can also assign a button to that action from your Customize Buttons context menu.  Right-click your button bar, choose Customize Buttons, and in Available Commands expand context->tagging->reload info from files;  "Add".  Then you can just highlight file(s) and hit that button to do the metadata update.