Help - Search - Members - Calendar
Full Version: Usage prb with playlist_oper::format_title
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
cswilly
I have been adding a bit to the foo_write_http plugin to process a HTML page. Its basically done, but I have a problem with playlists.

I have a question on the pl_oper->format_title method as it does not work as I expect.

The code below works fine. That is formattedText is updated with info from the playlist item:
CODE

                 metadb_handle* mh = pl_oper->get_item(ii);
                 if(mh==0)
                 {
                   console::info("metadb_handle is null");
                 }
                 {
                   mh->handle_format_title(formattedText, textToFormat.c_str(), extra_items);
                   mh->handle_release();
                 }

Any hints would be appreciated....

The code below does not work. That is formattedText is always an empty string:
CODE

                 pl_oper->format_title(ii, formattedText, textToFormat.c_str(),
foosion
QUOTE(cswilly @ Dec 21 2003, 08:33 AM)
The code below does not work.  That is formattedText is always an empty string:
CODE

                 pl_oper->format_title(ii, formattedText, textToFormat.c_str(),

Things to check:
  • Is textToFormat.c_str() a UTF-8 string?
  • Are you calling playlist_oper::format_title() from the main thread?
cswilly
I changed the code to use UTF-8 strings and had the same behavior.

I am not on the main thread.

I find it strange that it is only the formating with the playlist_oper object does not work. There formaters play_control and metadb_handle work fine.

Any case, I will make a release of the code as it currently is and hope somebody with more foobar 2000 experiance can fix it.

csw
foosion
QUOTE(cswilly @ Dec 21 2003, 01:53 PM)
I am not on the main thread.

I find it strange that  it is only the formating with the playlist_oper object does not work.

Not strange at all:
QUOTE(playlist.h)
//important: playlist engine is SINGLE-THREADED. call any APIs not from main thread and things will either blow up or refuse to work. all callbacks can be assumed to come from main thread.
cswilly
I felt it strange that it works in "play_control" which the header makes the same "use the main thread !!" remark and it works.

No matter, it works well enough to take of care of my ich. If anybody is interested doing it right, I would be happy to make my changes available.

I have hacked the "foo_write_http" plugin to display HTML with foobar2000 tags. You can display info on the current track, plus some info on the items in the playlist. I hope to release the changes today.
foosion
QUOTE(cswilly @ Dec 21 2003, 04:15 PM)
I felt it strange that it works in "play_control" which the header makes the same "use the main thread !!" remark and it works.

Pure luck, you're still violating the specification given in the SDK.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.