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: New SDK with foobar2000 v2.0 features released (2022-08-10) (Read 18376 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #75
@Peter I'm trying to use new search api, but either I'm doing something wrong or there are missing definitions in SDK.

The following code fails to compile (on `as_list_of` line)
Code: [Select]
const auto pSearchFilter = search_filter_manager_v3::get()->create( query.c_str() );
const auto pSearchIndex = search_index_manager::get()->get_library_index();
const auto pArray = pSearchIndex->search( pSearchFilter, nullptr, 0, fb2k::mainAborter() );
// Per docs: "Safe to use arr->as_list_of<metadb_handle>() to get a pfc::list_base_const_t<metadb_handle_ptr>"
auto handles = pArray->as_list_of<metadb_handle>();

Error:
Spoiler (click to show/hide)

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #76
It is safe to call metadb_handles methods off-thread? E.g. `get_subsong_index` or `format_title`

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #77
@Peter I'm trying to use new search api, but either I'm doing something wrong or there are missing
I've figured out this one: `as_list_of` does not return `metadb_handle_list`, but rather a reference.
Hence `auto` does not work here, `metadb_handle_list handles = pArray->as_list_of<metadb_handle>();` should be used instead

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #78
Hence `auto` does not work here, `metadb_handle_list handles = pArray->as_list_of<metadb_handle>();` should be used instead
Or
Code: [Select]
auto& handles = pArray->as_list_of<metadb_handle>();

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #79
is there a way to load only external album art (i.e. ignore embedded)?
I've found `album_art_manager_config`, but it requires to supply search patterns for all the types. And since fb2k search patterns are not exposed via API, it makes it unusable for my scenario.

[EDIT] On that note: is it possible to distinguish if the loaded art source was external or embedded?

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #80
as_list_of returns a const ref so it's either metadb_handle_list_cref or const auto&.

If you want a normal handle list then...

Code: [Select]
metadb_handle_list handles;
handles.add_items(arr->as_list_of....)

As for embedded art, it should be down to user choice as per the advanced preferences. I don't think there is a way to ignore it.

And you can check if it's embedded yourself. The album art methods you inherited from WSH/JSP already show how to get the image path. It will match the handle path if it's embedded.

Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #81
@Peter, I think there's a bug with get_sort_priority in contextmenu_item_lambda . It should return m_sortPriority but currently returns 0.

This bug I reported several months ago is still present in the latest SDK from a few days ago.

Viewable on musicmusic's copy of the SDK here...

https://github.com/reupen/foobar2000-sdk-unmodified/blob/128badc9aedcca6b569ca8a31d0b2b629f74e8b7/foobar2000/SDK/contextmenu.h#L361


Re: New SDK with foobar2000 v2.0 features released (2022-08-10)

Reply #83
I see the changelog for 2.1.2 has this entry...

Quote
Fixed poor performance of adding lots of items to Playback Queue.

I tested with the native context menu item and see playback_queue_callback::on_changed only gets called once which is nice but still no difference for 3rd parties. I've posted about that before...

I'd like to request the ability to bulk add playlist queue items. It seems the only way to re-order the current queue or insert new items at a given point is to flush the queue and then add them back one at a time which triggers the callback more than is necessary. If I missed a way to do this, I'll take any pointers.

Will this be available for us mere mortals? :P