The branch, dharma-pre has been updated
via 7cfb931764106c5be722e3825966da3bf85483b5 (commit)
via 4dfea2b5833dca4089897af7d3a4c3d0e4d3360b (commit)
via 8cc1a9497cfd57a878b2239350d6da242a919bc7 (commit)
from bba45e1e7229e2c96d96ebda4f4f1d26e6f14b73 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=7cfb931764106c5be722e3825966da3bf85483b5
commit 7cfb931764106c5be722e3825966da3bf85483b5
Author: amet <a...@nospam>
Date: Wed Oct 20 01:42:21 2010 +0400
[script.tvrage.com] -v 1.0.0
diff --git a/script.tvrage.com/addon.xml b/script.tvrage.com/addon.xml
index 766d865..b08f0a2 100644
--- a/script.tvrage.com/addon.xml
+++ b/script.tvrage.com/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.tvrage.com"
name="TVRage-Eps"
- version="0.9.5"
+ version="1.0.0"
provider-name="Rick Phillips (ruuk)">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -9,7 +9,9 @@
<import addon="script.module.simplejson" version="2.0.9"/>
</requires>
<extension point="xbmc.python.script"
- library="default.py" />
+ library="default.py">
+ <provides>video executable</provides>
+ </extension>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<summary lang="en">Quickly see which of your favorite shows are on next,
and browse episode lists.</summary>
diff --git a/script.tvrage.com/changelog.txt b/script.tvrage.com/changelog.txt
index 8e1f812..7f3f0d8 100644
--- a/script.tvrage.com/changelog.txt
+++ b/script.tvrage.com/changelog.txt
@@ -1,6 +1,49 @@
TVRage-Eps Changelog
-Current Version : 0.9.5
+Current Version : 1.0.0
+
+*** 1.0.0 ***
+
+Fixed bug: Time was showing incorrectly when offset was changed
+Added 'Loading episodes...' message when loading episodes dialog
+
+*** 0.9.91 ***
+
+Fixed bug: failing on bad xml (ie & when should be &) when getting show
data
+Fixed bug: adding single show had blank title in "Add XBMC name: " - changed
to "Add as (Empty): "
+
+*** 0.9.9 ***
+
+Added ability to add show not found on TVRage.com (As a dummy listing), mainly
to keep library scan from asking every time
+'Add All From Library' now lists unmatched shows at the end with the option to
skip all or choose shows to add
+Added 'Refresh' option to list options
+
+*** 0.9.8 ***
+
+Fixed bug in a debugging print statement crashing on unicode
+Added summary dialog after adding all from library
+Pressing play on episode plays episode (list and summary)
+
+*** 0.9.7 ***
+
+Fixed a bug with fetching images on some shows causing an error
+Fixed: Was adding canceled shows if chosen from list on 'Add all from library'
+Added provides video & executable to addon.xml
+Added < Skip > option when prompting for choice
+Fixed a search bug causing errors on special characters
+Made setting 'Prompt if match not found' actually do something :)
+Added cancel option on show options
+Revamped interface
+ +Added 'Add All From Library Button'
+ -Removed 'Add All From Library' from show options lists
+ -Removed 'Add/Search' from show options lists
+ +Added 'Settings' button
+ +Larger show images
+
+*** 0.9.6 ***
+
+Fixed remote/keyboard click on 'Add Show' button bringing up the episode list
+No longer needs to use HTTP for accessing library (but still can as an option
if, for example, you want to pull data from another computer)
*** 0.9.5 ***
diff --git a/script.tvrage.com/default.py b/script.tvrage.com/default.py
index 201edaa..f5170eb 100644
--- a/script.tvrage.com/default.py
+++ b/script.tvrage.com/default.py
@@ -7,11 +7,13 @@ import difflib
__author__ = 'ruuk'
__url__ = 'http://code.google.com/p/tvragexbmc/'
-__date__ = '10-07-2010'
-__version__ = '0.9.5'
+__date__ = '10-19-2010'
+__version__ = '1.0.0'
__settings__ = xbmcaddon.Addon(id='script.tvrage.com')
__language__ = __settings__.getLocalizedString
+#for k in xbmc.__dict__.keys(): print k
+
BASE_RESOURCE_PATH = xbmc.translatePath( os.path.join( os.getcwd(),
'resources') )
sys.path.append (BASE_RESOURCE_PATH)
@@ -34,28 +36,38 @@ ACTION_PAUSE = 12
ACTION_STOP = 13
ACTION_NEXT_ITEM = 14
ACTION_PREV_ITEM = 15
+ACTION_SHOW_GUI = 18
+ACTION_PLAYER_PLAY = 79
ACTION_MOUSE_LEFT_CLICK = 100
ACTION_CONTEXT_MENU = 117
+def LOG(msg):
+ xbmc.log(msg.encode('ascii','replace'))
+
class Show:
- def __init__(self,showid='',xmltree=None,offset=0):
- self.offset = offset
+ def __init__(self,showid='',xmltree=None,name=''):
self.showid = showid
- self.name = ''
- self.airtime = ''
+ self.name = name
+ self._airtime = ''
self.next = {}
self.last = {}
self.imagefile = os.path.join(THUMB_PATH,self.showid + '.jpg')
self.nextUnix = 0
self.status = ''
self.canceled = ''
- self.lastEp = {'number':'?','title':'Unknown','date':'?'}
- self.nextEp = {'number':'?','title':'Unknown','date':'?'}
+ self.lastEp = {'number':'?','title':'Unknown','date':''}
+ self.nextEp = {'number':'?','title':'Unknown','date':''}
+ if self.isDummy():
+ self.tree = etree.fromstring('<show
id="0"><name>'+name+'</name></show>')
if xmltree:
self.tree = xmltree
self.processTree(xmltree)
+ def isDummy(self):
+ return self.showid == '0'
+
def getShowData(self):
+ if self.isDummy(): return
tree = API.getShowInfo(self.showid)
self.processTree(tree)
return self
@@ -68,11 +80,12 @@ class Show:
self.tree = show
self.imagefile = os.path.join(THUMB_PATH,self.showid + '.jpg')
self.name = show.find('name').text
+ if self.isDummy(): return
- try: self.airtime =
re.findall('\d+:\d\d\s\w\w',show.find('airtime').text)[0]
+ try: self._airtime =
re.findall('\d+:\d\d\s\w\w',show.find('airtime').text)[0]
except: pass
- if not self.airtime:
- try: self.airtime =
show.find('airtime').text.rsplit('at ',1)[-1]
+ if not self._airtime:
+ try: self._airtime =
show.find('airtime').text.rsplit('at ',1)[-1]
except: pass
self.status = show.find('status').text
@@ -94,15 +107,15 @@ class Show:
if next: self.nextEp = self.epInfo(next)
if not os.path.exists(self.imagefile):
- iurl =
'http://images.tvrage.com/shows/'+str(int(self.showid[0:-3]) +
1)+'/'+self.showid + '.jpg'
+ try:
+ iurl =
'http://images.tvrage.com/shows/'+str(int(self.showid[0:-3]) +
1)+'/'+self.showid + '.jpg'
+ except:
+ print "IMAGE ERROR - SHOWID: " + self.showid
+ return
saveURLToFile(iurl,self.imagefile)
-
- if self.offset: self.getOffsetAirtime()
-
- def getOffsetAirtime(self):
- self.getNextUnix(forceupdate=True)
- self.nextUnix += (self.offset * 3600)
- self.airtime = time.strftime('%I:%M
%p',time.localtime(self.nextUnix))
+
+ def airtime(self,offset=0):
+ return time.strftime('%I:%M
%p',time.localtime(self.getNextUnix(offset=offset)))
def epInfo(self,eptree):
try: return
{'number':eptree.find('number').text,'title':eptree.find('title').text,'date':eptree.find('airdate').text}
@@ -112,16 +125,17 @@ class Show:
srt = self.getNextUnix(forceupdate=True)
return str(srt) + '@' + self.name
- def getNextUnix(self,forceupdate=False):
+ def getNextUnix(self,forceupdate=False,offset=0):
if forceupdate or not self.nextUnix:
try:
- struct = time.strptime(self.nextEp['date'] + '
' + self.airtime,'%Y-%m-%d %I:%M %p')
+ struct = time.strptime(self.nextEp['date'] + '
' + self._airtime,'%Y-%m-%d %I:%M %p')
srt = time.mktime(struct)
except:
srt = time.time()+60*60*24*365*10
if self.canceled: srt += 3600
+ elif self.isDummy(): srt += 3601
self.nextUnix = srt
- return self.nextUnix
+ return self.nextUnix + (offset * 3600)
def xml(self):
return etree.tostring(self.tree)
@@ -186,7 +200,10 @@ class TVRageAPI:
return self.getTree(url)
def search(self,show):
- url = self._search_url + urllib.quote_plus(show)
+ try:
+ url = self._search_url +
urllib.quote_plus(show.encode('utf-8'))
+ except:
+ url = self._search_url + show.replace(' ','_')
return self.getTree(url)
def getEpList(self,showid):
@@ -195,7 +212,12 @@ class TVRageAPI:
def getTree(self,url):
xml = self.getURLData(url,readlines=False)
- return etree.fromstring(xml)
+ xml = re.sub('&(?!amp;)','&',xml)
+ try:
+ return etree.fromstring(xml)
+ except:
+ LOG('TVRage-Eps: BAD XML data')
+ return None
def getEpSummary(self,url):
html = self.getURLData(url,readlines=False)
@@ -220,6 +242,7 @@ class SummaryDialog(xbmcgui.WindowXMLDialog):
def __init__( self, *args, **kwargs ):
xbmcgui.WindowXMLDialog.__init__( self, *args, **kwargs )
self.link = kwargs.get('link','')
+ self.parent = kwargs.get('parent',None)
def onInit(self):
self.getControl(120).setText(__language__(30025))
@@ -236,8 +259,14 @@ class SummaryDialog(xbmcgui.WindowXMLDialog):
def onAction(self,action):
if action == ACTION_PARENT_DIR:
action = ACTION_PREVIOUS_MENU
+ elif action == ACTION_PLAYER_PLAY:
+ self.playEpisode()
xbmcgui.WindowXMLDialog.onAction(self,action)
+ def playEpisode(self):
+ self.parent.playEpisode()
+ self.close()
+
def htmlToText(self,html):
html = re.sub('<.*?>','',html)
return html .replace("<", "<")\
@@ -250,6 +279,8 @@ class EpListDialog(xbmcgui.WindowXMLDialog):
def __init__( self, *args, **kwargs ):
xbmcgui.WindowXMLDialog.__init__( self, *args, **kwargs )
self.sid = kwargs.get('sid','')
+ self.showname = kwargs.get('showname','')
+ self.parent = kwargs.get('parent',None)
self.imagefile = os.path.join(THUMB_PATH,self.sid + '.jpg')
def onInit(self):
@@ -269,16 +300,32 @@ class EpListDialog(xbmcgui.WindowXMLDialog):
self.summary()
elif action == ACTION_MOUSE_LEFT_CLICK:
if self.getFocusId() == 120: self.summary()
+ elif action == ACTION_PLAYER_PLAY:
+ self.playEpisode()
+ #else:
+ # print 'ACTION: ' + str(action.getId())
xbmcgui.WindowXMLDialog.onAction(self,action)
def summary(self):
item = self.getControl(120).getSelectedItem()
link = item.getProperty('link')
- w = SummaryDialog("script-tvrage-summary.xml" , os.getcwd(),
"Default",link=link)
+ w = SummaryDialog("script-tvrage-summary.xml" , os.getcwd(),
"Default",link=link,parent=self)
w.doModal()
del w
+ def playEpisode(self):
+ item = self.getControl(120).getSelectedItem()
+ season = item.getProperty('season')
+ eptitle = item.getLabel2()
+ efile = self.parent.findXBMCEpFile(self.showname,season,eptitle)
+ if not efile:
+
xbmcgui.Dialog().ok(__language__(30046),__language__(30047))
+ return
+ xbmc.Player().play(efile)
+ self.close()
+
def showEpList(self,sid):
+ self.getControl(100).setLabel(__language__(30055))
result = API.getEpList(sid)
show = result.find('name').text
self.getControl(100).setLabel(show)
@@ -294,32 +341,39 @@ class EpListDialog(xbmcgui.WindowXMLDialog):
item =
xbmcgui.ListItem(label=ep.getEPxSEASON(),label2=ep.title,iconImage=iurls[1],thumbnailImage=iurls[0])
item.setProperty('date',ep.airdate)
item.setProperty('link',ep.link)
+ item.setProperty('season',ep.season)
self.getControl(120).addItem(item)
xbmcgui.unlock()
-class TVRageEps(xbmcgui.WindowXMLDialog):
+class TVRageEps(xbmcgui.WindowXML):
def __init__( self, *args, **kwargs ):
- xbmcgui.WindowXMLDialog.__init__( self, *args, **kwargs )
+ xbmcgui.WindowXML.__init__( self, *args, **kwargs )
def onInit(self):
self.lastUpdateFile =
xbmc.translatePath('special://profile/addon_data/script.tvrage.com/last')
self.dataFile =
xbmc.translatePath('special://profile/addon_data/script.tvrage.com/data')
+ self.loadSettings()
+
+ self.shows = []
+ self.loadData()
+ self.update(force=self.isStale())
+
+ self.setFocus(self.getControl(120))
+
+ def loadSettings(self):
hours = __settings__.getSetting('hours_between_updates')
+ self.json_use_http = (__settings__.getSetting('json_use_http')
== 'true')
+ self.http_address = __settings__.getSetting('xbmc_http_address')
self.http_user = __settings__.getSetting('xbmc_http_user')
self.http_pass = __settings__.getSetting('xbmc_http_pass')
air_offset = __settings__.getSetting('air_offset')
self.skip_canceled = (__settings__.getSetting('skip_canceled')
== 'true')
self.reverse_sort = (__settings__.getSetting('reverse_sort') ==
'true')
self.jump_to_bottom =
(__settings__.getSetting('jump_to_bottom') == 'true')
+ self.ask_on_no_match =
(__settings__.getSetting('ask_on_no_match') == 'true')
self.hours = [1,2,3,4,5,6,12,24][int(hours)]
self.air_offset =
[-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12][int(air_offset)]
- self.shows = []
- self.loadData()
- self.update(force=self.isStale())
-
- self.setFocus(self.getControl(120))
-
def isStale(self):
last = self.fileRead(self.lastUpdateFile)
if not last: return True
@@ -353,33 +407,57 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
self.saveData()
pdialog.close()
- def doAddShow(self,sid,skipCanceled=False):
+ def doAddShow(self,sid,skipCanceled=False,name=''):
+ if sid == '0':
+ self.shows.append(Show(showid=sid,name=name))
+ return 1
show = Show(showid=sid,offset=self.air_offset).getShowData()
- if skipCanceled and show.canceled: return
+ if skipCanceled and show.canceled: return 0
self.shows.append(show)
+ return 1
def onAction(self,action):
#print "ACTION: " + str(action.getId()) + " FOCUS: " +
str(self.getFocusId()) + " BC: " + str(action.getButtonCode())
if action == ACTION_CONTEXT_MENU:
self.doMenu()
elif action == ACTION_SELECT_ITEM:
- self.eplist()
+ if self.getFocusId() == 200:
+ self.search()
+ elif self.getFocusId() == 201:
+ self.addFromLibrary()
+ elif self.getFocusId() == 202:
+ self.openSettings()
+ else:
+ self.eplist()
elif action == ACTION_PARENT_DIR:
action = ACTION_PREVIOUS_MENU
elif action == ACTION_MOUSE_LEFT_CLICK:
if self.getFocusId() == 200:
self.search()
+ elif self.getFocusId() == 201:
+ self.addFromLibrary()
+ elif self.getFocusId() == 202:
+ self.openSettings()
elif self.getFocusId() == 120:
self.eplist()
xbmcgui.WindowXMLDialog.onAction(self,action)
+ def openSettings(self):
+ rs = self.reverse_sort
+ ao = self.air_offset
+ __settings__.openSettings()
+ self.loadSettings()
+ if rs != self.reverse_sort or ao != self.air_offset:
self.updateDisplay()
+
def doMenu(self):
dialog = xbmcgui.Dialog()
- idx =
dialog.select(__language__(30011),[__language__(30007),__language__(30026),__language__(30013),__language__(30006)])
- if idx == 0: self.search()
- elif idx == 1: self.addFromLibrary()
- elif idx == 2: self.reverse()
- elif idx == 3: self.deleteShow()
+ #idx =
dialog.select(__language__(30011),[__language__(30007),__language__(30026),__language__(30013),__language__(30006)])
+ idx =
dialog.select(__language__(30011),[__language__(30013),__language__(30054),__language__(30006),__language__(30041)])
+ #if idx == 0: self.search()
+ #elif idx == 1: self.addFromLibrary()
+ if idx == 0: self.reverse()
+ elif idx == 1: self.update(force=True)
+ elif idx == 2: self.deleteShow()
def search(self):
keyboard = xbmc.Keyboard('',__language__(30005))
@@ -391,14 +469,14 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
pdialog.update(0)
result = API.search(term)
pdialog.close()
- sid = self.userPickShow(result)
+ sid = self.userPickShow(result,append=term)
if not sid: return
self.addShow(sid)
self.updateDisplay()
def userPickShow(self,result,append=''):
- slist = []
- sids = []
+ slist = ['< %s >' %
(__language__(30040)),__language__(30048).replace('@REPLACE@',append)]
+ sids = [None,'0']
for s in result.findall('show'):
slist.append(s.find('name').text)
sids.append(s.find('showid').text)
@@ -413,7 +491,10 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
pdialog.create(__language__(30027))
try:
pdialog.update(0)
- jrapi =
jsonrpc.jsonrpcAPI(user=self.http_user,password=self.http_pass)
+ if self.json_use_http:
+ jrapi =
jsonrpc.jsonrpcAPI(url=self.http_address +
'/jsonrpc',user=self.http_user,password=self.http_pass)
+ else:
+ jrapi = jsonrpc.jsonrpcAPI()
try:
shows = jrapi.VideoLibrary.GetTVShows()
except jsonrpc.UserPassError:
@@ -422,35 +503,66 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
except jsonrpc.ConnectionError:
xbmcgui.Dialog().ok(__language__(30031),__language__(30035),__language__(30036),__language__(30037))
return
+ if not 'tvshows' in shows: return #TODO put a dialog
here
tot = len(shows['tvshows'])
ct=0.0
+ added=0
+ exist=0
+ at_end = []
for s in shows['tvshows']:
+ #for s in [{'label':u'Fight Ippatsu! Jūden-chan!!'}]:
title = s['label']
pdialog.update(int((ct/tot)*100),title)
+ dummy = False
for c in self.shows:
if
difflib.get_close_matches(title,[c.name],1,0.7):
- print "SHOW: " + title + " -
EXISTS AS: " + c.name
+ LOG("SHOW: " + title + " -
EXISTS AS: " + c.name)
+ exist+=1
+ if c.isDummy():
+ dummy = True
+ continue
break
else:
result = API.search(title)
- #result =
API.search(re.sub('(.*?)','',title.lower().replace('the ','')))
matches = {}
for f in result.findall('show'):
matches[f.find('name').text] =
f.find('showid').text
close =
difflib.get_close_matches(title,matches.keys(),1,0.8)
if close:
- print "SHOW: " + title + " -
MATCHES: " + close[0]
+ LOG("SHOW: " + title + " -
MATCHES: " + close[0])
pdialog.update(int((ct/tot)*100),__language__(30028) + title)
self.doAddShow(matches[close[0]],skipCanceled=self.skip_canceled)
+ added+=1
else:
- sid =
self.userPickShow(result,append=title)
- if sid: self.doAddShow(sid)
+ if self.ask_on_no_match:
+ if dummy:
+ ct+=1
+ continue
+
at_end.append((title,result))
ct+=1
- self.saveData()
- self.updateDisplay()
finally:
pdialog.close()
-
+ while at_end:
+ left = []
+ for s in at_end: left.append(__language__(30051) + s[0])
+ idx = xbmcgui.Dialog().select(__language__(30052),['<
%s >' % (__language__(30053))] + left)
+ if idx < 1: break
+ title,result = at_end.pop(idx-1)
+ sid = self.userPickShow(result,append=title)
+ if sid:
added+=self.doAddShow(sid,skipCanceled=self.skip_canceled,name=title)
+
+ #for s in at_end:
+ # title,result = s
+ # sid = self.userPickShow(result,append=title)
+ # if sid:
added+=self.doAddShow(sid,skipCanceled=self.skip_canceled,name=title)
+ self.saveData()
+ self.updateDisplay()
+ skipped = ct - (added + exist)
+ xbmcgui.Dialog().ok( __language__(30042),
+
__language__(30043).replace('@NUMBER1@',str(added)).replace('@NUMBER2@',str(int(ct))),
+
__language__(30044).replace('@NUMBER@',str(exist)),
+
__language__(30045).replace('@NUMBER@',str(int(skipped))))
+
def addShow(self,sid,okdialog=True,name=''):
pdialog = xbmcgui.DialogProgress()
pdialog.create(__language__(30016),name)
@@ -487,7 +599,11 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
def eplist(self):
item = self.getControl(120).getSelectedItem()
sid = item.getProperty('id')
- w = EpListDialog("script-tvrage-eplist.xml" , os.getcwd(),
"Default",sid=sid)
+ if sid == '0':
+
xbmcgui.Dialog().ok(__language__(30049),__language__(30050))
+ return
+ showname = item.getLabel()
+ w = EpListDialog("script-tvrage-eplist.xml" , os.getcwd(),
"Default",sid=sid,showname=showname,parent=self)
w.doModal()
del w
@@ -499,7 +615,7 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
print "Empty XML or XML Error"
return
for s in shows.findall('show'):
-
self.shows.append(Show(xmltree=s,offset=self.air_offset))
+ self.shows.append(Show(xmltree=s))
def saveData(self):
sl = ['<shows>']
@@ -507,23 +623,51 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
sl.append(show.xml())
sl.append('</shows>')
self.fileWriteList(self.dataFile,sl)
-
- def updateProgress(self,level,lmax,text):
- percent = int((float(level)/lmax)*100)
- self.progress.update(percent,text)
+
+ def findXBMCEpFile(self,show,season,eptitle):
+ if self.json_use_http:
+ jrapi = jsonrpc.jsonrpcAPI(url=self.http_address +
'/jsonrpc',user=self.http_user,password=self.http_pass)
+ else:
+ jrapi = jsonrpc.jsonrpcAPI()
+ labels = []
+ ids = []
+ for s in jrapi.VideoLibrary.GetTVShows()['tvshows']:
+ labels.append(s['label'])
+ ids.append(s['tvshowid'])
+ mshow = difflib.get_close_matches(show,labels,1,0.7)
+ if not mshow: return
+ mshow = mshow[0]
+ eplist =
jrapi.VideoLibrary.GetEpisodes(tvshowid=ids[labels.index(mshow)],season=season)
+ if not 'episodes' in eplist: return
+ labels = []
+ files = []
+ for e in eplist['episodes']:
+ labels.append(e['label'])
+ files.append(e['file'])
+ mep = difflib.get_close_matches(eptitle,labels,1,0.7)
+ if not mep: return
+ #print mep
+ #print labels
+ efile = files[labels.index(mep[0])]
+ #print efile
+ return efile
def updateData(self):
- self.progress = xbmcgui.DialogProgress()
- self.progress.create(__language__(30003),__language__(30004))
- lmax = len(self.shows)
- ct=0
- for show in self.shows:
- if not show.canceled: show.getShowData()
- ct+=1
- self.updateProgress(ct,lmax,show.name)
- self.progress.close()
+ progress = xbmcgui.DialogProgress()
+ progress.create(__language__(30003),__language__(30004))
+ try:
+ lmax = len(self.shows)
+ ct=0
+ for show in self.shows:
+ if not show.canceled and show.showid != '0':
show.getShowData()
+ if progress.iscanceled(): break
+ ct+=1
+ percent = int((float(ct)/lmax)*100)
+ progress.update(percent,show.name)
+ finally:
+ progress.close()
self.setLast()
-
+
def updateDisplay(self):
disp = {}
for show in self.shows:
@@ -535,10 +679,26 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
xbmcgui.lock()
for k in sortd:
show = disp[k]
- nextUnix = show.getNextUnix()
+ nextUnix = show.getNextUnix(offset=self.air_offset)
- try: showdate = time.strftime('%a %b
%d',time.strptime(show.nextEp['date'],'%Y-%m-%d'))
- except: showdate = show.canceled
+ #try: showdate = time.strftime('%a %b
%d',time.strptime(show.nextEp['date'],'%Y-%m-%d'))
+ if show.canceled:
+ showdate = show.canceled
+ elif show.isDummy():
+ showdate = ''
+ else:
+ if show.nextEp['date']:
+ ds = show.nextEp['date'].split('-')
+ if '00' in ds:
+ if ds.index('00') == 1:
+ showdate = ds[0]
+ else:
+ showdate =
time.strftime('%b %Y',time.strptime('-'.join(ds[:-1]),'%Y-%m'))
+ else:
+ try: showdate =
time.strftime('%a %b %d',time.localtime(nextUnix))
+ except: showdate = show.canceled
+ else:
+ showdate = ''
item = xbmcgui.ListItem(label=show.name,label2=showdate)
if time.strftime('%j:%Y',time.localtime()) ==
time.strftime('%j:%Y',time.localtime(nextUnix)):
@@ -548,8 +708,11 @@ class TVRageEps(xbmcgui.WindowXMLDialog):
else:
item.setInfo('video',{"Genre":''})
- item.setProperty("summary",show.airtime)
- if show.canceled:
item.setProperty("summary",__language__(30030))
+
item.setProperty("summary",show.airtime(self.air_offset))
+ if show.canceled:
+ item.setProperty("summary",__language__(30030))
+ elif show.isDummy():
+ item.setProperty("summary",'')
item.setProperty("updated",show.nextEp['number'] + ' '
+ show.nextEp['title'])
if show.canceled:
item.setProperty("updated",__language__(30029))
diff --git a/script.tvrage.com/jsonrpc.py b/script.tvrage.com/jsonrpc.py
index 12f1ece..0e7bd38 100644
--- a/script.tvrage.com/jsonrpc.py
+++ b/script.tvrage.com/jsonrpc.py
@@ -1,4 +1,9 @@
import urllib, simplejson
+try:
+ import xbmc
+except:
+ #we're not in XBMC so we only get http
+ pass
class JsonRPCError(Exception):
def __init__(self, code, message):
@@ -13,30 +18,40 @@ class ConnectionError(Exception):
self.message = message
class UserPassError(Exception): pass
-
-class Namespace:
- def __init__(self,name,url):
- self.name = name
- self.url = url
+
+class baseNamespace:
+ def createParams(self,method,args,kwargs):
+ postdata = '{"jsonrpc": "2.0","id":"1","method":"%s.%s"' %
(self.name,method)
+ if kwargs:
+ postdata += ',"params": {'
+ append = ''
+ for k in kwargs:
+ if append: append += ','
+ val = kwargs[k]
+ append += '"%s":%s' %
(str(k),simplejson.dumps(val))
+ postdata += append + '}'
+ elif args:
+ postdata += ',"params":'
+ if len(args) == 1: args = args[0]
+ postdata += simplejson.dumps(args)
+ postdata += '}'
+ return postdata
+
+class httpNamespace(baseNamespace):
+ def __init__(self,name,api):
self.__handler_cache = {}
+ self.api = api
+ self.name = name
def __getattr__(self, method):
if method in self.__handler_cache:
return self.__handler_cache[method]
- def handler(**kwargs):
- postdata = '{"jsonrpc":
"2.0","id":"1","method":"%s.%s"' % (self.name,method)
- if kwargs:
- postdata += ',"params": {'
- append = ''
- for k in kwargs:
- if append: append += ','
- append += '"%s":"%s"' %
(str(k),str(kwargs[k]))
- postdata += append + '}'
- postdata += '}'
- #print postdata
+ def handler(*args,**kwargs):
+ postdata = self.createParams(method,args,kwargs)
+
try:
- fobj = urllib.urlopen(self.url,postdata)
+ fobj = urllib.urlopen(self.api.url,postdata)
except IOError,e:
if e.args[0] == 'http error':
if e.args[1] == 401: raise
UserPassError()
@@ -44,7 +59,7 @@ class Namespace:
try:
json = simplejson.loads(fobj.read())
- except:
+ finally:
fobj.close()
if 'error' in json: raise
JsonRPCError(json['error']['code'],json['error']['message'])
@@ -56,17 +71,48 @@ class Namespace:
self.__handler_cache[method] = handler
return handler
+class execNamespace(baseNamespace):
+ def __init__(self,name,api):
+ self.__handler_cache = {}
+ self.api = api
+ self.name = name
+
+ def __getattr__(self, method):
+ if method in self.__handler_cache:
+ return self.__handler_cache[method]
+
+ def handler(*args,**kwargs):
+ postdata = self.createParams(method,args,kwargs)
+
+ jsonstring = xbmc.executeJSONRPC(postdata)
+ json = simplejson.loads(jsonstring)
+
+ if 'error' in json: raise
JsonRPCError(json['error']['code'],json['error']['message'])
+
+ return json['result']
+
+
+ handler.method = method
+ self.__handler_cache[method] = handler
+ return handler
+
class jsonrpcAPI:
- def
__init__(self,url='http://127.0.0.1:8080/jsonrpc',user=None,password=None):
- if password: url = url.replace('http://','http://%s:%s@' %
(user,password))
- #print "URL: " + url
- self.url = url
+ def
__init__(self,mode='exec',url='http://127.0.0.1:8080/jsonrpc',user=None,password=None):
+ self.__namespace = None
+ if mode == 'http':
+ if password: url =
url.replace('http://','http://%s:%s@' % (user,password))
+ self.url = url
+ self.__namespace = httpNamespace
+ else:
+ self.__namespace = execNamespace
self.__namespace_cache = {}
def __getattr__(self, namespace):
if namespace in self.__namespace_cache:
return self.__namespace_cache[namespace]
- nsobj = Namespace(namespace,self.url)
+ self__namespace = self.__namespace #to prevent recursion
+ nsobj = self__namespace(namespace,self)
+
self.__namespace_cache[namespace] = nsobj
return nsobj
\ No newline at end of file
diff --git a/script.tvrage.com/resources/language/English/strings.xml
b/script.tvrage.com/resources/language/English/strings.xml
index 35540f9..27d424d 100644
--- a/script.tvrage.com/resources/language/English/strings.xml
+++ b/script.tvrage.com/resources/language/English/strings.xml
@@ -9,7 +9,7 @@
<string id="30007">Search/Add</string>
<string id="30008">Select Show</string>
<string id="30009">Are you sure?</string>
- <string id="30010">Do you really want to delete @repl...@?</string>
<!...@replace@ must not be translated -->
+ <string id="30010">Really delete @repl...@?</string> <!...@replace@ must
not be translated -->
<string id="30011">Options</string>
<string id="30012">Previous:</string>
<string id="30013">Reverse Sort</string>
@@ -43,6 +43,35 @@
<string id="30036">Make sure 'Allow control of XBMC via HTTP'</string>
<string id="30037">is enabled in XBMC network settings.</string>
- <string id="3013">Press context button/key for options</string>
+ <string id="30038">Access via HTTP</string>
+ <string id="30039">HTTP address</string>
+
+ <string id="30040">Skip</string>
+ <string id="30041">Cancel</string>
+
+ <string id="30042">Done</string>
+ <string id="30043">@NUMBER1@ of @NUMBER2@ shows added.</string>
+ <string id="30044">@NUMBER@ already in list.</string>
+ <string id="30045">@NUMBER@ skipped.</string>
+
+ <string id="30046">File Not Found</string>
+ <string id="30047">No matching file found.</string>
+
+ <string id="30048">Add as (Empty): @REPLACE@</string>
+
+ <string id="30049">No Data</string>
+ <string id="30050">No TVRage.com data</string>
+
+ <string id="30051">Add: </string>
+ <string id="30052">Not Matched</string>
+ <string id="30053">Skip All</string>
+
+ <string id="30054">Refresh</string>
+
+ <string id="30055">Loading episodes...</string>
+
+ <string id="3013">Press context button/key when in list for show
options</string>
+ <string id="3016">Add All From Library</string>
+ <string id="3017">Settings</string>
<string id="3018">Add Show</string>
</strings>
diff --git a/script.tvrage.com/resources/settings.xml
b/script.tvrage.com/resources/settings.xml
index d9e799f..72954ec 100644
--- a/script.tvrage.com/resources/settings.xml
+++ b/script.tvrage.com/resources/settings.xml
@@ -8,10 +8,11 @@
<setting id="jump_to_bottom" type="bool" label="30018" default="false" />
</category>
<category label="30019">
- <setting id="xbmc_http_user" type="text" label="30020"/>
- <setting id="xbmc_http_pass" type="text" option="hidden" label="30021"/>
+ <setting id="json_use_http" type="bool" label="30038" default="false"/>
+ <setting id="xbmc_http_addrress" type="text" label="30039"
default="http://127.0.0.1:8080" enable="eq(-1,true)" />
+ <setting id="xbmc_http_user" type="text" label="30020"
enable="eq(-2,true)" />
+ <setting id="xbmc_http_pass" type="text" option="hidden" label="30021"
enable="eq(-3,true)" />
<setting id="ask_on_no_match" type="bool" label="30023" default="true" />
<setting id="skip_canceled" type="bool" label="30022" default="false" />
</category>
-
</settings>
diff --git
a/script.tvrage.com/resources/skins/Default/720p/script-tvrage-main.xml
b/script.tvrage.com/resources/skins/Default/720p/script-tvrage-main.xml
index ded9602..72450f3 100644
--- a/script.tvrage.com/resources/skins/Default/720p/script-tvrage-main.xml
+++ b/script.tvrage.com/resources/skins/Default/720p/script-tvrage-main.xml
@@ -10,12 +10,12 @@
<controls>
<control type="group">
<posx>100</posx>
- <posy>50</posy>
+ <posy>10</posy>
<control type="image">
<posx>0</posx>
<posy>0</posy>
<width>1090</width>
- <height>600</height>
+ <height>700</height>
<texture border="40">default-panel.png</texture>
</control>
<!-- ** Required ** Do not change <id> or <type> -->
@@ -23,9 +23,9 @@
<control type="image" >
<description>page header tab icon</description>
<posx>20</posx>
- <posy>12</posy>
- <width>200</width>
- <height>82</height>
+ <posy>11</posy>
+ <width>518</width>
+ <height>120</height>
<texture>tvrage_logo.png</texture>
</control>
@@ -34,10 +34,10 @@
<control type="label">
<description>textarea</description>
- <posx>200</posx>
- <posy>20</posy>
- <width>690</width>
- <height>40</height>
+ <posx>580</posx>
+ <posy>30</posy>
+ <width>230</width>
+ <height>80</height>
<font>font18</font>
<textcolor>white</textcolor>
<aligny>center</aligny>
@@ -49,12 +49,12 @@
<control type="button" id="200">
<description>The Button</description>
<onleft>120</onleft>
- <onright>120</onright>
+ <onright>201</onright>
<onup>120</onup>
<ondown>120</ondown>
- <posx>370</posx>
- <posy>60</posy>
- <width>350</width>
+ <posx>30</posx>
+ <posy>620</posy>
+ <width>330</width>
<height>40</height>
<visible>true</visible>
<colordiffuse>FFFFFFFF</colordiffuse>
@@ -65,12 +65,50 @@
<disabledcolor>80FFFFFF</disabledcolor>
</control>
+ <control type="button" id="201">
+ <description>The Button</description>
+ <onleft>200</onleft>
+ <onright>202</onright>
+ <onup>120</onup>
+ <ondown>120</ondown>
+ <posx>384</posx>
+ <posy>620</posy>
+ <width>330</width>
+ <height>40</height>
+ <visible>true</visible>
+ <colordiffuse>FFFFFFFF</colordiffuse>
+ <font>font18</font>
+ <align>center</align>
+ <label>$LOCALIZE[SCRIPT3016]</label>
+ <textcolor>FFFFFFFF</textcolor>
+ <disabledcolor>80FFFFFF</disabledcolor>
+ </control>
+
+ <control type="button" id="202">
+ <description>The Button</description>
+ <onleft>201</onleft>
+ <onright>120</onright>
+ <onup>120</onup>
+ <ondown>120</ondown>
+ <posx>738</posx>
+ <posy>620</posy>
+ <width>330</width>
+ <height>40</height>
+ <visible>true</visible>
+ <colordiffuse>FFFFFFFF</colordiffuse>
+ <font>font18</font>
+ <align>center</align>
+ <label>$LOCALIZE[SCRIPT3017]</label>
+ <textcolor>FFFFFFFF</textcolor>
+ <disabledcolor>80FFFFFF</disabledcolor>
+ </control>
+
<control type="image" >
<description>page header tab icon</description>
- <posx>850</posx>
- <posy>12</posy>
- <width>200</width>
- <height>82</height>
+ <posx>844</posx>
+ <posy>11</posy>
+ <width>213</width>
+ <height>120</height>
<aspectratio>keep</aspectratio>
<texture>$INFO[Container(120).ListItem.Property(image)]</texture>
</control>
@@ -78,7 +116,7 @@
<control type="label">
<description>textarea</description>
<posx>30</posx>
- <posy>520</posy>
+ <posy>550</posy>
<width>1050</width>
<height>40</height>
<font>font18</font>
@@ -90,35 +128,35 @@
<control type="image">
<posx>20</posx>
- <posy>110</posy>
+ <posy>140</posy>
<width>1060</width>
<height>2</height>
<texture>TRseparator.png</texture>
</control>
<control type="image">
<posx>20</posx>
- <posy>510</posy>
+ <posy>540</posy>
<width>1060</width>
<height>2</height>
<texture>TRseparator.png</texture>
</control>
<control type="image">
<posx>20</posx>
- <posy>515</posy>
+ <posy>544</posy>
<width>1060</width>
<height>2</height>
<texture>TRseparator2.png</texture>
</control>
<control type="image">
<posx>20</posx>
- <posy>565</posy>
+ <posy>596</posy>
<width>1060</width>
<height>2</height>
<texture>TRseparator2.png</texture>
</control>
<control type="image">
<posx>20</posx>
- <posy>570</posy>
+ <posy>600</posy>
<width>1060</width>
<height>2</height>
<texture>TRseparator.png</texture>
@@ -127,10 +165,10 @@
<!-- ** Required ** Do not change <id> or <type> -->
<control type="list" id="120">
<posx>20</posx>
- <posy>126</posy>
+ <posy>152</posy>
<width>1040</width>
<height>380</height>
- <onleft>200</onleft>
+ <onleft>202</onleft>
<onright>200</onright>
<onup>120</onup>
<ondown>120</ondown>
@@ -285,7 +323,7 @@
</control>
<control type="group">
<posx>1055</posx>
- <posy>126</posy>
+ <posy>152</posy>
<control type="scrollbar" id="121">
<description>scroll bar indicator for lists</description>
<posx>0</posx>
diff --git
a/script.tvrage.com/resources/skins/Default/720p/script-tvrage-summary.xml
b/script.tvrage.com/resources/skins/Default/720p/script-tvrage-summary.xml
index 23903a8..9235786 100644
--- a/script.tvrage.com/resources/skins/Default/720p/script-tvrage-summary.xml
+++ b/script.tvrage.com/resources/skins/Default/720p/script-tvrage-summary.xml
@@ -43,9 +43,9 @@
<!-- ** Required ** Do not change <id> or <type> -->
<control type="textbox" id="120">
- <posx>20</posx>
+ <posx>40</posx>
<posy>130</posy>
- <width>740</width>
+ <width>720</width>
<height>382</height>
<pagecontrol>121</pagecontrol>
<description>My first text box control</description>
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=4dfea2b5833dca4089897af7d3a4c3d0e4d3360b
commit 4dfea2b5833dca4089897af7d3a4c3d0e4d3360b
Author: amet <a...@nospam>
Date: Wed Oct 20 01:39:46 2010 +0400
[script.image.bigpictures] -v 1.3.1
Fixed: Crash/Hang when using Alaska/Rapier-Skin
diff --git a/script.image.bigpictures/addon.xml
b/script.image.bigpictures/addon.xml
index d92f508..33f2832 100644
--- a/script.image.bigpictures/addon.xml
+++ b/script.image.bigpictures/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.image.bigpictures" name="The Big Picture" version="1.3.0"
provider-name="sphere, rwparris2">
+<addon id="script.image.bigpictures" name="The Big Picture" version="1.3.1"
provider-name="sphere, rwparris2">
<requires>
<import addon="xbmc.python" version="1.0"/>
<import addon="script.module.beautifulsoup" version="3.0.8"/>
diff --git a/script.image.bigpictures/changelog.txt
b/script.image.bigpictures/changelog.txt
index 3702a52..81392ef 100644
--- a/script.image.bigpictures/changelog.txt
+++ b/script.image.bigpictures/changelog.txt
@@ -1,3 +1,6 @@
+1.3.1
+ Fixed: Crash/Hang when using Alaska/Rapier-Skin
+
1.3.0
Added: The possibility to get albums/images from more than one website
(switch source)
Added: New Scraper 'Wallstreetjournal: The Photo Journal'
diff --git a/script.image.bigpictures/resources/lib/sbb_scraper.py
b/script.image.bigpictures/resources/lib/sbb_scraper.py
index 2cef12a..736e1eb 100644
--- a/script.image.bigpictures/resources/lib/sbb_scraper.py
+++ b/script.image.bigpictures/resources/lib/sbb_scraper.py
@@ -64,7 +64,6 @@ class SBB:
subtree_txt = tree.findAll('div', attrs={'style': 'background:
rgb(224, 224, 224); width: 970px; padding: 10px;'})
# this is very dirty because this website is very dirty :(
for i, node_img in enumerate(subtree_img):
- print i
pic = node_img.find('img')['src']
try:
description = self.cleanHTML(subtree_txt[i])
diff --git a/script.image.bigpictures/resources/skins/default/720p/main.xml
b/script.image.bigpictures/resources/skins/default/720p/main.xml
index 0a97b91..6e446e9 100644
--- a/script.image.bigpictures/resources/skins/default/720p/main.xml
+++ b/script.image.bigpictures/resources/skins/default/720p/main.xml
@@ -36,6 +36,7 @@
<aligny>top</aligny>
<label>32001</label>
<textcolor>FFAAAAAA</textcolor>
+ <font>font13</font>
</control>
<control type="list" id="100">
<!--Main List of Images-->
@@ -78,6 +79,7 @@
<label>$INFO[ListItem.Label]</label>
<textcolor>FFDDDDDD</textcolor>
<visible>$INFO[ListItem.Property(showInfo)]</visible>
+ <font>font13</font>
</control>
</itemlayout>
<focusedlayout width="1280" height="720">
@@ -113,6 +115,7 @@
<label>$INFO[ListItem.Label]</label>
<textcolor>FFDDDDDD</textcolor>
<visible>$INFO[ListItem.Property(showInfo)]</visible>
+ <font>font13</font>
</control>
<!--<control type="image">
<animation type="Focus">
@@ -182,6 +185,7 @@
<align>right</align>
<aligny>top</aligny>
<textcolor>FFAAAAAA</textcolor>
+ <font>font13</font>
</control>
</control>
</controls>
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=8cc1a9497cfd57a878b2239350d6da242a919bc7
commit 8cc1a9497cfd57a878b2239350d6da242a919bc7
Author: amet <a...@nospam>
Date: Wed Oct 20 01:36:08 2010 +0400
[script.xbmc.audio.mixer] -v 1.0.2
diff --git a/script.xbmc.audio.mixer/addon.xml
b/script.xbmc.audio.mixer/addon.xml
index 7057f4d..f34745c 100644
--- a/script.xbmc.audio.mixer/addon.xml
+++ b/script.xbmc.audio.mixer/addon.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmc.audio.mixer"
name="XBMC Audio Mixer"
- version="1.0.1"
+ version="1.0.2"
provider-name="Team XBMC">
<requires>
<import addon="xbmc.python" version="1.0"/>
diff --git a/script.xbmc.audio.mixer/resources/lib/alsaMixerCore.py
b/script.xbmc.audio.mixer/resources/lib/alsaMixerCore.py
index 1e92796..6a3c52f 100644
--- a/script.xbmc.audio.mixer/resources/lib/alsaMixerCore.py
+++ b/script.xbmc.audio.mixer/resources/lib/alsaMixerCore.py
@@ -156,9 +156,11 @@ class alsaMixerCore:
if nameStart>0:
stdErr, stdOut, retValue =
self.__runSilent("amixer sget " + mixername)
if stdOut.find("pvolume") > 0:
- hasVol=True
+ if not stdOut.find("cvolume") > 0:
+ hasVol=True
if stdOut.find("pswitch") > 0:
- hasSw = True
+ if not stdOut.find("cswitch") > 0:
+ hasSw = True
if hasVol or hasSw:
channels = channels + mixername + "|"
self.controls[mixername] = [volLevel,
hasVol, hasSw]
@@ -254,5 +256,5 @@ if __name__ == '__main__':
except Exception, error:
print "ErrorCode:" + str(error)
- eCode = int(str(error))
+ # eCode = int(str(error))
-----------------------------------------------------------------------
Summary of changes:
script.image.bigpictures/addon.xml | 2 +-
script.image.bigpictures/changelog.txt | 3 +
.../resources/lib/sbb_scraper.py | 1 -
.../resources/skins/default/720p/main.xml | 4 +
script.tvrage.com/addon.xml | 6 +-
script.tvrage.com/changelog.txt | 45 +++-
script.tvrage.com/default.py | 311 +++++++++++++++-----
script.tvrage.com/jsonrpc.py | 92 +++++--
.../resources/language/English/strings.xml | 33 ++-
script.tvrage.com/resources/settings.xml | 7 +-
.../resources/skins/Default/720p/includes.xml | 3 -
.../skins/Default/720p/script-tvrage-main.xml | 90 ++++--
.../skins/Default/720p/script-tvrage-summary.xml | 4 +-
script.xbmc.audio.mixer/addon.xml | 2 +-
.../resources/lib/alsaMixerCore.py | 8 +-
15 files changed, 469 insertions(+), 142 deletions(-)
delete mode 100644 script.tvrage.com/resources/skins/Default/720p/includes.xml
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons