HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: HunsAffe on 2012-05-05 16:13:15

Title: Get raw title from stream
Post by: HunsAffe on 2012-05-05 16:13:15
I feel kinda stupid for asking this question, but googling for 20 minutes didn't bring up anything related to my problem.
So I'm writing a component for foobar2000, just getting started and trying to do basic things like getting the current track's meta-data.
Everything works fine for local files, but when playing a stream, I can't seem to get the stream's title as transmited by the server.

I read that foobar2000 tries to be smart and splits the stream title at the first - to fill the artist and title fields.
In foobar's playlist this even works as expected, I see artist and title assigned properly. However, in my component I get the station name as the title, and nothing as the artist.
Also, for debugging I tried reading directly from the file_info struct, but even there things are "messed up"

This is my test code:
Code: [Select]
    metadb_handle_ptr track;
    static_api_ptr_t<play_control>()->get_now_playing(track);
    file_info_impl fi;
    track->get_info(fi); // List ALL meta tags for this track
    for (int i = fi.meta_get_count() - 1; i >= 0; --i) {
        dlog("Have: %s(%d) -> %s", fi.meta_enum_name(i), (int)fi.meta_enum_value_count(i), fi.meta_enum_value(i, 0));
    }


The result in my debug log is:
Code: [Select]
Have: url(1) -> http://www.facebook.com/BigBRadio143
Have: genre(1) -> Chinese Asian CPOP Cantonese Mandarin C-POP Asian Canto-Pop Mando-Pop Taiwan China Singapore Malaysia Taiwanese World International
Have: title(1) -> Big B Radio - CPOP | The Hot Station for Asian Music

In Winamp for example, this stream displays as "Jess Lee - Shoes (Big B Radio - CPOP | The Hot Station for Asian Music)"

Any help?
Title: Get raw title from stream
Post by: HunsAffe on 2012-05-10 01:19:45
So as nobody can provide a working example for this trivial task I take it foobar2000 is simply broken.
Title: Get raw title from stream
Post by: db1989 on 2012-05-10 06:01:10
As you cannot comprehend the possibility that people simply did not notice your thread due to having other things to do in their lives, I take it you are simply an egomaniac who’d rather discredit an entire project than entertain the prospect that the world does not revolve around you.

Hey, this game is fun!
Title: Get raw title from stream
Post by: kode54 on 2012-05-10 08:40:28
All I can tell you is that the info retrieval function you are using only retrieves static information. There may be a way to retrieve dynamic information, but the only thing I know of is format_now_playing.
Title: Get raw title from stream
Post by: foosion on 2012-05-10 09:03:24
I guess what kode54 means is playback_control::playback_format_title() (http://foosion.foobar2000.org/doxygen/latest/classplayback__control.html#a34739264220da2a14cb1d1a1afe174db) with p_level set to display_level_titles or display_level_all.
Title: Get raw title from stream
Post by: kode54 on 2012-05-10 09:09:27
Thanks for resolving that to an exact function and parameters. I guess I just got lazy.
Title: Get raw title from stream
Post by: HunsAffe on 2012-05-11 02:15:04
Someone said something bad about my favourite player and that makes me feel very insecure about myself.
Sorry, can't help you there buddy.




All I can tell you is that the info retrieval function you are using only retrieves static information. There may be a way to retrieve dynamic information, but the only thing I know of is format_now_playing.

I guess what kode54 means is playback_control::playback_format_title() (http://foosion.foobar2000.org/doxygen/latest/classplayback__control.html#a34739264220da2a14cb1d1a1afe174db) with p_level set to display_level_titles or display_level_all.

Thanks guys, that did the trick! I focused too much on the metadb_handle object you get via playback_control::get_now_playing()