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

    Nested Atom to RSS

    I am trying to get a broadcaster's RSS/Atom feed to work with LMS.
    They have some proprietary attributes in the XML instead of using Enclosure for the link to the audio content.
    I have that working ... but ... only where the Atom feed is for a particular episode.

    They nest their Atom data ... e.g. Station->Programme->Episode - with each step requiring a hew http fetch of the next XML.

    So if I set the start of the feed at the Station XML I had hoped that I would be able to see the list of programmes (which I do) and then click on a Programme to see the list of Episodes ... however, I see the Programme info but not the list of episodes.

    I am working on a locally edited copy of Formats/XML.pm to try to work this out.
    I tried returning the URL to the next level down in "$item{link}" but that does not work.

    I don't mind digging further to try to resolve this ... but is such nesting expected to be possible?
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,015
    A bit more on this ...
    The Atom feed uses the "link" field in the entry to point to the next layer ... something like this

    Code:
    <link rel="self" type="application/atom+xml" href="https://somewhere.com/anotheratom.xml"/>
    So I can spot them by checking the "type" value.
    I just need to know what to do with them so make LMS navigate down to the next level.

    I see from the code in XML.pm that "recursive" OPML is supported ... so maybe I need to copy some of that technique.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  3. #3
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    19,301
    With linked processing - generating a menu with OPML type of "redirect" can sometime be useful to avoid showing many levels of menu to user.

    Beware of LMS caching , if fetching the same URL more than once with the intent of parsing it differently.

  4. #4
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,015
    My hope is to get the non-standard attributes to be accepted into the shipped XML.pm (there are already a small number of non-standard things in it to handle oddities seen in the wild) so that it simply becomes another available podcast URL rather than writing a whole new plugin ... but that depends on a number of things.
    If nesting is not supportable for an Atom feed then that rules that out and I can change approach.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    3,015
    I managed to get it to work with some messing around.

    The trick is (in XML.pm parseAtom routine) to return a field called "url" in the "item" when the object is a link to next level.
    There were some other bits and pieces - but in essence ...
    Code:
    		if ( !$item{link} && $itemXML->{link} && ref $itemXML->{link} && ref $itemXML->{link} eq 'ARRAY' ) {
    			my @links = grep {
    				$_->{rel} && lc($_->{rel}) eq 'self'
    			} @{$itemXML->{link}};
    
    			if (scalar @links) {
    				if ( $links[0]->{type} eq 'application/atom+xml' && $links[0]->{href}) {
    					# Force a link to the next Atom document
    					$item{'url'} = unescapeAndTrim($links[0]->{href});
    				}
    			}
    		}
    There are side-effect though ...
    The Atom feed I am using has the same name for each show and the only way to differentiate between them is to put the update/publication date into the show title. So that is not very good or portable.

    The other one is that they only put the link to the media to play in a final Atom XML linked to from a single episode XML ... so it needs more clicking than the user would want (and they might give up when navigating towards it).

    Also - and probably the biggest issue but I expect there is a way around it by providing some more/different info to LMS is that navigating using the LMS default web UI works and I can make things play on Squeezeboxes.
    But using JiveLite or Material skin or SB2 remote directly does not get to a playable item ... but with LMS default web UI I can get it to play on SB2 / JiveLite.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

Posting Permissions

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