The branch, dharma has been updated
via bfdffa3d12d47b898c5fac70e7d54c14c5d171bc (commit)
from 61dafd6f0c57f8f0eff10256ee357713f4e96d2b (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=bfdffa3d12d47b898c5fac70e7d54c14c5d171bc
commit bfdffa3d12d47b898c5fac70e7d54c14c5d171bc
Author: spiff <[email protected]>
Date: Thu Jul 5 15:53:48 2012 +0200
[plugin.video.yahoo.trailershd] updated to version 1.1.0
diff --git a/plugin.video.yahoo.trailershd/addon.xml
b/plugin.video.yahoo.trailershd/addon.xml
index 3f5424c..1f90c19 100644
--- a/plugin.video.yahoo.trailershd/addon.xml
+++ b/plugin.video.yahoo.trailershd/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.yahoo.trailershd"
name="Yahoo Movie Trailers"
- version="1.0.0"
+ version="1.1.0"
provider-name="EbiL">
<requires>
<import addon="xbmc.python" version="1.0"/>
diff --git a/plugin.video.yahoo.trailershd/changelog.txt
b/plugin.video.yahoo.trailershd/changelog.txt
index 6d448e0..3f0273a 100644
--- a/plugin.video.yahoo.trailershd/changelog.txt
+++ b/plugin.video.yahoo.trailershd/changelog.txt
@@ -1,2 +1,4 @@
[B]1.0.0[/B]
Initial Release, r1 conversions to newer xbmc 'Add-ons'
+[B]1.1.0[/B]
+Subsubquent Release to conform to Yahoo's new Trailer page
diff --git a/plugin.video.yahoo.trailershd/default.py
b/plugin.video.yahoo.trailershd/default.py
old mode 100644
new mode 100755
index 9919ad2..1ddc73e
--- a/plugin.video.yahoo.trailershd/default.py
+++ b/plugin.video.yahoo.trailershd/default.py
@@ -1,63 +1,142 @@
import xbmc, xbmcgui, xbmcplugin, urllib2, urllib, re, string, sys, os,
traceback, time, pickle, xbmcaddon
+import threading
__plugin__ = 'Yahoo Movie Trailers (HD)'
__author__ = 'EbiL <[email protected]>'
-__url__ = 'git://github.com/rmrfworld/Yahoo-Movie-Trailers--HD-.git'
-__date__ = '20 Apr 2011'
-__version__ = '1.0.0'
+__url__ = 'git://github.com/rmrfworld/plugin.video.yahoo.trailershd.git'
+__date__ = '3 Jul 2012'
+__version__ = '1.1.0'
__settings__ = xbmcaddon.Addon(id='plugin.video.yahoo.trailershd')
if not os.path.exists(__settings__.getAddonInfo('profile')):
os.makedirs(__settings__.getAddonInfo('profile'))
+responses=[]
+vresponses=[]
+class MyHandler(urllib2.HTTPHandler):
+ def http_response(self, req, response):
+ blah=""
+ global responses
+ blah=response.read()
+ responses.append(blah)
+ return response
+
+class VMyHandler(urllib2.HTTPHandler):
+ def http_response(self, req, response):
+ blah=""
+ global vresponses
+ blah=response.read()
+ vresponses.append(blah)
+ return response
+
def load():
-#download new trailer links
- url = "http://movies.yahoo.com/feature/hdtrailers.html"
+#download top of box office links (tbo)
+ url = "http://movies.yahoo.com/box-office/"
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
- match=re.compile('(?s)<dt class="a-m-t">(.+?) - (.+?)</dt>\n<dd
class="a-m-d">\n<div class="bd">\n<div class="smallThumb">\n<div
class="shadow">\n<a href=".+?"><img src="(.+?)" border="0" align="left"
/></a>\n</div>\n</div>\n<div>\n(.+?)\n<br /><br />\n.+?<br />\n(.+?)<br
/>\n(.+?)<br />\n.+?<br />\n<br /><br />\n<div class="trailer-wrapper">\n<div
class="clip1">.+?\n<ul class="hd-btn-wrapper-small">\n<li><a
class="hd-nav-button" href="(.+?)"></a>').findall(link)
+ tbo=re.compile('<td class="rank">.+?</td><td
class="rankpast">.+?</td><td class="movie-image"><a href=.+? style=".+?"
class="lzbg"></a></td><td class="title"><div><a href="(.+?)"
>(.+?)</a></div>').findall(link)
-#download old trailer links
- url = "http://movies.yahoo.com/feature/hdtrailers_archive.html"
+#download opening this weekend (otw)
+ url = "http://movies.yahoo.com/in-theaters/"
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
- match1=re.compile('<dt class="a-m-t">(.+?) - (.+?)</dt>\n<dd
class="a-m-d">\n<div class="bd">\n<div class="smallThumb">\n<div
class="shadow">\n<a href=".+?"><img src="(.+?)" border="0" align="left"
/></a>\n</div>\n</div>\n<div>\n(.+?)\n<br /><br />\n.+?<br />\n(.+?)<br
/>\n(.+?)<br />\n.+?<br />\n<br /><br />\n<div class="trailer-wrapper">\n<div
class="clip1">.+?\n<ul class="hd-btn-wrapper-small">\n<li><a
class="hd-nav-button" href="(.+?)"></a>').findall(link)
+ otw=re.compile('<div class="info"><a href="(.+?)"
class="title">(.+?)</span></a><em class="movie-info">').findall(link)
-#download coming soon (cs), opening this week (otw), top at the box office
(tbo) info
- url = "http://movies.yahoo.com"
+#download coming soon (cs)
+ url = "http://movies.yahoo.com/coming-soon/"
req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
- response.close()
+ response.close()
+ match=re.compile('<div class="info"><a href="(.+?)"
class="title">(.+?)</span></a><em class="movie-info">').findall(link)
+ match1=re.compile('<div class="yom-mod yom-top-list yom-top-list-movie
yom-top-list-dotted"><div class="hd"><h3>Further Out</h3></div><div
class="bd"><ul><li class="first show-image"><div
class="media-item">(.+?)</div></li></ul></div></div>').findall(link)
+ cs1=re.compile('<div class="item-title"><a href="(.+?)"
>(.+?)</a></div><em class="item-detail">').findall(match1[0])
+ cs = match + cs1
#cacheing info for multiple use
- tbo=re.compile('<li.+?id="tbo_.+?"><a
href="(.+?)"><strong>.+?</strong><span><b>(.+?)</b></span></a></li>').findall(link)
f = open(os.path.join( __settings__.getAddonInfo('profile'),
"tbo"),'wb')
pickle.dump(tbo, f)
f.close()
- otw=re.compile('<li.+?id="otw_.+?"><a
href="(.+?)"><span>•</span><b>(.+?)</b></a></li>').findall(link)
f = open(os.path.join( __settings__.getAddonInfo('profile'),
"otw"),'wb')
pickle.dump(otw, f)
f.close()
- cs=re.compile('<li.+?id="cs_.+?"><a
href="(.+?)"><span>•</span><b>(.+?)</b></a></li>').findall(link)
f = open(os.path.join( __settings__.getAddonInfo('profile'), "cs"),'wb')
pickle.dump(cs, f)
f.close()
- allmovies = match + match1
- f = open(os.path.join( __settings__.getAddonInfo('profile'),
"allmovies"),'wb')
- pickle.dump(allmovies, f)
- f.close()
+
+def getDetails(link):
+ ithumb=re.compile('<div class="yom-mod yom-ent-image"><div
class="bd"><div class="yom-ent-image-frm" style=".+?"><img src="(.+?)"
alt=".+?">').findall(link)
+ iplot=re.compile('<h3>Synopsis</h3></div>.+?<div
class=.+?>(.+?)</div>').findall(link)
+ ititle=re.compile('<h1 property="name">(.+?)<span
class="year">.+?</span></h1>').findall(link)
+ if len(ititle)<1:
+ iinfo = ['None','','']
+ else:
+ iinfo = ititle[0], iplot[0], ithumb[0]
+ return iinfo
+
+def getVDetails(vlink):
+ ititle=re.compile('<h1 property="name">(.+?)<span
class="year">.+?</span></h1>').findall(vlink)
+ ivid=re.compile('<param name="flashVars"
value="vid=(.+?)&locale="></param>').findall(vlink)
+ if len(ititle)<1:
+ vvid = ['None','']
+ elif len(ivid)<1:
+ vvid = ['None','']
+ else:
+ vvid = ititle[0], ivid[0]
+ return vvid
+
+def addTitles(tbo):
+ for url,name in tbo:
+ o = urllib2.build_opener(MyHandler())
+ iurl = "http://movies.yahoo.com" + url + "/"
+ t = threading.Thread(target=o.open, args=(iurl,))
+ t.start()
+ vo = urllib2.build_opener(VMyHandler())
+ vurl = "http://movies.yahoo.com" + url + "/trailers/"
+ vt = threading.Thread(target=vo.open, args=(vurl,))
+ vt.start()
+ pDialog = xbmcgui.DialogProgress()
+ ret = pDialog.create('Yahoo Movie Trailers', 'Getting Trailers...')
+ while (threading.activeCount()>1):
+ f =
(float(len(tbo)*2)-float(threading.activeCount()-1))/float(len(tbo)*2)
+ f = int(f*100)
+ pDialog.update(f)
+ pDialog.close()
+ iinfo=[]
+ for link in responses:
+ if (link!=''):
+ blah = getDetails(link)
+ iinfo.append(blah)
+ vinfo=[]
+ for vlink in vresponses:
+ if (vlink!=''):
+ blah = getVDetails(vlink)
+ vinfo.append(blah)
+ finfo=[]
+ for title,p,t in iinfo:
+ for vtitle,vid in vinfo:
+ if(title!='None'):
+ if(vtitle==title):
+ blah=title,p,t,vid
+ finfo.append(blah)
+ for title,plot,thumb,vid in finfo:
+ li=xbmcgui.ListItem(title, iconImage=thumb,
thumbnailImage=thumb)
+ li.setInfo( type="Video", infoLabels={ "Title": title,
"Plot": plot } ) # "Genre": genre, "Premiered": rdate, "Mpaa": mpaa } )
+ li.setProperty('IsPlayable', 'true')
+
u=sys.argv[0]+"?mode=2&name="+urllib.quote_plus(title)+"&url="+urllib.quote_plus(vid)
+ li.addContextMenuItems([('Theater Showtimes',
'XBMC.RunPlugin('+sys.argv[0]+'?mode=3&name='+urllib.quote_plus(title)+')',)])
+ xbmcplugin.addDirectoryItem(int(sys.argv[1]),u,li,False)
def catlist():
#categories...
tb = os.path.join( __settings__.getAddonInfo('path'), "icon.png")
- opts = ["Top Box Office","Opening This Week","Coming Soon","All"]
+ opts = ["Top Box Office","Opening This Week","Coming Soon"]
for name in opts:
li=xbmcgui.ListItem(name, iconImage=tb, thumbnailImage=tb)
u=sys.argv[0]+"?mode=1&name="+urllib.quote_plus("".join(re.findall('[A-Z]',name)))
@@ -65,108 +144,22 @@ def catlist():
def seclist(name):
#fill selection list with titles depending on what category was chosen
- f = open(os.path.join( __settings__.getAddonInfo('profile'),
"allmovies"),'rb')
- allmovies = pickle.load(f)
- f.close()
if name=='TBO':
f = open(os.path.join( __settings__.getAddonInfo('profile'),
"tbo"),'rb')
tbo = pickle.load(f)
f.close()
- for date,title,thumb,plot,genre,release,vurl in allmovies:
- fdate = re.sub('/','.',date)
- year = '20' + fdate[-2:]
- fdate = fdate[:6] + year
- temp = re.compile('(.+?) ([1-9]{1,2}).+?, (.+?)
.+?').findall(release)
- if (len(temp)<1):
- rdate=""
- else:
- try:
- temp = time.strptime(temp[0][0][:3]+'
'+temp[0][1]+' '+temp[0][2], "%b %d %Y")
- rdate = time.strftime("%Y-%m-%d", temp)
- year = time.strftime("%Y", temp)
- except ValueError:
- rdate=""
- for infolink, t in tbo:
- if (title==t): #matching allmovie titles with
tbo titles
- li=xbmcgui.ListItem(title,
iconImage=thumb, thumbnailImage=thumb)
- li.setInfo( type="Video", infoLabels={
"date": fdate, "Title": title, "plot": plot, "genre": genre, "year": int(year),
"premiered": rdate } )
- li.setProperty('IsPlayable', 'true')
-
u=sys.argv[0]+"?mode=2&name="+urllib.quote_plus(title)+"&url="+urllib.quote_plus(vurl)
- li.addContextMenuItems([('Theater
Showtimes',
'XBMC.RunPlugin('+sys.argv[0]+'?mode=3&name='+urllib.quote_plus(title)+')',)])
-
xbmcplugin.addDirectoryItem(int(sys.argv[1]),u,li,False)
+ addTitles(tbo)
elif name=='OTW':
f = open(os.path.join( __settings__.getAddonInfo('profile'),
"otw"),'rb')
otw = pickle.load(f)
f.close()
- for date,title,thumb,plot,genre,release,vurl in allmovies:
- fdate = re.sub('/','.',date)
- year = '20' + fdate[-2:]
- fdate = fdate[:6] + year
- temp = re.compile('(.+?) ([1-9]{1,2}).+?, (.+?)
.+?').findall(release)
- if (len(temp)<1):
- rdate=""
- else:
- try:
- temp = time.strptime(temp[0][0][:3]+'
'+temp[0][1]+' '+temp[0][2], "%b %d %Y")
- rdate = time.strftime("%Y-%m-%d", temp)
- year = time.strftime("%Y", temp)
- except ValueError:
- rdate=""
- for infolink, t in otw:
- if (title==t): #matching allmovie titles with
otw titles
- li=xbmcgui.ListItem(title,
iconImage=thumb, thumbnailImage=thumb)
- li.setInfo( type="Video", infoLabels={
"date": fdate, "Title": title, "plot": plot, "genre": genre, "year": int(year),
"premiered": rdate } )
- li.setProperty('IsPlayable', 'true')
-
u=sys.argv[0]+"?mode=2&name="+urllib.quote_plus(title)+"&url="+urllib.quote_plus(vurl)
- li.addContextMenuItems([('Theater
Showtimes',
'XBMC.RunPlugin('+sys.argv[0]+'?mode=3&name='+urllib.quote_plus(title)+')',)])
-
xbmcplugin.addDirectoryItem(int(sys.argv[1]),u,li,False)
+ addTitles(otw)
elif name=='CS':
f = open(os.path.join( __settings__.getAddonInfo('profile'),
"cs"),'rb')
cs = pickle.load(f)
f.close()
- for date,title,thumb,plot,genre,release,vurl in allmovies:
- fdate = re.sub('/','.',date)
- year = '20' + fdate[-2:]
- fdate = fdate[:6] + year
- temp = re.compile('(.+?) ([1-9]{1,2}).+?, (.+?)
.+?').findall(release)
- if (len(temp)<1):
- rdate=""
- else:
- try:
- temp = time.strptime(temp[0][0][:3]+'
'+temp[0][1]+' '+temp[0][2], "%b %d %Y")
- rdate = time.strftime("%Y-%m-%d", temp)
- year = time.strftime("%Y", temp)
- except ValueError:
- rdate=""
- for infolink, t in cs:
- if (title==t): #matching allmovie titles with
cs titles
- li=xbmcgui.ListItem(title,
iconImage=thumb, thumbnailImage=thumb)
- li.setInfo( type="Video", infoLabels={
"date": fdate, "Title": title, "plot": plot, "genre": genre, "year": int(year),
"premiered": rdate } )
- li.setProperty('IsPlayable', 'true')
-
u=sys.argv[0]+"?mode=2&name="+urllib.quote_plus(title)+"&url="+urllib.quote_plus(vurl)
- li.addContextMenuItems([('Theater
Showtimes',
'XBMC.RunPlugin('+sys.argv[0]+'?mode=3&name='+urllib.quote_plus(title)+')',)])
-
xbmcplugin.addDirectoryItem(int(sys.argv[1]),u,li,False,len(cs))
- elif name=='A':
- for date,title,thumb,plot,genre,release,vurl in allmovies:
- fdate = re.sub('/','.',date)
- year = '20' + fdate[-2:]
- fdate = fdate[:6] + year
- temp = re.compile('(.+?) ([1-9]{1,2}).+?, (.+?)
.+?').findall(release)
- if (len(temp)<1):
- rdate=""
- else:
- try:
- temp = time.strptime(temp[0][0][:3]+'
'+temp[0][1]+' '+temp[0][2], "%b %d %Y")
- rdate = time.strftime("%Y-%m-%d", temp)
- year = time.strftime("%Y", temp)
- except ValueError:
- rdate=""
- li=xbmcgui.ListItem(title, iconImage=thumb,
thumbnailImage=thumb)
- li.setInfo( type="Video", infoLabels={ "date": fdate,
"Title": title, "plot": plot, "genre": genre, "year": int(year), "premiered":
rdate } )
- li.setProperty('IsPlayable', 'true')
-
u=sys.argv[0]+"?mode=2&name="+urllib.quote_plus(title)+"&url="+urllib.quote_plus(vurl)
-
xbmcplugin.addDirectoryItem(int(sys.argv[1]),u,li,False,len(allmovies))
-
+ addTitles(cs)
+
def showtimes(name):
#thanks for the showtimes google
res = __settings__.getSetting('zip')
@@ -196,7 +189,7 @@ def showtimes(name):
else:
ret = dialog.select(name, theater)
dialog = xbmcgui.Dialog()
- back = dialog.yesno(theater[ret], name, "",
times[ret].replace(' ',''), 'Done', 'Back');
+ back = dialog.yesno(theater[ret], name, "",
times[ret].replace(' ',''), 'Done', 'Back');
def resolveLink(url,name):
li=xbmcgui.ListItem(name, path = url)
@@ -205,16 +198,27 @@ def resolveLink(url,name):
return True
def playVideo(url, name):
+
res = __settings__.getSetting('res')
- test=re.sub('480',res,url) #replace default setting with user chosen
resolution
- req = urllib2.Request(test)
+ if (res=='720_2Mbps'):
+ rez = "2000"
+ elif (res=='720_3Mbps'):
+ rez = "3008"
+ elif (res=='1080'):
+ rez = "4000"
+ else:
+ rez = "1504"
+ #link = re.sub('480',res,url) #replace default setting with user chosen
resolution
+ url = "http://cosmos.bcst.yahoo.com/rest/v2/pops;element=stream;bw=" +
rez + ";tech=mp4;id=" + url
+ req = urllib2.Request(url)
req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
req.add_header('Referer', 'http://movies.yahoo.com/')
response = urllib2.urlopen(req)
link=response.read()
response.close()
- videourl=re.compile('<\?xml version="1.0"\?><\?quicktime
type="application/x-quicktime-media-link"\?><embed src="(.+?)" autoplay="false"
type="video/quicktime" controller="true" quitwhendone="false" cache="false"
loop="false" name="test file"></embed>').findall(link)
- resolveLink(videourl[0],name)
+ sid=re.compile('sid=\'(.+?)\'').findall(link)
+ vurl = "http://playlist.yahoo.com/makeplaylist.dll?sdm=web&pt=rd&sid="
+ sid[0]
+ resolveLink(vurl,name)
xbmc.sleep(200)
def get_params():
diff --git a/plugin.video.yahoo.trailershd/resources/settings.xml
b/plugin.video.yahoo.trailershd/resources/settings.xml
old mode 100644
new mode 100755
index 385641c..ac13abb
--- a/plugin.video.yahoo.trailershd/resources/settings.xml
+++ b/plugin.video.yahoo.trailershd/resources/settings.xml
@@ -1,4 +1,4 @@
<settings>
- <setting id="res" type="labelenum" label="30000" values="720|1080|480"
default="720"/>
+ <setting id="res" type="labelenum" label="30000"
values="720_3Mbps|720_2Mbps|1080|480" default="720_2Mbps"/>
<setting id="zip" type="text" label="30001" default="90210" />
</settings>
-----------------------------------------------------------------------
Summary of changes:
plugin.video.yahoo.trailershd/addon.xml | 2 +-
plugin.video.yahoo.trailershd/changelog.txt | 2 +
plugin.video.yahoo.trailershd/default.py | 234 ++++++++++----------
.../resources/settings.xml | 2 +-
4 files changed, 123 insertions(+), 117 deletions(-)
mode change 100644 => 100755 plugin.video.yahoo.trailershd/default.py
mode change 100644 => 100755
plugin.video.yahoo.trailershd/resources/settings.xml
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons