The branch, dharma has been updated
via 84ddeed7e05d2da1289c142f837913870ac78481 (commit)
via 53381fb5c45a33a6920ec4fca980cffa39cc75fd (commit)
from cf901007a4e7d09a871916a4e37f1313a573c817 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=84ddeed7e05d2da1289c142f837913870ac78481
commit 84ddeed7e05d2da1289c142f837913870ac78481
Author: spiff <[email protected]>
Date: Mon Feb 13 18:28:12 2012 +0100
[plugin.audio.twit] mark as broken/deprecated
diff --git a/plugin.audio.twit/addon.xml b/plugin.audio.twit/addon.xml
index 580f9b2..49fdd24 100644
--- a/plugin.audio.twit/addon.xml
+++ b/plugin.audio.twit/addon.xml
@@ -16,4 +16,5 @@
<description>Podcasts from the TWiT Network</description>
<platform>all</platform>
</extension>
+ <broken>Use the new combined add-on instead</broken>
</addon>
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/plugins;a=commit;h=53381fb5c45a33a6920ec4fca980cffa39cc75fd
commit 53381fb5c45a33a6920ec4fca980cffa39cc75fd
Author: spiff <[email protected]>
Date: Mon Feb 13 18:25:49 2012 +0100
[plugin.video.twit] updated to version 0.1.4
diff --git a/plugin.video.twit/addon.xml b/plugin.video.twit/addon.xml
index 718ca5f..3916303 100644
--- a/plugin.video.twit/addon.xml
+++ b/plugin.video.twit/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.twit"
name="TWiT"
- version="0.1.3"
+ version="0.1.4"
provider-name="divingmule,thanks to Adam B.">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -9,7 +9,7 @@
</requires>
<extension point="xbmc.python.pluginsource"
library="default.py">
- <provides>video</provides>
+ <provides>video audio</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary>TWiT</summary>
diff --git a/plugin.video.twit/changelog.txt b/plugin.video.twit/changelog.txt
index c455219..f672edd 100644
--- a/plugin.video.twit/changelog.txt
+++ b/plugin.video.twit/changelog.txt
@@ -1,3 +1,7 @@
+Version 0.1.4
+fix for site changes
+new playback settings
+
Version 0.1.3
added new shows - Game On, Before You Buy
added new category - Latest Episodes, this scrapes http://twit.tv/node/feed
diff --git a/plugin.video.twit/default.py b/plugin.video.twit/default.py
index 4efb80b..41a11c7 100644
--- a/plugin.video.twit/default.py
+++ b/plugin.video.twit/default.py
@@ -1,10 +1,15 @@
-import urllib,urllib2,re,os
-import xbmcplugin,xbmcgui,xbmcaddon
+import urllib
+import urllib2
+import re
+import os
+import xbmcplugin
+import xbmcgui
+import xbmcaddon
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
__settings__ = xbmcaddon.Addon(id='plugin.video.twit')
__language__ = __settings__.getLocalizedString
-videoq = __settings__.getSetting('video_quality')
+playback = __settings__.getSetting('playback')
home = __settings__.getAddonInfo('path')
fanart = xbmc.translatePath( os.path.join( home, 'fanart.jpg' ) )
@@ -17,7 +22,7 @@ def categories():
addDir(__language__(30003),'http://twit.tv/show/fourcast',1,'http://static.mediafly.com/publisher/images/f7f40bcf20c742cfb55cbccb56c2c68c/icon-600x600.png')
addDir(__language__(30004),'http://twit.tv/show/ipad-today',1,'http://static.mediafly.com/publisher/images/201bc64beb6b4956971650fd1462a704/icon-600x600.png')
addDir(__language__(30005),'http://twit.tv/show/all-about-android',1,'http://static.mediafly.com/publisher/images/7874016b2dd3490fa1e8b606dff4d2fa/icon-600x600.png')
-
addDir(__language__(30006),'http://twit.tv/show/tech-history-today',1,'http://static.mediafly.com/publisher/images/88fcc18ed4234a2e9f96a13f74afe7b9/icon-600x600.png')
+ #
addDir(__language__(30006),'http://twit.tv/show/tech-history-today',1,'http://static.mediafly.com/publisher/images/88fcc18ed4234a2e9f96a13f74afe7b9/icon-600x600.png')
addDir(__language__(30007),'http://twit.tv/show/this-week-in-google',1,'http://static.mediafly.com/publisher/images/8248233e64fc4c68b722be0ec75d637d/icon-600x600.png')
addDir(__language__(30008),'http://twit.tv/show/windows-weekly',1,'http://static.mediafly.com/publisher/images/ad659facf4cb4fe795b595d9b4275daf/icon-600x600.png')
addDir(__language__(30009),'http://twit.tv/show/macbreak-weekly',1,'http://static.mediafly.com/publisher/images/a24b7b336fb14a2ba3f1e31223f622ac/icon-600x600.png')
@@ -57,8 +62,7 @@ def index(url,iconimage):
except:
description = ''
date = i.findPrevious('span').string
- if not url.endswith('.mp3'):
- addLink(name,url,description,date,2,iconimage)
+ addLink(name,url,description,date,2,iconimage)
try:
page = 'http://twit.tv'+soup('li', attrs={'class' :
"pager-next"})[0].a['href']
addDir('Next Page',page,1,iconimage)
@@ -74,20 +78,58 @@ def indexTwitFeed():
link=response.read()
soup = BeautifulStoneSoup(link,
convertEntities=BeautifulStoneSoup.XML_ENTITIES)
for i in soup('item'):
- title = i.title.string
- # url = i.link
- date = i.pubdate.string.rsplit(' ', 1)[0]
- html = i.description.contents[0]
- episode_name = BeautifulSoup(html,
convertEntities=BeautifulSoup.HTML_ENTITIES)('div', attrs={'class' :
"field-item odd"})[0].string.replace(' ','').replace('\n','')
try:
- thumb = re.compile('<img src="(.+?)"').findall(html)[0]
+ title = i.title.string
+ url = i.link
+ date = i.pubdate.string.rsplit(' ', 1)[0]
+ item_str = str(i).replace(' ','').replace('\n','')
except:
- thumb = xbmc.translatePath( os.path.join( home, 'icon.png' ) )
+ continue
+ url_list = []
try:
- vid_url = re.compile('Video URL: </div>\n
(.+?) </div>').findall(html)[0]
- addLink(title+' - '+episode_name, vid_url, '', date, 8, thumb)
+ vid_url_high = re.compile('HD Video
URL: </div>(.+?)</div>').findall(item_str)[0]
except:
- print '--- There was a problem adding episode %s ---' % title
+ vid_url_high = 'no_url'
+ url_list.append(vid_url_high)
+ try:
+ vid_url = re.compile('Video
URL: </div>(.+?)</div>').findall(item_str)[0]
+ except:
+ vid_url = 'no_url'
+ url_list.append(vid_url)
+ try:
+ vid_url_low = re.compile('Video URL
\(mobile\): </div>(.+?)</div></div>').findall(item_str)[0]
+ except:
+ vid_url_low = 'no_url'
+ url_list.append(vid_url_low)
+ try:
+ aud_url = re.compile('MP3 feed
URL: </div>(.+?)</div></div></div>').findall(item_str)[0]
+ except:
+ aud_url = 'no_url'
+ url_list.append(aud_url)
+
+ url = setUrl(url_list, False)
+ if not url == 'no_url':
+ try:
+ episode_name = re.compile('<div class="field-item
odd">(.+?)</div></div>').findall(item_str)[0]
+ if episode_name.startswith('<img'):
+ episode_name = re.compile('<div class="field-item
odd"><p>(.+?)</p><p>').findall(item_str)[0]
+ except:
+ episode_name = ''
+ try:
+ thumb = re.compile('<img src="(.+?)"
alt=').findall(item_str)[0]
+ except:
+ thumb = ''
+ try:
+ desc = re.compile('<div class="field-item
odd"><p>(.+?)</p></div></div>').findall(item_str)[0]
+ pattern = re.compile('<.+?>').findall(desc)
+ for i in pattern:
+ desc = desc.replace(i,'')
+ description = desc.replace('&', '&').replace('"',
'"').replace(''', "'")
+ except:
+ description = ''
+ name = title+' - '+episode_name.replace('&',
'&').replace('"', '"').replace(''', "'")
+ addLink(name, url, description, date, 4, thumb)
+ else: print '--- There was a problem adding episode %s ---' % title
def getVideo(url):
@@ -96,26 +138,57 @@ def getVideo(url):
response = urllib2.urlopen(req)
link=response.read()
soup = BeautifulSoup(link, convertEntities=BeautifulSoup.HTML_ENTITIES)
- link = soup('span', attrs={'class' : "download"})[0]('a')[0]['href']
- setUrl(link)
-
-
-def setUrl(link):
- if videoq == __language__(30027):
- link = link.replace('_h264b_864x480_500','_h264b_864x480_2000')
- elif videoq == __language__(30028):
- link = link.replace('_h264b_864x480_500','_h264b_864x480_1000')
- elif videoq == __language__(30030):
- link = link.replace('_h264b_864x480_500','_h264b_640x368_256')
- item = xbmcgui.ListItem(path=link)
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
+ url_list = ['no_url', 'no_url', 'no_url', 'no_url']
+ for i in soup('span', attrs={'class' : "download"}):
+ name = i.a['class']
+ url = i.a['href']
+ if name == 'audio download':
+ url_list[3] = url
+ if name == 'sd-low download':
+ url_list[2] = url
+ if name == 'sd download':
+ url_list[1] = url
+ if name == 'hd download':
+ url_list[0] = url
+ setUrl(url_list)
+
+
+def setUrl(url_list, set=True):
+ if playback == '3':
+ url = url_list[3]
+ if playback == '2':
+ url = url_list[2]
+ if url == 'no_url':
+ url = url_list[1]
+ if playback == '1':
+ url = url_list[1]
+ if url == 'no_url':
+ url = url_list[2]
+ if playback == '0':
+ url = url_list[0]
+ if url == 'no_url':
+ url = url_list[1]
+ if url == 'no_url':
+ url = url_list[2]
+ if not set:
+ return url
+ else:
+ if url == 'no_url':
+ dialog = xbmcgui.Dialog()
+ ret = dialog.yesno(__language__(30040), __language__(30039))
+ if ret:
+ url = url_list[3]
+ else: return
+ item = xbmcgui.ListItem(path=url)
+ xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
def addLiveLinks():
-
addLink(__language__(30032),'http://bglive-a.bitgravity.com/twit/live/high?noprefix','','',4,xbmc.translatePath(
os.path.join( home, 'resources/live.png' ) ))
-
addLink(__language__(30033),'http://bglive-a.bitgravity.com/twit/live/low?noprefix','','',4,xbmc.translatePath(
os.path.join( home, 'resources/live.png' ) ))
-
addLink(__language__(30034),'http://cgw.ustream.tv/Viewer/getStream/1/1524.amf','','',5,xbmc.translatePath(
os.path.join( home, 'resources/live.png' ) ))
+
addLink(__language__(30032),'http://bglive-a.bitgravity.com/twit/live/high?noprefix','','',4,xbmc.translatePath(
os.path.join( home, 'resources', 'live.png' ) ))
+
addLink(__language__(30033),'http://bglive-a.bitgravity.com/twit/live/low?noprefix','','',4,xbmc.translatePath(
os.path.join( home, 'resources', 'live.png' ) ))
+
addLink(__language__(30034),'http://cgw.ustream.tv/Viewer/getStream/1/1524.amf','','',5,xbmc.translatePath(
os.path.join( home, 'resources', 'live.png' ) ))
addLink(__language__(30035),'URL','','',6,xbmc.translatePath(
os.path.join( home, 'resources/live.png' ) ))
+
addLink(__language__(30041),'http://twit.am/listen','','',4,xbmc.translatePath(
os.path.join( home, 'resources', 'live.png' ) ))
def getUstream(url):
@@ -139,8 +212,7 @@ def getUstream(url):
swf = ' swfUrl='+getSwf()
pageUrl = ' pageUrl=http://live.twit.tv'
url = rtmp + playpath + swf + pageUrl + ' swfVfy=1 live=true'
- item = xbmcgui.ListItem(path=url)
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
+ playLive(url)
def getJtv():
@@ -156,8 +228,7 @@ def getJtv():
Pageurl = ' Pageurl=http://www.justin.tv/twit'
swf = '
swfUrl=http://www.justin.tv/widgets/live_embed_player.swf?channel=twit'
url = rtmp+token+swf+Pageurl
- item = xbmcgui.ListItem(path=url)
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
+ playLive(url)
def playLive(url):
@@ -185,12 +256,12 @@ def get_params():
def addLink(name,url,description,date,mode,iconimage):
try:
- description = description + "\n \n Published: " + date
+ description += "\n \n Published: " + date
except:
description = "Published: " + date
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
ok=True
- liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png",
thumbnailImage=iconimage)
+ liz=xbmcgui.ListItem(name, iconImage=iconimage,
thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title":
name,"Plot":description } )
liz.setProperty( "Fanart_Image", fanart )
liz.setProperty('IsPlayable', 'true')
@@ -201,7 +272,7 @@ def addLink(name,url,description,date,mode,iconimage):
def addDir(name,url,mode,iconimage):
u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)+"&iconimage="+urllib.quote_plus(iconimage)
ok=True
- liz=xbmcgui.ListItem(name, iconImage="DefaultFolder.png",
thumbnailImage=iconimage)
+ liz=xbmcgui.ListItem(name, iconImage=iconimage,
thumbnailImage=iconimage)
liz.setInfo( type="Video", infoLabels={ "Title": name } )
liz.setProperty( "Fanart_Image", fanart )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
diff --git a/plugin.video.twit/resources/language/English/strings.xml
b/plugin.video.twit/resources/language/English/strings.xml
index ec70a35..4c26ebc 100644
--- a/plugin.video.twit/resources/language/English/strings.xml
+++ b/plugin.video.twit/resources/language/English/strings.xml
@@ -27,11 +27,11 @@
<string id='30024'>Ham Nation</string>
<string id='30025'>Futures in Biotech</string>
<string id='30026'>This Week in Radio Tech</string>
- <string id='30027'>864x480 Bitrate 2000</string>
- <string id='30028'>864x480 Bitrate 1000</string>
- <string id='30029'>864x480 Bitrate 500</string>
- <string id='30030'>640x368 Bitrate 256</string>
- <string id='30031'>Video Quality</string>
+ <string id='30027'>Video (HD) 1280x720 Bitrate 2500</string>
+ <string id='30028'>Video (SD) 864x480 Bitrate 500</string>
+ <string id='30029'>Video (low/mobile) 640x368 Bitrate 256</string>
+ <string id='30030'>Audio</string>
+ <string id='30031'>Playback</string>
<string id='30032'>Bitgravity 1 Mbps</string>
<string id='30033'>Bitgravity 400 kbps</string>
<string id='30034'>Ustream 1.5 Mbps</string>
@@ -39,4 +39,7 @@
<string id='30036'>Before You Buy</string>
<string id='30037'>Game On</string>
<string id='30038'>Latest Episodes</string>
-</strings>
+ <string id='30039'>Seems the video is not up yet. Play the audio?</string>
+ <string id='30040'>TWiT</string>
+ <string id='30041'>Audio TWiT.am/listen</string>
+</strings>
\ No newline at end of file
diff --git a/plugin.video.twit/resources/settings.xml
b/plugin.video.twit/resources/settings.xml
index b0d0fc2..a05f3b0 100644
--- a/plugin.video.twit/resources/settings.xml
+++ b/plugin.video.twit/resources/settings.xml
@@ -1,3 +1,3 @@
<settings>
- <setting id="video_quality" type="select" lvalues="30027|30028|30029|30030"
label="30031" default=""/>
+ <setting id="playback" type="enum" lvalues="30027|30028|30029|30030"
label="30031" default="1"/>
</settings>
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes:
plugin.audio.twit/addon.xml | 1 +
plugin.video.twit/addon.xml | 4 +-
plugin.video.twit/changelog.txt | 4 +
plugin.video.twit/default.py | 149 ++++++++++++++-----
.../resources/language/English/strings.xml | 15 ++-
plugin.video.twit/resources/settings.xml | 2 +-
6 files changed, 127 insertions(+), 48 deletions(-)
hooks/post-receive
--
Plugins
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons