HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: Orekhin on 2021-01-18 21:39:58

Title: Problem with process_locations_notify and update_info_async_simple
Post by: Orekhin on 2021-01-18 21:39:58
Code: [Select]
# my add tracks function, in std::vector stores only remote http urls
static void add_tracks(std::vector<std::string> tracks)
{
pfc::list_t<const char*> p_urls;
service_ptr_t<process_locations_notify_my> p_notify = new service_impl_t<process_locations_notify_my>();

for (size_t i = 0; i < tracks.size(); i++) {
p_urls.add_item(tracks[i].c_str());
}
static_api_ptr_t<playlist_incoming_item_filter_v2>()->process_locations_async(
p_urls,
playlist_incoming_item_filter_v2::op_flag_background,
NULL,
NULL,
NULL,
p_notify
);
}

class process_locations_notify_my : public process_locations_notify {
public:
void on_completion(const pfc::list_base_const_t<metadb_handle_ptr>& p_items)
{
static_api_ptr_t<playlist_manager> plm;
static_api_ptr_t<metadb_io_v2> metadb_io_api;
file_info_impl info;

p_items[0]->get_info(info);

info.meta_set("artist", "artist");
info.meta_set("title", "title");

metadb_io_api->update_info_async_simple(
pfc::list_single_ref_t<metadb_handle_ptr>(p_items[0]),
pfc::list_single_ref_t<const file_info*>(&info),
core_api::get_main_window(), NULL, NULL);

plm->activeplaylist_add_items(p_items, bit_array_true());
};

void on_aborted() {};
};

When this code is running and fb2k is processing locations, i get this error:

Code: [Select]
Could not update tags (Access denied) on:
"https://localhost:8000/api/track/904209092.mp3"

Track plays fine but seems fb2k cant fetch metadata from this track.
Title: Re: Problem with process_locations_notify and update_info_async_simple
Post by: Orekhin on 2021-01-18 21:49:25
ALSO: I tried to see track metadata manually, metadata is fine with artist info, album info and duration but fb2k shows "??" on artist and album field.
SimplePortal 1.0.0 RC1 © 2008-2021