From 4cfa79488f52790c75e73bc1835ae4a01341173b Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 3 Sep 2013 20:21:49 +0200 Subject: [PATCH] PublicHD cache description call --- .../core/providers/torrent/publichd/main.py | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/couchpotato/core/providers/torrent/publichd/main.py b/couchpotato/core/providers/torrent/publichd/main.py index c93f5cd1..7799b4f8 100644 --- a/couchpotato/core/providers/torrent/publichd/main.py +++ b/couchpotato/core/providers/torrent/publichd/main.py @@ -68,14 +68,21 @@ class PublicHD(TorrentMagnetProvider): def getMoreInfo(self, item): - try: - full_description = self.getCache('publichd.%s' % item['id'], item['detail_url'], cache_timeout = 25920000) - html = BeautifulSoup(full_description) - nfo_pre = html.find('div', attrs = {'id':'torrmain'}) - description = toUnicode(nfo_pre.text) if nfo_pre else '' - except: - log.error('Failed getting more info for %s', item['name']) - description = '' + cache_key = 'publichd.%s' % item['id'] + description = self.getCache(cache_key) + + if not description: + + try: + full_description = self.urlopen(item['detail_url'], cache_timeout = 25920000) + html = BeautifulSoup(full_description) + nfo_pre = html.find('div', attrs = {'id':'torrmain'}) + description = toUnicode(nfo_pre.text) if nfo_pre else '' + except: + log.error('Failed getting more info for %s', item['name']) + description = '' + + self.setCache(cache_key, description) item['description'] = description return item