Page 1 of 1

Error on plugin!!

PostPosted: Sat Feb 11, 2012 7:49 am
by ritzzen
Hi ,

I wrote a plugin to extract the image feed. But its failing with following error. Please help me to fix this. I am not very familiar with plugin code, just picked up existing one and tried to modify them. Appreciate any help.

Error log says

2012-02-11 02:18:59,959 DEBUG [OnlineRepositoryDAOImpl] Reading an OnlineRepository (id = 138)
2012-02-11 02:18:59,960 DEBUG [OnlineLibraryManager] Resource http://feeds.feedburner.com/Pixses not in cache yet, loading it
2012-02-11 02:18:59,960 DEBUG [FeedParser] Parsing feed 'http://feeds.feedburner.com/Pixses'
2012-02-11 02:19:01,005 DEBUG [FeedParser] Found matching url extractor (PixsesURLextract) for resource http://feeds.feedburner.com/Pixses
2012-02-11 02:19:01,006 DEBUG [FeedItemUrlExtractor] PixsesURLextract: Starting extraction of url for item: NRI Beauty Preeti Desai Sizzles on Screen
2012-02-11 02:19:02,005 DEBUG [FeedItemUrlExtractor] PixsesURLextract: Extract URL: http://www.pixses.com/nri-beauty-preeti ... creen.html
2012-02-11 02:19:02,017 DEBUG [FeedItemUrlExtractor] PixsesURLextract: Finished extraction of url: ContentURLContainer [fileType=IMAGE, contentUrl=http://www.pixses.com/wp-content/uploads/preeti_desai_07.jpg, live=false, expiresImmediately=false, ]
2012-02-11 02:19:02,017 DEBUG [FeedParser] Cannot add feed entry of feed PIXSES | Hot Picture Special Collection because of invalid metadata. Message: Unknown online item image container.

And here is my plugin code
  Code:
import org.serviio.library.metadata.*
import org.serviio.library.online.*
import org.serviio.util.*


/** Pixses.com content URL extractor plugin.
 *
 * Based on Youtube.groovy by Petr Nejedly
 *
 * @author Erwin Bovendeur
 *
 */
class PixsesURLextract extends FeedItemUrlExtractor {

   final VALID_FEED_URL = '^http://feeds.feedburner.com/Pixses*'

   String getExtractorName() {
      return getClass().getName();
   }

   boolean extractorMatches(URL feedUrl) {
      return feedUrl ==~ VALID_FEED_URL;
   }

   
   ContentURLContainer extractUrl(Map links, PreferredQuality requestedQuality) {
      def linkUrl = links.alternate != null ? links.alternate : links.default
                String pageHtml = linkUrl.getText()
                def seqVarMatcher = pageHtml =~ 'http://www.pixses.com/wp-content/uploads.+jpg'
                assert seqVarMatcher != null
                def contentUrl = seqVarMatcher[0]
      log("Extract URL: " + linkUrl)
      return new ContentURLContainer(fileType: MediaFileType.IMAGE, contentUrl: contentUrl)           
   }

   /* Groovy test method */
   static void main(args) {
      PixsesURLextract extractor = new PixsesURLextract()
      assert extractor.extractorMatches( new URL("http://feeds.feedburner.com/Pixses"))
      Map links = ['default': new URL("http://www.pixses.com/nri-beauty-preeti-desai-sizzles-on-screen.html")]
      ContentURLContainer result = extractor.extractUrl(links, PreferredQuality.MEDIUM)
      println "Result: $result"
   }
}



Thanks

Ritz

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 1:01 pm
by Illico
Plugin seems good, no ideas

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 1:23 pm
by ritzzen
Is there a different method to handle image feeds? I was thinking since i followed the plugin code from a video feed, so it is getting this kind of error for image feed.

'because of invalid metadata. Message: Unknown online item image container."

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 1:34 pm
by Illico
ritzzen wrote:'because of invalid metadata. Message: Unknown online item image container."

Yes, this is the error source...don't know why ... will ask to ZIP.

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 2:28 pm
by zip
Oops, it's a bug which won't allow images properly processed when coming from plugins. I raised a ticket: https://bitbucket.org/xnejp03/serviio/i ... rt-plugins

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 3:16 pm
by ritzzen
So it mean this fix would be available in the next release right?

Thanks

Ritz

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 3:49 pm
by zip
yes

Re: Error on plugin!!

PostPosted: Sat Feb 11, 2012 8:38 pm
by ritzzen
Looks like there is another bug, not very sure about it, but thats what it looks to me, if serviio finds thumburl as feed(thumburl encoded as "enclosure url="), it does not use plugin. what i mean to say that once serviio finds a feed and if we want to override it by using a plugin, it does not accept the plugin.
Let me know your say on it.

Thank

Ritz

Re: Error on plugin!!

PostPosted: Sun Feb 12, 2012 1:50 am
by zip
ritzzen wrote:Looks like there is another bug, not very sure about it, but thats what it looks to me, if serviio finds thumburl as feed(thumburl encoded as "enclosure url="), it does not use plugin. what i mean to say that once serviio finds a feed and if we want to override it by using a plugin, it does not accept the plugin.
Let me know your say on it.

Thank

Ritz

looking at the code it should run plugin if the matches() method returns true