The branch, frodo has been updated
via 59e57010d5081e46caf08a0e0d9b327fa0712cf9 (commit)
from 9fcf2c0465e346ead6169a8b49ba97398eb3ef22 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=59e57010d5081e46caf08a0e0d9b327fa0712cf9
commit 59e57010d5081e46caf08a0e0d9b327fa0712cf9
Author: Martijn Kaijser <[email protected]>
Date: Fri Oct 18 08:29:54 2013 +0200
[plugin.video.wsj] 1.7.2
diff --git a/plugin.video.wsj/README.txt b/plugin.video.wsj/README.txt
index 5e6a8ef..809beff 100644
--- a/plugin.video.wsj/README.txt
+++ b/plugin.video.wsj/README.txt
@@ -1,6 +1,19 @@
plugin.video.wsj
================
+version 1.7.2 added language string support
+
+version 1.7.0 cleaned up how news articles are loaded, unicode issues
+
+version 1.2.0
+added gzip content-encoding support
+added select video and thumbnail resolution
+
+version 1.1.0
+fixed sort methods, added required fields in addon.xml
+
+
+
version 1.0.1 changes:
icon.png - icon size set to 64x64
fanart.jpg - fanart size set to 1280*720
diff --git a/plugin.video.wsj/addon.xml b/plugin.video.wsj/addon.xml
index 58112b3..3930b45 100644
--- a/plugin.video.wsj/addon.xml
+++ b/plugin.video.wsj/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.wsj"
name="The Wall Street Journal Live"
- version="1.0.1"
+ version="1.7.2"
provider-name="t1m">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
@@ -16,5 +16,10 @@
<disclaimer lang="en">Feel free to use this script. For information visit
the wiki.</disclaimer>
<platform>all</platform>
<language>en</language>
+ <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
+
<forum>http://wiki.xbmc.org/index.php?title=Add-on:The_Wall_Street_Journal_Live</forum>
+ <website></website>
+ <email></email>
+ <source>http://mirrors.xbmc.org/addons/frodo/plugin.video.wsj/</source>
</extension>
</addon>
diff --git a/plugin.video.wsj/changelog.txt b/plugin.video.wsj/changelog.txt
index abc8743..af9c787 100644
--- a/plugin.video.wsj/changelog.txt
+++ b/plugin.video.wsj/changelog.txt
@@ -1 +1,9 @@
-Version 1.0.0 Initial release
\ No newline at end of file
+Version 1.0.0 Initial release
+
+Version 1.1.0 fixed sort methods, added required fields to addon.xml
+
+Version 1.2.0 added gzip content-encoding support, select video and thumbnail
resolution
+
+version 1.7.0 cleaned up how news articles are loaded, unicode issues
+
+version 1.7.2 added language string support
\ No newline at end of file
diff --git a/plugin.video.wsj/default.py b/plugin.video.wsj/default.py
index 4cf619e..549ee1c 100644
--- a/plugin.video.wsj/default.py
+++ b/plugin.video.wsj/default.py
@@ -12,6 +12,9 @@ import xbmcgui
import xbmcaddon
import xbmcvfs
import cgi
+from StringIO import StringIO
+import gzip
+
USER_AGENT = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3)
Gecko/2008092417 Firefox/3.0.3'
@@ -23,11 +26,12 @@ fanart = xbmc.translatePath(os.path.join(home,
'fanart.jpg'))
-
def log(txt):
+ try:
message = '%s: %s' % (__addonname__, txt.encode('ascii', 'ignore'))
xbmc.log(msg=message, level=xbmc.LOGDEBUG)
-
+ except:
+ pass
def _parse_argv():
@@ -61,8 +65,6 @@ def _parse_argv():
mode = None
-
-
def demunge(munge):
try:
munge = urllib.unquote_plus(munge).decode('utf-8')
@@ -70,27 +72,39 @@ def demunge(munge):
pass
return munge
-
-
-
-
-
-
-def getSources():
-
- log("WSJ -- WSJ Live main page")
- req = urllib2.Request("http://live.wsj.com")
+def getRequest(url):
+ log("WSJ - getRequest URL: "+str(url))
+ req = urllib2.Request(url.encode('utf-8'))
req.add_header('User-Agent', USER_AGENT)
+ req.add_header('Accept',"text/html")
+ req.add_header('Accept-Encoding', None )
+ req.add_header('Accept-Encoding', 'gzip,deflate,sdch')
+ req.add_header('Accept-Language', 'en-US,en;q=0.8')
+ req.add_header('Cookie','hide_ce=true')
+ log("RT -- request headers = "+str(req.header_items()))
try:
response = urllib2.urlopen(req)
- link1=response.read()
+ if response.info().getheader('Content-Encoding') == 'gzip':
+ log("WSj -- Content Encoding == 'gzip")
+ buf = StringIO( response.read())
+ f = gzip.GzipFile(fileobj=buf)
+ link1 = f.read()
+ else:
+ link1=response.read()
response.close()
except:
link1 = ""
+ return(link1)
+
+
+def getSources():
+ log("WSJ -- WSJ Live main page")
+ link1 = getRequest("http://live.wsj.com")
link=str(link1).replace('\n','')
- match=re.compile('<li
id="vcrTab_(.+?)".+?data-vcrrss="(.+?)~(.+?)"').findall(str(link))
+ match=re.compile('<li
id="vcrTab_(.+?)".+?data-query="(.+?)".+?~(.+?)"').findall(str(link))
for category, caturl, cattext in match:
+ caturl =
"http://live.wsj.com/api-video/find_all_videos.asp?"+caturl
try:
if (category == "startup") or (category == "markets"):
addDir(cattext.encode('utf-8',
'ignore'),caturl.encode('utf-8'),18,icon,fanart,cattext,"News","",False)
@@ -138,24 +152,15 @@ def
addLink(url,name,iconimage,fanart,description,genre,date,showcontext=True,pl
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz)
return ok
+def strip_unicode(unistr):
+
return(unistr.replace('\\u2018',"'").replace('\\u2019',"'").replace('\\u201C','"').replace('\\u201D','"').replace('\\u2013','-').replace('\\u2014','-').replace('\\u2005','
').replace('\\u00E9','e'))
+
-xbmcplugin.setContent(int(sys.argv[1]), 'movies')
+xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
try:
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED)
except:
pass
-try:
- xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
-except:
- pass
-try:
- xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
-except:
- pass
-try:
- xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_GENRE)
-except:
- pass
url=None
@@ -174,8 +179,10 @@ _parse_argv()
log("WSJ -- Mode: "+str(mode))
+
if not url is None:
- print "WSJ -- URL: "+str(url.encode('utf-8'))
+ log("WSJ -- URL: "+str(url.encode('utf-8')))
+
log("WSJ -- Name: "+str(name))
if mode==None:
@@ -193,81 +200,42 @@ elif mode==13:
elif mode==17:
log("WSJ -- Processing WSJ category item")
- req = urllib2.Request("http://live.wsj.com")
- req.add_header('User-Agent', USER_AGENT)
- try:
- response = urllib2.urlopen(req)
- link1=response.read()
- response.close()
- except:
- link1 = ""
-
+ link1 = getRequest("http://live.wsj.com")
link=str(link1).replace('\n','')
log("WSJ -- url = "+str(url))
match=re.compile('vcrDataPanel_'+str(url)+'(.+?)</ul>').findall(str(link))
for subcat in match:
subcat = str(subcat).replace(">",'>').replace("<",'<')
- submatch = re.compile('<h5
id=".+?data-vcrrss="(.+?)~(.+?)"').findall(str(subcat))
+ submatch = re.compile('<h5
id=".+?data-query="(.+?)".+?~(.+?)"').findall(str(subcat))
for caturl, cattext in submatch:
+ caturl =
"http://live.wsj.com/api-video/find_all_videos.asp?"+caturl
try:
addDir(str(cattext),caturl.encode('utf-8'),18,icon,fanart,str(cattext),"News","",False)
except:
log("WSJ -- problem adding Directory")
-
elif mode==18:
log("WSJ -- Processing WSJ sub category item")
- catextend = False
- if "/mw2/mediarss" in str(url):
- catextend = True
- if catextend:
- log("WSJ -- Is an extended category xml")
- req = urllib2.Request(url.encode('utf-8'))
- print "WSJ -- req === "+str(req)
- req.add_header('User-Agent', USER_AGENT)
- try:
- response = urllib2.urlopen(req)
- link1=response.read()
- response.close()
- except:
- link1 = ""
- link=str(link1).replace('\n','')
-
- if catextend==False:
-
match=re.compile('<item><title>(.+?)</title>.+?<description>(.+?)</description><pubDate>(.+?)</pubDate></item>').findall(str(link))
- for cattitle, catdesc, catdate in match:
- cattitle =
str(cattitle).replace(">",'>').replace("<",'<').replace("&",'&')
- catdesc =
str(catdesc).replace(">",'>').replace("<",'<').replace("&",'&').replace("_167x94.",'')
- catmatch = re.compile('<img
src=(.+?)jpg>(.+)').findall(str(catdesc))
- for caturl,cattext in catmatch:
- caturl = caturl.replace("wsj.vo.llnwd.net/o28","m.wsj.net")
- caticon = caturl+'_167x94.jpg'
- caturl += "_320k.mp4"
- try:
-
addLink(caturl.encode('utf-8'),str(cattitle),caticon,fanart,catdate+'\n'+cattext,"News","")
- except:
- log("WSJ -- Problem adding directory")
- else:
- if (("video-api.wsj.com/" in url) or ("copyflow.asp" in url)):
-
match=re.compile('<item><title>(.+?)</title>.+?<description>(.+?)</description><pubDate>(.+?)</pubDate>.+?.+?height="360"
lang="en" url="(.+?)".+?height="94" url="(.+?)".+?</item>').findall(str(link))
- for cattitle, catdesc, catdate, caturl, caticon in match:
- try:
- cattitle =
str(cattitle).replace(">",'>').replace("<",'<').replace("&",'&')
- catdesc =
str(catdesc).replace(">",'>').replace("<",'<').replace("&",'&')
-
addLink(caturl.encode('utf-8'),str(cattitle),caticon,fanart,catdate+'\n'+catdesc,"News","")
- except:
- log("WSJ -- Problem adding directory")
-
- else:
-
match=re.compile('<item><title>(.+?)</title>.+?<pubDate>(.+?)</pubDate>.+?<description>(.+?)</description>.+?height="720"
lang="en" url="(.+?)".+?height="94" url="(.+?)".+?</item>').findall(str(link))
- for cattitle, catdate, catdesc, caturl, caticon in match:
- try:
- cattitle =
str(cattitle).replace(">",'>').replace("<",'<').replace("&",'&')
- catdesc =
str(catdesc).replace(">",'>').replace("<",'<').replace("&",'&')
-
addLink(caturl.encode('utf-8'),str(cattitle),caticon,fanart,catdate+'\n'+catdesc,"News","")
- except:
- log("WSJ -- Problem adding directory")
+ res_thumbs = ["_640x360.jpg","_512x288.jpg","_167x94.jpg"]
+ res_videos = ["2564k.mp4","1864k.mp4","1264k.mp4","464k.mp4"]
+ i = int(addon.getSetting('vid_res'))
+ res_video = res_videos[i]
+ i = int(addon.getSetting('thumb_res'))
+ res_thumb = res_thumbs[i]
+
+ link1 = getRequest(url)
+
link=str(link1).replace('\n','').replace('\\/','/').replace('\\"',"'")
+ match = re.compile('"name": "(.+?)","description":
"(.+?)".+?"thumbnailURL": "(.+?)_167x94.jpg.+?"videoURL":
"http://hdsvod-f.akamaihd.net/z(.+?),.+?CreationDate": "(.+?)"').findall(link)
+ for cattitle, catdesc, caticon, caturl, catdate in match:
+ caturl = "http://m.wsj.net"+caturl+res_video
+ caticon += res_thumb
+ catdesc = strip_unicode(catdesc)
+ cattitle = strip_unicode(cattitle)
+ try:
+
addLink(caturl.encode('utf-8'),cattitle,caticon,fanart,catdate+'\n'+catdesc,"News","")
+ except:
+ log("WSJ -- Problem adding directory")
xbmcplugin.endOfDirectory(int(sys.argv[1]))
\ No newline at end of file
diff --git a/plugin.video.wsj/resources/settings.xml
b/plugin.video.wsj/resources/settings.xml
index 3ded40e..2f15f5e 100644
--- a/plugin.video.wsj/resources/settings.xml
+++ b/plugin.video.wsj/resources/settings.xml
@@ -1,2 +1,7 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
+ <category label="30000">
+ <setting id="vid_res" type="enum" label="30010"
lvalues="30020|30021|30022|30023" default="0" />
+ <setting id="thumb_res" type="enum" label="30011"
lvalues="30025|30026|30027" default="0" />
+ </category>
</settings>
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
plugin.video.wsj/README.txt | 13 ++
plugin.video.wsj/addon.xml | 7 +-
plugin.video.wsj/changelog.txt | 10 ++-
plugin.video.wsj/default.py | 150 ++++++++------------
.../resources/language/english/strings.xml | 16 ++
plugin.video.wsj/resources/settings.xml | 5 +
6 files changed, 108 insertions(+), 93 deletions(-)
create mode 100644 plugin.video.wsj/resources/language/english/strings.xml
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons