Page 1 of 1

Question about ContentURLContainer for rss feeds

PostPosted: Thu Jan 19, 2012 8:38 am
by WindWalker
Hi all,

I'm writing a plugin for an rss feed, and the current API documentation from viewtopic.php?f=22&t=3274 is not clear about the live property being supported in this context.

Page 6 does not list it in the function header example but page 7 lists it in the description.

Either way when I try to run the code and set a stream as live I get this error for every entry in the RSS:

  Code:
2012-01-18 22:12:49,886 DEBUG [FeedItemUrlExtractor] InternodeLiveRadioFeeds: Starting extraction of url for item: EYE97
2012-01-18 22:12:49,887 DEBUG [FeedParser] Unexpected error during url extractor plugin invocation (InternodeLiveRadioFeeds) for item EYE97: No such property: live for class: InternodeLiveRadioFeeds


I'm confused - help! :lol: :oops:

Re: Question about ContentURLContainer for rss feeds

PostPosted: Thu Jan 19, 2012 9:44 am
by zip
ContentURLContainer is your return type so you have to build this object. One of it's properties is live by which you tell Serviio that the content is a live stream.

Re: Question about ContentURLContainer for rss feeds

PostPosted: Thu Jan 19, 2012 10:23 am
by WindWalker
Hmm I cut down my code to the bare bones and now it seems to work! :D

So is there anything wrong with using the following code to extract live feeds from an rss?

  Code:
class InternodeLiveRadioFeeds extends FeedItemUrlExtractor {

   final VALID_FEED_URL = 'http://feeds.internode.on.net/radio.rss'
   
   String getExtractorName() {
      return getClass().getName()
   }
   
   boolean extractorMatches(URL feedUrl) {
      return feedUrl ==~ VALID_FEED_URL   
      }

   ContentURLContainer extractUrl(Map links, PreferredQuality requestedQuality) {
      return new ContentURLContainer(fileType: MediaFileType.AUDIO, contentUrl: links.default, live: true)
   }

   static void main(args) {
   
      // this is just to test
        InternodeLiveRadioFeeds extractor = new InternodeLiveRadioFeeds()
      
      // check the url matching
      assert extractor.extractorMatches( new URL("http://feeds.internode.on.net/radio.rss") )
      
    }
   
}

Re: Question about ContentURLContainer for rss feeds

PostPosted: Thu Jan 19, 2012 11:37 am
by zip
that looks fine

Re: Question about ContentURLContainer for rss feeds

PostPosted: Sat Jan 28, 2012 4:49 pm
by jhb50
WindWalker wrote:I'm writing a plugin for an rss feed

You might want to check out this wiki for the plugin that already exists for live feed rss's: How To Create RSS Folders of your Live Streams (0.6.1+)
http://wiki.serviio.org/doku.php?id=live_stream_folders