jacquesh / foo_openlyrics

An open-source lyric display panel for foobar2000
MIT License
404 stars 24 forks source link

Add support of network music stream (such as online radio) with dynamic info about track #49

Closed oleg-babintsev closed 1 year ago

oleg-babintsev commented 2 years ago

Add support of network music stream (such as online radio) with dynamic info about track.

image

jacquesh commented 2 years ago

None of the music stream/online radio sources I tried seemed to provide tag info in foobar. Can you confirm that tag info is available for you without any other components/plugins that might retrieve it?

Also could you give me an example of exactly which streams/radios you're using that provide this info?

Finally, in case I can't reproduce it, can you post a screenshot of the tag info that foobar has for that playlist item? (Right-click on it -> Properties -> Metadata tab).

Big-aap commented 2 years ago

https://s4-webradio.antenne.de/antenne/stream

This stream shows song title & artist in foobar. The metadata fields are mostly empty tho. https://i.imgur.com/n3SFHWW.png

oleg-babintsev commented 2 years ago
  1. I use RadioTunes service
  2. Metadata don't contain dynamic information image

But as example, old plugin Lyrics Show Panel v3 can works with streams: image

jacquesh commented 2 years ago

Hmmm, odd. I still don't get any metadata in the track list or in LSP3. I'm intrigued and I have a reasonable guess as to what I'd need to do to get this to work but its obviously difficult to try out if I can't get a radio stream working on my machine >_<

Bear with me here, these are the steps I'm taking:

  1. File->Add Location -> https://s4-webradio.antenne.de/antenne/stream
  2. Play the new item in the playlist
  3. It plays but I still just see "stream" as the title and nothing under artist/album like so: image

I get this same behaviour for every radio/stream I tried (I tried some random ones from around the internet, though it seems RadioTunes requires a subscription to use external players so I couldn't try that). Am I missing a step or do doing something wrong here? >_<

oleg-babintsev commented 2 years ago

Hi,

I have fresh installation of foobar v1.6.7 (and on previous versions I always had the similar behaviour). Test of https://s4-webradio.antenne.de/antenne/stream with Lyrics Show Panel v3: image

All works fine :)

anazzani commented 2 years ago

Could it be related to dynamic track titles setting? See here.

oleg-babintsev commented 2 years ago

Thanks anazzani,

I confirm, if option "Enable dynamic track titles" is off the artist and title didn't detected by foobar playlist and by LSP3.

image

jacquesh commented 2 years ago

Oh sweet, yeah now it gets the info for me. Thanks for that info, I'll look into getting that info into the lyric search then!

jacquesh commented 2 years ago

For future reference, I'm kinda waiting for some help with how to get this information. I have asked on the fb2k forums here: https://hydrogenaud.io/index.php?topic=121479

I could get around this by holding onto the dynamic track info returned in the on_playback_dynamic_info_track callback but it'd be rather tedious and require a significant amount of re-arranging the data flow.

marc2k3 commented 2 years ago

You don't get it from the info arg that is passed to the callback. You have to use playback_format_title from playback_control.h like was mentioned on the forums.

Assuming you had these as members of a class derived from play_callback_static.

pfc::string8 m_artist, m_title;

then...

void on_playback_dynamic_info_track(const file_info&) override
{
    titleformat_object::ptr obj;
    titleformat_compiler::get()->compile_safe(obj, "%artist%");
    playback_control::get()->playback_format_title(nullptr, m_artist, obj, nullptr, playback_control::display_level_all);

    // then do the same again to get the title
}
jacquesh commented 1 year ago

fyi I've added this to the list for v1.4 (not the next release, the one after that), or at least to revisit it using the new metadb v2 available in upcoming fb2k v2.0 beta (https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Development:SDK_2022-08-10_Release_Notes)

jacquesh commented 1 year ago

Just to update those watching & waiting for this feature: I know I said this would be done for v1.4 but I've moved it to v1.5 because 1.4 is a bugfix-only release that I wanted to get out soon (because it fixes a bug that could cause data loss for some lyrics) and supporting internet radio streams requires some significant changes to the way openlyrics manages things internally. On top of that I'm unlikely to have any time to work on openlyrics for the next little while so I didn't want to release a new version with higher-than-usual potential for bugs and then not be around to fix it if anything critical came up.

On the upside, I have made a start on supporting this and indeed the new APIs provided by the recent fb2k updates do make this much easier to do. So this will get done, you'll just need to wait for a slightly higher version number. Thank you all for your patience!