The branch, eden-pre has been updated
via bd9f5eaf99e9431ea4e10ca18aa2336aead70903 (commit)
from 416270f3e6f4037fb9d118edb449394046b96497 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=bd9f5eaf99e9431ea4e10ca18aa2336aead70903
commit bd9f5eaf99e9431ea4e10ca18aa2336aead70903
Author: ronie <[email protected]>
Date: Fri Dec 16 15:02:20 2011 +0100
[script.globalsearch] -v0.1.7
improve videoresolution matching
diff --git a/script.globalsearch/addon.xml b/script.globalsearch/addon.xml
index efc200c..410f565 100644
--- a/script.globalsearch/addon.xml
+++ b/script.globalsearch/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.globalsearch" name="Global Search" version="0.1.5"
provider-name="ronie">
+<addon id="script.globalsearch" name="Global Search" version="0.1.7"
provider-name="ronie">
<requires>
<import addon="xbmc.python" version="2.0"/>
<import addon="script.module.simplejson" version="2.0.10"/>
diff --git a/script.globalsearch/changelog.txt
b/script.globalsearch/changelog.txt
index 471ee5f..5abe2d7 100644
--- a/script.globalsearch/changelog.txt
+++ b/script.globalsearch/changelog.txt
@@ -1,3 +1,11 @@
+v0.1.7
+- ignore possible encoding errors
+- improve videoresolution matching
+
+v0.1.6
+- check if streamdetails items exist before calling them
+- show artistname instead of recordlabel for musicvideos in gui
+
v0.1.5
- use simplejson instead of regex
diff --git a/script.globalsearch/default.py b/script.globalsearch/default.py
index 05c274f..9960438 100644
--- a/script.globalsearch/default.py
+++ b/script.globalsearch/default.py
@@ -17,8 +17,8 @@ if ( __name__ == "__main__" ):
if ( keyboard.isConfirmed() ):
searchstring = keyboard.getText()
import gui
- window = "main"
- ui = gui.GUI( "script-globalsearch-main.xml" , __cwd__, "Default",
searchstring=searchstring )
+# window = "main"
+ ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default",
searchstring=searchstring )
ui.doModal()
del ui
sys.modules.clear()
diff --git a/script.globalsearch/resources/lib/gui.py
b/script.globalsearch/resources/lib/gui.py
index dcebd3f..81183cd 100644
--- a/script.globalsearch/resources/lib/gui.py
+++ b/script.globalsearch/resources/lib/gui.py
@@ -19,8 +19,8 @@ def log(txt):
class GUI( xbmcgui.WindowXMLDialog ):
def __init__( self, *args, **kwargs ):
- xbmcgui.WindowXMLDialog.__init__( self )
- self.searchstring = kwargs[ "searchstring"
].replace('(','[(]').replace(')','[)]').replace('+','[+]')
+# xbmcgui.WindowXMLDialog.__init__( self )
+ self.searchstring = kwargs[ "searchstring" ].replace('(',
'[(]').replace(')', '[)]').replace('+', '[+]')
log('script version %s started' % __addonversion__)
self.nextsearch = False
@@ -116,6 +116,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.getControl( 191 ).setLabel( '[B]' + xbmc.getLocalizedString(342)
+ '[/B]' )
count = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMovies", "params": {"properties": ["streamdetails", "genre",
"studio", "year", "tagline", "plot", "plotoutline", "runtime", "fanart",
"thumbnail", "file", "trailer", "playcount", "rating", "mpaa", "director",
"writer"], "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('movies')):
for item in json_response['result']['movies']:
@@ -139,40 +140,43 @@ class GUI( xbmcgui.WindowXMLDialog ):
thumb = item['thumbnail']
trailer = item['trailer']
year = str(item['year'])
- if item['streamdetails'] != None:
+ if item['streamdetails'] != None and
item['streamdetails'].has_key('audio'):
audiochannels =
str(item['streamdetails']['audio'][0]['channels'])
audiocodec =
str(item['streamdetails']['audio'][0]['codec'])
+ else:
+ audiochannels = ''
+ audiocodec = ''
+ if item['streamdetails'] != None and
item['streamdetails'].has_key('video'):
videocodec =
str(item['streamdetails']['video'][0]['codec'])
- aspect =
float(item['streamdetails']['video'][0]['aspect'])
- if aspect <= 1.4859:
+ videoaspect =
float(item['streamdetails']['video'][0]['aspect'])
+ if videoaspect <= 1.4859:
videoaspect = '1.33'
- elif aspect <= 1.7190:
+ elif videoaspect <= 1.7190:
videoaspect = '1.66'
- elif aspect <= 1.8147:
+ elif videoaspect <= 1.8147:
videoaspect = '1.78'
- elif aspect <= 2.0174:
+ elif videoaspect <= 2.0174:
videoaspect = '1.85'
- elif aspect <= 2.2738:
+ elif videoaspect <= 2.2738:
videoaspect = '2.20'
else:
videoaspect = '2.35'
- resolution =
item['streamdetails']['video'][0]['height']
- if resolution <= 480:
+ videowidth = item['streamdetails']['video'][0]['width']
+ videoheight =
item['streamdetails']['video'][0]['height']
+ if videowidth <= 720 and videoheight <= 480:
videoresolution = '480'
- elif resolution <= 544:
- videoresolution = '540'
- elif resolution <= 576:
+ elif videowidth <= 768 and videoheight <= 576:
videoresolution = '576'
- elif resolution <= 720:
+ elif videowidth <= 960 and videoheight <= 544:
+ videoresolution = '540'
+ elif videowidth <= 1280 and videoheight <= 720:
videoresolution = '720'
else:
videoresolution = '1080'
else:
- audiochannels = ''
- audiocodec = ''
videocodec = ''
- aspect = ''
- resolution = ''
+ videoaspect = ''
+ videoresolution = ''
listitem = xbmcgui.ListItem(label=movie,
iconImage='DefaultVideo.png', thumbnailImage=thumb)
listitem.setProperty( "icon", thumb )
listitem.setProperty( "fanart_image", fanart )
@@ -209,6 +213,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.getControl( 191 ).setLabel( '[B]' +
xbmc.getLocalizedString(20343) + '[/B]' )
count = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetTVShows", "params": {"properties": ["genre", "studio",
"premiered", "plot", "fanart", "thumbnail", "playcount", "year", "mpaa",
"episode", "rating"], "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('tvshows')):
for item in json_response['result']['tvshows']:
@@ -255,6 +260,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.getControl( 191 ).setLabel( '[B]' +
xbmc.getLocalizedString(20343) + '[/B]' )
count = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetSeasons", "params": {"properties": ["showtitle", "season",
"fanart", "thumbnail", "playcount", "episode"], "sort": { "method": "label" },
"tvshowid":%s }, "id": 1}' % self.tvshowid)
+ 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('seasons')):
for item in json_response['result']['seasons']:
@@ -293,6 +299,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetEpisodes", "params": { "properties": ["streamdetails", "plot",
"firstaired", "runtime", "season", "episode", "showtitle", "thumbnail",
"fanart", "file", "playcount", "director", "rating"], "sort": { "method":
"label" }, "tvshowid":%s }, "id": 1}' % self.tvshowid)
else:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetEpisodes", "params": { "properties": ["streamdetails", "plot",
"firstaired", "runtime", "season", "episode", "showtitle", "thumbnail",
"fanart", "file", "playcount", "director", "rating"], "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('episodes')):
for item in json_response['result']['episodes']:
@@ -320,40 +327,43 @@ class GUI( xbmcgui.WindowXMLDialog ):
playcount = str(item['playcount'])
thumb = item['thumbnail']
fanart = item['fanart']
- if item['streamdetails'] != None:
+ if item['streamdetails'] != None and
item['streamdetails'].has_key('audio'):
audiochannels =
str(item['streamdetails']['audio'][0]['channels'])
audiocodec =
str(item['streamdetails']['audio'][0]['codec'])
+ else:
+ audiochannels = ''
+ audiocodec = ''
+ if item['streamdetails'] != None and
item['streamdetails'].has_key('video'):
videocodec =
str(item['streamdetails']['video'][0]['codec'])
- aspect =
float(item['streamdetails']['video'][0]['aspect'])
- if aspect <= 1.4859:
+ videoaspect =
float(item['streamdetails']['video'][0]['aspect'])
+ if videoaspect <= 1.4859:
videoaspect = '1.33'
- elif aspect <= 1.7190:
+ elif videoaspect <= 1.7190:
videoaspect = '1.66'
- elif aspect <= 1.8147:
+ elif videoaspect <= 1.8147:
videoaspect = '1.78'
- elif aspect <= 2.0174:
+ elif videoaspect <= 2.0174:
videoaspect = '1.85'
- elif aspect <= 2.2738:
+ elif videoaspect <= 2.2738:
videoaspect = '2.20'
else:
videoaspect = '2.35'
- resolution =
item['streamdetails']['video'][0]['height']
- if resolution <= 480:
+ videowidth = item['streamdetails']['video'][0]['width']
+ videoheight =
item['streamdetails']['video'][0]['height']
+ if videowidth <= 720 and videoheight <= 480:
videoresolution = '480'
- elif resolution <= 544:
- videoresolution = '540'
- elif resolution <= 576:
+ elif videowidth <= 768 and videoheight <= 576:
videoresolution = '576'
- elif resolution <= 720:
+ elif videowidth <= 960 and videoheight <= 544:
+ videoresolution = '540'
+ elif videowidth <= 1280 and videoheight <= 720:
videoresolution = '720'
else:
videoresolution = '1080'
else:
- audiochannels = ''
- audiocodec = ''
videocodec = ''
- aspect = ''
- resolution = ''
+ videoaspect = ''
+ videoresolution = ''
listitem = xbmcgui.ListItem(label=episode,
iconImage='DefaultVideo.png', thumbnailImage=thumb)
listitem.setProperty( "icon", thumb )
listitem.setProperty( "episode", episodenumber )
@@ -386,12 +396,15 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.getControl( 191 ).setLabel( '[B]' +
xbmc.getLocalizedString(20389) + '[/B]' )
count = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"VideoLibrary.GetMusicVideos", "params": {"properties": ["streamdetails",
"runtime", "genre", "studio", "artist", "album", "year", "plot", "fanart",
"thumbnail", "file", "playcount", "director"], "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('musicvideos')):
for item in json_response['result']['musicvideos']:
+ log(item)
musicvideo = item['label']
musicvideomatch = re.search( '.*' + self.searchstring + '.*',
musicvideo, re.I )
if musicvideomatch:
+ log("match")
count = count + 1
album = item['album']
artist = item['artist']
@@ -404,31 +417,36 @@ class GUI( xbmcgui.WindowXMLDialog ):
thumb = item['thumbnail']
playcount = str(item['playcount'])
year = str(item['year'])
- if item['streamdetails'] != None:
+ if item['streamdetails'] != None and
item['streamdetails'].has_key('audio'):
audiochannels =
str(item['streamdetails']['audio'][0]['channels'])
audiocodec =
str(item['streamdetails']['audio'][0]['codec'])
+ else:
+ audiochannels = ''
+ audiocodec = ''
+ if item['streamdetails'] != None and
item['streamdetails'].has_key('video'):
videocodec =
str(item['streamdetails']['video'][0]['codec'])
- aspect =
float(item['streamdetails']['video'][0]['aspect'])
- if aspect <= 1.4859:
+ videoaspect =
float(item['streamdetails']['video'][0]['aspect'])
+ if videoaspect <= 1.4859:
videoaspect = '1.33'
- elif aspect <= 1.7190:
+ elif videoaspect <= 1.7190:
videoaspect = '1.66'
- elif aspect <= 1.8147:
+ elif videoaspect <= 1.8147:
videoaspect = '1.78'
- elif aspect <= 2.0174:
+ elif videoaspect <= 2.0174:
videoaspect = '1.85'
- elif aspect <= 2.2738:
+ elif videoaspect <= 2.2738:
videoaspect = '2.20'
else:
videoaspect = '2.35'
- resolution =
item['streamdetails']['video'][0]['height']
- if resolution <= 480:
+ videowidth = item['streamdetails']['video'][0]['width']
+ videoheight =
item['streamdetails']['video'][0]['height']
+ if videowidth <= 720 and videoheight <= 480:
videoresolution = '480'
- elif resolution <= 544:
- videoresolution = '540'
- elif resolution <= 576:
+ elif videowidth <= 768 and videoheight <= 576:
videoresolution = '576'
- elif resolution <= 720:
+ elif videowidth <= 960 and videoheight <= 544:
+ videoresolution = '540'
+ elif videowidth <= 1280 and videoheight <= 720:
videoresolution = '720'
else:
videoresolution = '1080'
@@ -436,11 +454,9 @@ class GUI( xbmcgui.WindowXMLDialog ):
if duration[0] == '0':
duration = duration[2:]
else:
- audiochannels = ''
- audiocodec = ''
videocodec = ''
- aspect = ''
- resolution = ''
+ videoaspect = ''
+ videoresolution = ''
duration = ''
listitem = xbmcgui.ListItem(label=musicvideo,
iconImage='DefaultVideo.png', thumbnailImage=thumb)
listitem.setProperty( "icon", thumb )
@@ -474,6 +490,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
self.getControl( 191 ).setLabel( '[B]' + xbmc.getLocalizedString(133)
+ '[/B]' )
count = 0
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetArtists", "params": {"properties": ["genre", "description",
"fanart", "thumbnail", "formed", "disbanded", "born", "yearsactive", "died",
"mood", "style"], "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')):
for item in json_response['result']['artists']:
@@ -523,6 +540,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetAlbums", "params": {"properties": ["description",
"albumlabel", "artist", "genre", "year", "thumbnail", "fanart", "theme",
"type", "mood", "style", "rating"], "sort": { "method": "label" },
"artistid":%s }, "id": 1}' % self.artistid)
else:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetAlbums", "params": {"properties": ["description",
"albumlabel", "artist", "genre", "year", "thumbnail", "fanart", "theme",
"type", "mood", "style", "rating"], "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('albums')):
for item in json_response['result']['albums']:
@@ -587,6 +605,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetSongs", "params": {"properties": ["artist", "album", "genre",
"duration", "year", "file", "thumbnail", "fanart", "comment", "rating",
"track", "playcount"], "sort": { "method": "label" }, "artistid":%s }, "id":
1}' % self.artistid)
else:
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetSongs", "params": {"properties": ["artist", "album", "genre",
"duration", "year", "file", "thumbnail", "fanart", "comment", "rating",
"track", "playcount"], "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('songs')):
for item in json_response['result']['songs']:
@@ -697,6 +716,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
playlist = xbmc.PlayList(0)
playlist.clear()
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method":
"AudioLibrary.GetSongs", "params": {"properties": ["file", "fanart"], "sort": {
"method": "track" }, "albumid":%s }, "id": 1}' % self.albumid)
+ 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')):
for item in json_response['result']['songs']:
diff --git
a/script.globalsearch/resources/skins/Default/720p/script-globalsearch-main.xml
b/script.globalsearch/resources/skins/Default/720p/script-globalsearch-main.xml
index 44c7ca2..ef4b664 100644
---
a/script.globalsearch/resources/skins/Default/720p/script-globalsearch-main.xml
+++
b/script.globalsearch/resources/skins/Default/720p/script-globalsearch-main.xml
@@ -1002,7 +1002,7 @@
<posy>28</posy>
<width>280</width>
<height>12</height>
-
<label>$INFO[ListItem.Property(studio)]</label>
+
<label>$INFO[ListItem.Property(Artist)]</label>
<font>font12</font>
<textcolor>FF99D8FF</textcolor>
<aligny>center</aligny>
@@ -1068,7 +1068,7 @@
<posy>28</posy>
<width>280</width>
<height>12</height>
-
<label>$INFO[ListItem.Property(studio)]</label>
+
<label>$INFO[ListItem.Property(Artist)]</label>
<font>font12</font>
<textcolor>FF99D8FF</textcolor>
<aligny>center</aligny>
-----------------------------------------------------------------------
Summary of changes:
script.globalsearch/addon.xml | 2 +-
script.globalsearch/changelog.txt | 8 ++
script.globalsearch/default.py | 4 +-
script.globalsearch/resources/lib/gui.py | 126 +++++++++++--------
.../Default/720p/script-globalsearch-main.xml | 4 +-
5 files changed, 86 insertions(+), 58 deletions(-)
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons