In other words, RTFM, C_G? Not very helpful, especially in the Development forum...
1. double elapsedSongSeconds = 0;
play_control::command(play_control::PLAYBACK_GETPOS, (int)&elapsedSongSeconds);
That gives you the elapsed time, in seconds. Then you can convert that to hours, minutes, seconds:
const unsigned int ehours = (unsigned int)(elapsedSongSeconds / 3600);
const unsigned int emins = (unsigned int)(elapsedSongSeconds / 60) % 60;
const unsigned int esecs = elapsedSongSeconds % 60;
and convert it to a string using snprintf().
2. You can get a lot of information by using metadb::format_title() and the right format string. This is what I use - it uses CString, but it wouldn't be hard to convert to the string of your choice. Also, there is now a metadb_handle::handle_format_title(), so you can get a format directly from a metadb_handle*, so some of the following code is unnecessary but I never bothered to update it...
metadb_handle* GetCurrentSongHandle()
{
metadb_handle *handle = play_control::get()->get_now_playing();
if(!handle)
handle = playlist_oper::get()->get_item(playlist_oper::get()->get_focus());
return(handle);
}
void GetCurrentSongTitle(CString &string, LPCTSTR format)
{
string.Empty();
metadb_handle *handle = GetCurrentSongHandle();
if(!handle || !format)
return;
const playlist_entry *entry = handle->handle_get_location();
if(entry)
{
string_interface_i str;
metadb::get()->format_title(entry, &str, string_utf8_from_os(format), NULL, NULL);
if(str.get_ptr())
string = string_os_from_utf8(str.get_ptr());
}
handle->handle_release();
}
Next you need to find the correct format string...for this, go to Foobar Preferences, and then to Display->Title Formatting. Click on the Help button, and there is the syntax reference. So to get the currently playing or selected song, you would want: GetCurrentSongTitle(string, "%_path%");. format_title() is very powerful and lets you get a lot of information about a file and format it.
3. playlist_oper::get()->get_count();
4. playlist_oper::get()->get_item(index); That will return you a metadb_handle*, which is exactly what you need for metadb_handle::handle_format_title(). Apply the right format string (something like: %_playlist_number%. %artist% - %title%), and you'll get your desired output.
Good luck with your HTTP interface! I ported my Winamp2 HTTP server/interface over to Foobar a while ago, but due to commercial interest, I haven't released it as a publically available Foobar component. I'm looking forward to your component, however!
[Edit]
1: Fixed a paste-o in the GetCurrentSongTitle() function.
2: These instructions are for the Foobar 0.667 SDK...things might be different in 0.7.