From 96f918742a02a66c9073512719385878cb619637 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 15 Aug 2014 11:43:11 +0800 Subject: [PATCH] Fix for omgwtfnzb skipping: release error --- sickbeard/providers/omgwtfnzbs.py | 20 ++++++++++++++++++++ sickbeard/tvcache.py | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/sickbeard/providers/omgwtfnzbs.py b/sickbeard/providers/omgwtfnzbs.py index 26177ba5..2e0728c2 100644 --- a/sickbeard/providers/omgwtfnzbs.py +++ b/sickbeard/providers/omgwtfnzbs.py @@ -154,6 +154,26 @@ class OmgwtfnzbsCache(tvcache.TVCache): tvcache.TVCache.__init__(self, provider) self.minTime = 20 + def _get_title_and_url(self, item): + """ + Retrieves the title and URL data from the item XML node + + item: An elementtree.ElementTree element representing the tag of the RSS feed + + Returns: A tuple containing two strings representing title and URL respectively + """ + + title = item.title if item.title else None + if title: + title = u'' + title + title = title.replace(' ', '.') + + url = item.link if item.link else None + if url: + url = url.replace('&', '&') + + return (title, url) + def _getDailyData(self): params = {'user': provider.username, 'api': provider.api_key, diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index f6a59a45..10874a92 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -96,6 +96,10 @@ class TVCache(): myDB = self._getDB() myDB.action("DELETE FROM [" + self.providerID + "] WHERE time < ?", [int(time.mktime(curDate.timetuple()))]) + def _get_title_and_url(self, item): + # override this in the provider if daily search has a different data layout to backlog searches + return self.provider._get_title_and_url(item) + def _getRSSData(self): data = None @@ -128,7 +132,7 @@ class TVCache(): # parse data cl = [] for item in data: - title, url = self.provider._get_title_and_url(item) + title, url = self._get_title_and_url(item) ci = self._parseItem(title, url) if ci is not None: cl.append(ci)