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: Modify playlist display text when adding location (Read 3233 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Modify playlist display text when adding location

Hi!

I'm looking for a way to modify the information which is displayed in the playlist when adding a new song/location.

In my current project (Subsonic client for foobar), I get retrieve all songs which are available for stream from server in a XML response.
I parse this response and populate a treeview with it.

When adding files from treeview to playlist (I'm still fighting to get drag&drop working  ), an URL is generated which points to the REST-API of the server.
The song to play is identified by an id received previously.

My problem is, when adding a track, foobar only shows "stream" as title/track artist. All other information like duration, size, tracknumber and so on are empty or filled with ?.
When playing the song (or you open song properties), foobar updates the information by the tag information found in the file provided by the server.

As I already have certain information, like artist, album, trackname, duration, size and a few more, I would like foobar to show this information instead of the default placeholder.

Modifying the information while adding using the playlist_manager doesn't seem to be possible for locations (only a list of char* with the url(s) is supported).

Then I tried to achieve this by using playlist_incoming_item_filter_v2.
This method only provides a list of metadb_handle_ptr which only allows me to read the file_info data provided.

I guess the information is copied to the given file_info object when calling something like
Code: [Select]
file_info_impl finfo;

if (p_items.get_count() > 0) {
    p_items.get_item(0).get_ptr()->get_info(finfo);
}


Is there any way to modify the information?

If not, can I force foobar to retrieve the information of the song, like foobar does when start playing or opening song properties?

Also displaying album art would be great, but I think this question is already answered with "no".

Modify playlist display text when adding location

Reply #1
can't you just use hint_async() before adding your metadb_handle_ptr to the playlist? that's what i do atm.
something like:
Code: [Select]
static_api_ptr_t<metadb_io_v3> meta_db_io_api;
file_info_impl f_info;

f_info.meta_set("Artist", "bla");
f_info.meta_set("Album", "blub");
f_info.set_length(364); // seconds

meta_db_io_api->hint_async( my_metadb_handle, f_info, f_stats, true);


Modify playlist display text when adding location

Reply #2
The hint mechanism is appropriate if the file_info passed as a hint is the same as the file_info which the decoder returns when the track is opened for reading metadata. This happens when a user requests a file info reload or when a component deliberately bypasses the cached info (think lyrics viewers).

If the decoder returns a different (or empty) file_info you might look into creating a proxy decoder. This proxy decoder would provide the static information and delegate the dynamic information and the playback to the decoder for the proxied file. The proxy decoder can be based on your own file format (like m-TAGS) or on a custom URL scheme (like foo_random) which encodes the proxied file and the static info.

Modify playlist display text when adding location

Reply #3
Doing it like jeanpaulrichter said works.

But just to clarify:
Would the decoder solution the better/cleaner one?

What would be the advantage to do it with a proxy decoder?
Can I block the automatic update of the tags when start playing with a proxy decoder?

How do I get started with that feature? Are there any samples?

Modify playlist display text when adding location

Reply #4
Disadvantages: A proxy decoder breaks copying with File Operations. The approach is also more complex.

Advantages: You get complete control over the returned metadata. Although you will probably want to pass through at the least the tech info from the proxied decoder.

As an example you can check out the cue sheet support in the SDK.

Modify playlist display text when adding location

Reply #5
Hmm .. ok.

I think my solution is good enough, thanks anyway.