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: Is it possible to remove embedded art from the playing item? (Read 1771 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is it possible to remove embedded art from the playing item?

I have a bit of code that works fine if the file isn't playing but it fails with "File is already in use" if it is playing. This isn't an issue with the built in dialog so I guess I'm doing something wrong??

Code: [Select]
STDMETHODIMP JSUtils::RemoveAlbumArtEmbedded(BSTR rawpath, int art_id)
{
TRACK_FUNCTION();

if (!rawpath) return E_INVALIDARG;

service_enum_t<album_art_editor> e;
service_ptr_t<album_art_editor> ptr;
pfc::stringcvt::string_utf8_from_wide urawpath(rawpath);
pfc::string_extension ext(urawpath);
abort_callback_dummy abort;

while (e.next(ptr))
{
if (ptr->is_our_path(urawpath, ext))
{
try
{
album_art_editor_instance_ptr aaeip;
GUID what = helpers::convert_artid_to_guid(art_id);
aaeip = ptr->open(NULL, urawpath, abort);
aaeip->remove(what);
aaeip->commit(abort);
}
catch (std::exception & e)
{
console::formatter() << e.what();
}
}
}

return S_OK;
}