summaryrefslogtreecommitdiff
path: root/plugin.video.news12
diff options
context:
space:
mode:
authorLunatixz <Kgraer@gmail.com>2017-08-05 12:49:19 -0400
committerLunatixz <Kgraer@gmail.com>2017-08-05 12:49:19 -0400
commitfb91847d185277ece4f6351307ba05798fb5664b (patch)
tree39cbab27dd6c7a47f1ed37e8abed4b816a14d81c /plugin.video.news12
parent6eb9233080bcd52d34aba3c1beed982fa1f6e9e6 (diff)
[plugin.video.news12] 1.0.1
Diffstat (limited to 'plugin.video.news12')
-rw-r--r--plugin.video.news12/addon.xml4
-rw-r--r--plugin.video.news12/default.py20
-rw-r--r--plugin.video.news12/resources/settings.xml2
3 files changed, 14 insertions, 12 deletions
diff --git a/plugin.video.news12/addon.xml b/plugin.video.news12/addon.xml
index cbe28df..c154b1e 100644
--- a/plugin.video.news12/addon.xml
+++ b/plugin.video.news12/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<addon id="plugin.video.news12" version="1.0.0" name="News12" provider-name="Lunatixz">
+<addon id="plugin.video.news12" version="1.0.1" name="News12" 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.news12</source>
<website>http://news12.com</website>
<forum>https://forum.kodi.tv/showthread.php?tid=319396</forum>
- <news></news>
+ <news>1.0.1[CR]- Fixed Video Quality Error</news>
<assets>
<icon>resources/images/icon.png</icon>
<fanart>resources/images/fanart.jpg</fanart>
diff --git a/plugin.video.news12/default.py b/plugin.video.news12/default.py
index 47eaccf..03ba201 100644
--- a/plugin.video.news12/default.py
+++ b/plugin.video.news12/default.py
@@ -38,7 +38,7 @@ LANGUAGE = REAL_SETTINGS.getLocalizedString
## GLOBALS ##
TIMEOUT = 15
DEBUG = REAL_SETTINGS.getSetting('Enable_Debugging') == 'true'
-BITRATE = {LANGUAGE(30003):'1049',LANGUAGE(30004):'1832',LANGUAGE(30005):'7989'}[REAL_SETTINGS.getSetting('Video_Quality')]
+BITRATE = {0:LANGUAGE(30003),1:LANGUAGE(30004),2:LANGUAGE(30005)}[int(REAL_SETTINGS.getSetting('Video_Quality'))]
BASEURL = 'http://news12.com'
RSSURL = '%s/?clienttype=rss'
BASEIMG = 'http://ftpcontent.worldnow.com/professionalservices/clients/news12/images/regions/selectregion_%i.jpg'
@@ -52,10 +52,7 @@ def log(msg, level=xbmc.LOGDEBUG):
if level == xbmc.LOGERROR:
msg += ' ,' + traceback.format_exc()
xbmc.log(ADDON_ID + '-' + ADDON_VERSION + '-' + (msg), level)
-
-def isClose(x, y, tolerance=.501):
- return abs(x-y) <= 0.5 * tolerance * (x + y)
-
+
def getParams():
param=[]
if len(sys.argv[2])>=2:
@@ -140,7 +137,7 @@ class News12():
label = item['title']
plot = item['summary_detail']['value']
plot = '%s - %s'%(item['published'], plot)
- infoLabel = {"mediatype":"video","label":label,"title":label,"plot":plot,"plotoutline":plot,"genre":"News","duration":duration}
+ infoLabel = {"mediatype":"video","label":label,"title":label,"plot":plot,"plotoutline":plot,"genre":"News","duration":duration}
infoArt = {"thumb":thumb,"poster":thumb,"icon":ICON,"fanart":FANART}
self.addLink(label,path,9,infoLabel,infoArt,len(feed['entries']))
except Exception, e:
@@ -158,9 +155,14 @@ class News12():
items = json.loads(self.openURL(VODURL%(name,clip)))
if items and 'channel' in items:
for video in items['channel']['item']['media-group']['media-content']:
- if video and '@attributes' in video and isClose(int(video['@attributes']['bitrate']), int(BITRATE)):
- log('resolveURL, using bitrate = ' + str(video['@attributes']['bitrate']))
- return video['@attributes']['url'], int(video['@attributes']['duration'])
+ if BITRATE == LANGUAGE(30003) and int(video['@attributes']['bitrate']) > 1200:
+ continue
+ elif BITRATE == LANGUAGE(30004) and int(video['@attributes']['bitrate']) > 2200 and int(video['@attributes']['bitrate']) < 1200:
+ continue
+ elif BITRATE == LANGUAGE(30005) and int(video['@attributes']['bitrate']) < 2200:
+ continue
+ log('resolveURL, using bitrate = ' + str(video['@attributes']['bitrate']))
+ return video['@attributes']['url'], int(video['@attributes']['duration'])
return video['@attributes']['url'], int(video['@attributes']['duration'])
diff --git a/plugin.video.news12/resources/settings.xml b/plugin.video.news12/resources/settings.xml
index 24f8422..423c351 100644
--- a/plugin.video.news12/resources/settings.xml
+++ b/plugin.video.news12/resources/settings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<setting id="Enable_Debugging" type="bool" label="30000" default="false" />
- <setting id="Video_Quality" type="labelenum" label="30002" lvalues="30003|30004|30005" />
+ <setting id="Video_Quality" type="enum" label="30002" default="1" lvalues="30003|30004|30005" />
</settings>