Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    5,099

    LMS 7.9 - enhancement request - further parsing of Shoutcast track info

    Hello all,

    I have a request - and have a patch for it (but am not git-literate).
    When the track info from a streaming (Shoutcast) server has " - " then it is assumed to be
    artist - track
    I have a special case where there is extra info before the artist name - something like this
    showname: artist - track
    This is not a standard - so I could imagine that people might not want it ... but I think that the chance of a clash with a genuine artist name is very remote.

    I suppose that it could be made configurable (to enable/disable the facility).

    The change would be in /Player/Protocols/HTTP.pm within sub getMetadataFor
    change
    Code:
            my ($artist, $title);
    to
    Code:
            my ($artist, $title, $artistPrefix);
    AND

    Code:
                    my @dashes = $currentTitle =~ /( - )/g;
                    if ( scalar @dashes == 1 ) {
                            ($artist, $title) = split / - /, $currentTitle;
                    }
    to
    Code:
                    my @dashes = $currentTitle =~ /( - )/g;
                    if ( scalar @dashes == 1 ) {
                            ($artist, $title) = split / - /, $currentTitle;
    
                            # Special case - if Artist has a "non-space colon space" then assume special prefix and split again
                            # e.g. "The 60s Chart Show: Beatles - Help!" => artist=Beatles title=Help!
                            # but should not catch "Code : Red Core - Caution" => artist=Code : Red Core title=Caution
                            my @showcolon = $artist =~ /\S: /g;
    
                            if ( scalar @showcolon == 1 ) {
                                    ($artistPrefix, $artist) = split /: /, $artist;
                            }
                    }

    To test - play any Shoutcast station and show that things appear to work as before ... then play "Dandelion Radio" before and after the change.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,666

    LMS 7.9 - enhancement request - furtherparsing of Shoutcast track info

    This sounds like a good idea for a little plugin. You can create your
    own metadata parser, overriding the default behaviour:

    Slim::Formats::RemoteMetadata->registerParser(
    match => qr/shoutcast.com/,
    func => sub {
    my ( $client, $url, $metadata ) = @_;
    # do your magic here
    ...
    },
    );

    Michael


    Am 17.06.14 19:46, schrieb Paul Webster:
    >
    > Hello all,
    >
    > I have a request - and have a patch for it (but am not git-literate).
    > When the track info from a streaming (Shoutcast) server has " - " then
    > it is assumed to be
    > artist - track
    > I have a special case where there is extra info before the artist name -
    > something like this
    > showname: artist - track
    > This is not a standard - so I could imagine that people might not want
    > it ... but I think that the chance of a clash with a genuine artist name
    > is very remote.
    >
    > I suppose that it could be made configurable (to enable/disable the
    > facility).
    >
    > The change would be in /Player/Protocols/HTTP.pm within sub
    > getMetadataFor
    > change
    >
    > Code:
    > --------------------
    >
    > my ($artist, $title);
    >
    > --------------------
    >
    >
    > to
    >
    > Code:
    > --------------------
    >
    > my ($artist, $title, $artistPrefix);
    >
    > --------------------
    >
    >
    > AND
    >
    >
    > Code:
    > --------------------
    >
    > my @dashes = $currentTitle =~ /( - )/g;
    > if ( scalar @dashes == 1 ) {
    > ($artist, $title) = split / - /, $currentTitle;
    > }
    >
    > --------------------
    >
    >
    > to
    >
    > Code:
    > --------------------
    >
    > my @dashes = $currentTitle =~ /( - )/g;
    > if ( scalar @dashes == 1 ) {
    > ($artist, $title) = split / - /, $currentTitle;
    >
    > # Special case - if Artist has a "non-space colon space" then assume special prefix and split again
    > # e.g. "The 60s Chart Show: Beatles - Help!" => artist=Beatles title=Help!
    > # but should not catch "Code : Red Core - Caution" => artist=Code : Red Core title=Caution
    > my @showcolon = $artist =~ /\S: /g;
    >
    > if ( scalar @showcolon == 1 ) {
    > ($artistPrefix, $artist) = split /: /, $artist;
    > }
    > }
    >
    > --------------------
    >
    >
    >
    > To test - play any Shoutcast station and show that things appear to work
    > as before ... then play "Dandelion Radio" before and after the change.
    >
    >
    >
    > Paul Webster
    > http://dabdig.blogspot.com
    > ------------------------------------------------------------------------
    > Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
    > View this thread: http://forums.slimdevices.com/showthread.php?t=101728
    >
    >

  3. #3
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    5,099
    I thought about something like that - filtering on dandelionradio.com
    The code would then be, in essence, a clone of what is in HTTP.pm with the risk that it becomes out of date if things change in the future and probably needing people to download it.
    The benefit would the be that there would be no chance of it affecting other stations that might put a colon in their metadata "artist" for some other reason.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  4. #4
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    5,099
    Bringing this one back from the dead because I spent a bit of time working on making my own plug-in yesterday as suggested.

    I used Michael's DRS plugin as a template and I have mine working now but there are some issues that I would like some guidance with.

    1) URL filter
    My filter works when I play by typing in the stream URL but if I play via the regular RadioTime/TuneIn station list then, not unreasonably I suppose, I do not get a match.
    My guess is that I could try to hijack the TuneIn URL when it includes my station id but they could break ... and what does LMS do if more than 1 filter matches the same stream URL

    2) Artwork
    I can extend my code to put artist/track/show/station image but ... wouldn't it be better for the plugin to be able to signal that it is happy for LMS to provide this and then let it fall through to the (say) TuneIn artwork finder (based in the artist and track info that my plugin returned?
    e.g. not returning icon attribute could mean that plugin wants LMS to try and find one and returning empty attribute could mean that (for some reason) the plugin does not want the automated search to be done.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  5. #5
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,666

    LMS 7.9 - enhancement request - furtherparsing of Shoutcast track info

    > 1) URL filter
    > My filter works when I play by typing in the stream URL but if I play
    > via the regular RadioTime/TuneIn station list then, not unreasonably I
    > suppose, I do not get a match.
    > My guess is that I could try to hijack the TuneIn URL when it includes
    > my station id but they could break ... and what does LMS do if more than
    > 1 filter matches the same stream URL


    In my experience the TuneIn station ID is pretty stable. I'm using it
    eg. in the Radio Paradise plugin, too.

    > 2) Artwork
    > I can extend my code to put artist/track/show/station image but ...
    > wouldn't it be better for the plugin to be able to signal that it is
    > happy for LMS to provide this and then let it fall through to the (say)
    > TuneIn artwork finder (based in the artist and track info that my plugin
    > returned?
    > e.g. not returning icon attribute could mean that plugin wants LMS to
    > try and find one and returning empty attribute could mean that (for some
    > reason) the plugin does not want the automated search to be done.


    Hmm... iirc this doesn't work (and I have wanted that behaviour
    before...). The best you could probably do is reach out into TuneIn's
    metadata handler and call it the same way that plugin does, when you
    need it.

    --

    Michael

  6. #6
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    5,099
    old topic ...

    I've gone for a halfway solution that has the big benefit that no-one has to install any new plugin ...
    The station now puts artwork link into the StreamURL Shoutcast ICY data - which then gets displayed by magic on appropriate Squeezebox devices.
    Does not resolve the artist name issue - but can live with that.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  7. #7
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    5,099
    Seven and a half years after suggesting these changes, I have finally implemented them as part of a plugin.
    It includes parsing of SHOUTcast ICY StreamTitle and looking up missing cover art

    It is in my Radio Now Playing plugin that is available via the LMS 3rd-party plugin list
    https://forums.slimdevices.com/showt...Playing-plugin

    The parsing is done by regex and is held in a configuration file which makes it relatively easy to adapt for other stations if needed.
    But given that no-one else in the last 7 years has asked for this capability then I suspect it is just my big itch that was finally scratched.

    The regex looks something like this
    Code:
    StreamTitle=\'(?<progtitle>.*?): (?<artist>.*?)(?: - (?<title>.*?))?\'(?:;|$)(?:StreamUrl=\'(?<cover>.*)\'(?:;|$))?
    which, if given

    Code:
    StreamTitle='Happy Hour: The Beatles - When I'm 64';StreamUrl='https://lastfm.freetls.fastly.net/i/u/770x0/56c8ae3f99db414db15270f6adcc0f5b.gif#56c8ae3f99db414db15270f6adcc0f5b';
    will return:
    Code:
    progtitle=Happy Hour
    artist=The Beatles
    title=When I'm 64
    cover=https://lastfm.freetls.fastly.net/i/u/770x0/56c8ae3f99db414db15270f6adcc0f5b.gif#56c8ae3f99db414db15270f6adcc0f5b
    The regex is a bit more complicated than you might think it needs to be because it has to return sensible things when there is no song artist/title (implying a spoken link).
    Last edited by Paul Webster; 2021-11-26 at 07:16.
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •