summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLunatixz <Lunatixz@users.noreply.github.com>2017-09-03 15:01:42 -0400
committerenen92 <enen92@users.noreply.github.com>2017-09-03 20:01:42 +0100
commit5e3b5d8ad55a2040520f023826b669f69d331847 (patch)
treef9cd48046300ebeb8692b7c954e80c3cdbe6679f
parent4b45a2ea025f7b91a8c0d6df47eff23329869088 (diff)
[plugin.video.newsy] 1.0.2 (#1393)
Added resolverurl cache, tweaked pagination end value.
-rw-r--r--plugin.video.newsy/addon.xml4
-rw-r--r--plugin.video.newsy/resources/lib/newsy.py16
2 files changed, 12 insertions, 8 deletions
diff --git a/plugin.video.newsy/addon.xml b/plugin.video.newsy/addon.xml
index dac4f66..268499c 100644
--- a/plugin.video.newsy/addon.xml
+++ b/plugin.video.newsy/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.newsy" version="1.0.1" name="Newsy" provider-name="Lunatixz">
+<addon id="plugin.video.newsy" version="1.0.2" name="Newsy" provider-name="Lunatixz">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
<import addon="script.module.simplecache" version="1.0.0"/>
@@ -17,7 +17,7 @@
<source>https://github.com/Lunatixz/XBMC_Addons/tree/master/plugin.video.newsy</source>
<website>http://www.newsy.com</website>
<forum>https://forum.kodi.tv/showthread.php?tid=320402</forum>
- <news>[CR]v1.0.1[CR]- Improved browsing speed.</news>
+ <news>[CR]v1.0.2[CR]- Improved caching.[CR]v1.0.1[CR]- Improved browsing speed.</news>
<assets>
<icon>resources/images/icon.png</icon>
<fanart>resources/images/fanart.jpg</fanart>
diff --git a/plugin.video.newsy/resources/lib/newsy.py b/plugin.video.newsy/resources/lib/newsy.py
index 8ed09fd..640e8ad 100644
--- a/plugin.video.newsy/resources/lib/newsy.py
+++ b/plugin.video.newsy/resources/lib/newsy.py
@@ -108,7 +108,7 @@ class Newsy(object):
yield seq[start:start+rowlen]
- def buildRSS(self, start=0, end=14):
+ def buildRSS(self, start=0, end=9):
data = feedparser.parse(RSSURL)['entries']
data = list(self.pagination(data, end))
start = 0 if start >= len(data) else start
@@ -133,11 +133,15 @@ class Newsy(object):
def resolveURL(self, url):
log('resolveURL, url = ' + str(url))
try:
- soup = BeautifulSoup(self.openURL(url), "html.parser")
- link = soup('div' , {'class': 'video-container'})[0]
- item = json.loads(link('div' , {'class': 'video-container'})[0].get('data-video-player'))
- url = item['file'] if VID_TYPE == 'MP4' else 'http:'+item['stream']
- return url, item['duration']//1000, item['headline']
+ cacheResponse = self.cache.get(ADDON_NAME + '.resolveURL, url = %s'%url)
+ if not cacheResponse:
+ soup = BeautifulSoup(self.openURL(url), "html.parser")
+ link = soup('div' , {'class': 'video-container'})[0]
+ item = json.loads(link('div' , {'class': 'video-container'})[0].get('data-video-player'))
+ path = item['file'] if VID_TYPE == 'MP4' else 'http:'+item['stream']
+ rep = path, item['duration']//1000, item['headline']
+ self.cache.set(ADDON_NAME + '.resolveURL, url = %s'%url, rep, expiration=datetime.timedelta(hours=48))
+ return self.cache.get(ADDON_NAME + '.resolveURL, url = %s'%url)
except Exception, e:
log("resolveURL Failed! " + str(e), xbmc.LOGERROR)