The branch, eden has been updated
via 2efad295f63077542f6eccf6b8b7fdb11854f24a (commit)
via 65f460e1ee0a9820792fbc71fb2fe2dadadcb4a5 (commit)
from f04c6f5f85225f33888268fc9a4b7ddf550f26af (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=2efad295f63077542f6eccf6b8b7fdb11854f24a
commit 2efad295f63077542f6eccf6b8b7fdb11854f24a
Author: Martijn Kaijser <[email protected]>
Date: Tue Aug 7 22:11:42 2012 +0200
[script.watchlist] -v0.1.15
diff --git a/script.watchlist/addon.xml b/script.watchlist/addon.xml
index de5c4c9..670915e 100644
--- a/script.watchlist/addon.xml
+++ b/script.watchlist/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.watchlist" name="Watchlist" version="0.1.13"
provider-name="ronie, `Black">
+<addon id="script.watchlist" name="Watchlist" version="0.1.15"
provider-name="ronie, `Black">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
diff --git a/script.watchlist/changelog.txt b/script.watchlist/changelog.txt
index 4a60d7e..d118b65 100644
--- a/script.watchlist/changelog.txt
+++ b/script.watchlist/changelog.txt
@@ -1,3 +1,9 @@
+v0.1.15
+- fixed up the case for TV episodes where you have more than 1 file for a
given season/episode of a TV show (thx jparyani)
+
+v0.1.14
+- fixed script error on empty library
+
v0.1.13
- fixed use title instead of label
diff --git a/script.watchlist/default.py b/script.watchlist/default.py
index 944e128..0d3b35d 100644
--- a/script.watchlist/default.py
+++ b/script.watchlist/default.py
@@ -76,7 +76,7 @@ class Main:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"properties": ["title", "resume", "genre",
"studio", "tagline", "runtime", "fanart", "thumbnail", "file", "plot",
"plotoutline", "year", "lastplayed", "rating"]}, "id": 1}')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
- if json_response['result'].has_key('movies'):
+ if json_response.has_key('result') and
json_response['result'].has_key('movies'):
for item in json_response['result']['movies']:
self.movieList.append(item)
if item['resume']['position'] > 0:
@@ -114,29 +114,29 @@ class Main:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetEpisodes", "params": {"properties": ["title", "playcount",
"plot", "season", "episode", "showtitle", "thumbnail", "file", "lastplayed",
"rating"], "sort": {"method": "episode"} }, "id": 1}' )
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
- if json_response['result'].has_key('episodes'):
+ if json_response.has_key('result') and
json_response['result'].has_key('episodes'):
json_response = json_response['result']['episodes']
# our list is sorted by episode number, secondary we sort by
tvshow title (itertools.groupy needs contiguous items) and split it into
seperate lists for each tvshow
episodes = [list(group) for key,group in
itertools.groupby(sorted(json_response, key=itemgetter('showtitle')),
key=itemgetter('showtitle'))]
- # fetch all tvshows, sorted by title
- json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"properties": ["title", "studio",
"thumbnail", "fanart"], "sort": {"method": "title"}}, "id": 1}')
- json_query = unicode(json_query, 'utf-8', errors='ignore')
- json_response = simplejson.loads(json_query)
- if json_response['result'].has_key('tvshows'):
- for count, tvshow in enumerate(json_response['result']['tvshows']):
- item = [tvshow['tvshowid'], tvshow['thumbnail'],
tvshow['studio'], tvshow['title'], tvshow['fanart'], []]
- for episodelist in episodes:
- if episodelist[0]['showtitle'] == item[3]:
- item[5] = episodelist
- break
- self.tvshows.append(item)
+ # fetch all tvshows, sorted by title
+ json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"properties": ["title", "studio",
"thumbnail", "fanart"], "sort": {"method": "title"}}, "id": 1}')
+ json_query = unicode(json_query, 'utf-8', errors='ignore')
+ json_response = simplejson.loads(json_query)
+ if json_response.has_key('result') and
json_response['result'].has_key('tvshows'):
+ for count, tvshow in
enumerate(json_response['result']['tvshows']):
+ item = [tvshow['tvshowid'], tvshow['thumbnail'],
tvshow['studio'], tvshow['title'], tvshow['fanart'], []]
+ for episodelist in episodes:
+ if episodelist[0]['showtitle'] == item[3]:
+ item[5] = episodelist
+ break
+ self.tvshows.append(item)
log("tv show list: %s items" % len(self.tvshows))
def _fetch_seasonthumb( self, tvshowid, seasonnumber ):
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetSeasons", "params": {"properties": ["season", "thumbnail"],
"tvshowid":%s }, "id": 1}' % tvshowid)
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
- if json_response['result'].has_key('seasons'):
+ if json_response.has_key('result') and
json_response['result'].has_key('seasons'):
for item in json_response['result']['seasons']:
season = "%.2d" % float(item['season'])
if season == seasonnumber:
@@ -147,8 +147,12 @@ class Main:
self.episodes = []
for tvshow in self.tvshows:
lastplayed = ""
- for item in tvshow[5]:
- playcount = item['playcount']
+ episode_sorter = lambda item: (int(item['season']),
int(item['episode']))
+ for key, group in itertools.groupby(sorted(tvshow[5],
key=episode_sorter), episode_sorter):
+ playcount = 0
+ for item in sorted(group, key=lambda x: (x['lastplayed'],
x['episodeid'])):
+ # sort first by lastplayed, so we're certain to always get
the latest played item upon final iteration of the loop. Then sort by
episodeid, mainly for the case where lastplayed is empty for all items, and we
want the latest episodeid to be the one chosen (higher episodeid equals being
added later to xbmc)
+ playcount += int(item['playcount'])
if playcount != 0:
# this episode has been watched, record play date (we need
it for sorting the final list) and continue to next episode
lastplayed = item['lastplayed']
@@ -209,7 +213,7 @@ class Main:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetSongs", "params": {"properties": ["playcount", "albumid"],
"sort": { "method": "album" } }, "id": 1}')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('songs')):
+ if json_response.has_key('result') and (json_response['result'] !=
None) and (json_response['result'].has_key('songs')):
for item in json_response['result']['songs']:
albumid = item['albumid']
if albumid != '':
@@ -238,7 +242,7 @@ class Main:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetAlbumDetails", "params": {"properties": ["title",
"description", "albumlabel", "artist", "genre", "year", "thumbnail", "fanart",
"rating"], "albumid":%s }, "id": 1}' % albumid[0])
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
- if json_response['result'].has_key('albumdetails'):
+ if json_response.has_key('result') and
json_response['result'].has_key('albumdetails'):
item = json_response['result']['albumdetails']
description = item['description']
album = item['title']
@@ -265,7 +269,7 @@ class Main:
playlist = xbmc.PlayList(0)
# clear the playlist
playlist.clear()
- if json_response['result'].has_key('songs'):
+ if json_response.has_key('result') and
json_response['result'].has_key('songs'):
for item in json_response['result']['songs']:
song = item['file']
fanart = item['fanart']
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=65f460e1ee0a9820792fbc71fb2fe2dadadcb4a5
commit 65f460e1ee0a9820792fbc71fb2fe2dadadcb4a5
Author: Martijn Kaijser <[email protected]>
Date: Tue Aug 7 22:09:54 2012 +0200
[script.randomitems] -v3.1.3
diff --git a/script.randomitems/README.txt b/script.randomitems/README.txt
index 5e71d5d..5091756 100644
--- a/script.randomitems/README.txt
+++ b/script.randomitems/README.txt
@@ -88,5 +88,6 @@ Labels:
For more inforamtion and help please check:
+http://wiki.xbmc.org/index.php?title=Add-on:Random_Items_script
-http://forum.xbmc.org/showthread.php?t=55907
+http://forum.xbmc.org/showthread.php?tid=79378
diff --git a/script.randomitems/RandomItems.py
b/script.randomitems/RandomItems.py
index 4800718..b4d2263 100644
--- a/script.randomitems/RandomItems.py
+++ b/script.randomitems/RandomItems.py
@@ -88,7 +88,7 @@ class Main:
json_query = unicode(json_query, 'utf-8', errors='ignore')
# separate the records
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('movies')):
+ if json_response.has_key('result') and
(json_response['result'].has_key('movies')):
json_response = json_response['result']['movies']
# get total value
total = str( len( json_response ) )
@@ -137,7 +137,7 @@ class Main:
json_query = unicode(json_query, 'utf-8', errors='ignore')
# separate the records
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('episodes')):
+ if json_response.has_key('result') and
(json_response['result'].has_key('episodes')):
json_response = json_response['result']['episodes']
# get total value
total = str( len( json_response ) )
@@ -187,7 +187,7 @@ class Main:
json_query = unicode(json_query, 'utf-8', errors='ignore')
# separate the records
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('musicvideos')):
+ if json_response.has_key('result') and
(json_response['result'].has_key('musicvideos')):
json_response = json_response['result']['musicvideos']
# get total value
total = str( len( json_response ) )
@@ -233,7 +233,8 @@ class Main:
json_query = unicode(json_query, 'utf-8', errors='ignore')
# separate the records
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('albums')):
+
+ if json_response.has_key('result') and
(json_response['result'].has_key('albums')):
json_response = json_response['result']['albums']
# get total value
total = str( len( json_response ) )
@@ -274,7 +275,8 @@ class Main:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetArtists", "params": {"properties": ["genre", "description",
"fanart", "thumbnail"], "sort": { "method": "label" } }, "id": 1}')
json_query = unicode(json_query, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('artists')):
+
+ if json_response.has_key('result') and
(json_response['result'].has_key('artists')):
json_response = json_response['result']['artists']
# get total value
total = str( len( json_response ) )
@@ -311,7 +313,7 @@ class Main:
json_query = unicode(json_query, 'utf-8', errors='ignore')
# separate the records
json_response = simplejson.loads(json_query)
- if (json_response['result'] != None) and
(json_response['result'].has_key('songs')):
+ if json_response.has_key('result') and
(json_response['result'].has_key('songs')):
json_response = json_response['result']['songs']
# get total value
total = str( len( json_response ) )
@@ -364,7 +366,11 @@ class Main:
addonfile = os.path.join(addonpath, item, 'addon.xml')
if os.path.exists(addonfile):
# find addon id
- addonfilecontents = xmltree.parse(addonfile).getroot()
+ try:
+ addonfilecontents = xmltree.parse(addonfile).getroot()
+ except:
+ # don't error on invalid addon.xml files
+ continue
for element in addonfilecontents.getiterator():
if element.tag == "addon":
addonid = element.attrib.get('id')
@@ -412,7 +418,7 @@ class Main:
# separate the records
json_response = simplejson.loads(json_query)
# enumerate thru our records
- if (json_response['result'] != None) and
(json_response['result'].has_key('songs')):
+ if json_response.has_key('result') and
(json_response['result'].has_key('songs')):
for item in json_response['result']['songs']:
song = item['file']
fanart = item['fanart']
diff --git a/script.randomitems/addon.xml b/script.randomitems/addon.xml
index 8b28e69..aadf4a2 100644
--- a/script.randomitems/addon.xml
+++ b/script.randomitems/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.randomitems" name="Random Items script" version="3.1.1"
provider-name="Hitcher, ronie, phil65">
+<addon id="script.randomitems" name="Random Items script" version="3.1.3"
provider-name="Hitcher, ronie, phil65">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.elementtree" version="1.2.7"/>
diff --git a/script.randomitems/changelog.txt b/script.randomitems/changelog.txt
index 35b74f8..c336d25 100644
--- a/script.randomitems/changelog.txt
+++ b/script.randomitems/changelog.txt
@@ -1,3 +1,9 @@
+v3.1.3
+- don't error on invalid addon.xml files
+
+v3.1.2
+- fixed script error on empty library
+
v3.1.1
- added "RandomArtist.%d.Genre"
-----------------------------------------------------------------------
Summary of changes:
script.randomitems/README.txt | 3 +-
script.randomitems/RandomItems.py | 22 +++++++++++------
script.randomitems/addon.xml | 2 +-
script.randomitems/changelog.txt | 6 +++++
script.watchlist/addon.xml | 2 +-
script.watchlist/changelog.txt | 6 +++++
script.watchlist/default.py | 44 ++++++++++++++++++++----------------
7 files changed, 54 insertions(+), 31 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
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