The branch, gotham has been updated via a640afb94dde1a3a4e5f3febcdaec782288268c4 (commit) from c703d1f2159f30dab10fa9c27d15f0d0ee3f79e0 (commit)
- Log ----------------------------------------------------------------- http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=a640afb94dde1a3a4e5f3febcdaec782288268c4 commit a640afb94dde1a3a4e5f3febcdaec782288268c4 Author: amet <amet.nos...@gmail.com> Date: Sun Jan 12 09:34:04 2014 +0400 [service.subtitles.opensubtitles] -v5.0.5 5.0.5 - [fix] ascii UNICODE.decode - [fix] manual search string unquoted - cosmetics and code simplification diff --git a/service.subtitles.opensubtitles/addon.xml b/service.subtitles.opensubtitles/addon.xml index c7a3ddf..8068395 100755 --- a/service.subtitles.opensubtitles/addon.xml +++ b/service.subtitles.opensubtitles/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="service.subtitles.opensubtitles" name="OpenSubtitles.org" - version="5.0.4" + version="5.0.5" provider-name="amet"> <requires> <import addon="xbmc.python" version="2.1.0"/> @@ -14,7 +14,7 @@ <disclaimer lang="en"></disclaimer> <platform>all</platform> <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license> - <forum></forum> + <forum>http://forum.xbmc.org/showthread.php?tid=183114</forum> <website></website> <email></email> <source>https://github.com/amet/service.subtitles.opensubtitles</source> diff --git a/service.subtitles.opensubtitles/changelog.txt b/service.subtitles.opensubtitles/changelog.txt index 0e46061..71fd26d 100644 --- a/service.subtitles.opensubtitles/changelog.txt +++ b/service.subtitles.opensubtitles/changelog.txt @@ -1,3 +1,8 @@ +5.0.5 +- [fix] ascii UNICODE.decode +- [fix] manual search string unquoted +- cosmetics and code simplification + 5.0.4 - manual search button support diff --git a/service.subtitles.opensubtitles/resources/lib/OSUtilities.py b/service.subtitles.opensubtitles/resources/lib/OSUtilities.py index 3911fb1..cb47bcf 100644 --- a/service.subtitles.opensubtitles/resources/lib/OSUtilities.py +++ b/service.subtitles.opensubtitles/resources/lib/OSUtilities.py @@ -4,6 +4,7 @@ import os import sys import xbmc import struct +import urllib import xbmcvfs import xmlrpclib import xbmcaddon @@ -25,7 +26,7 @@ class OSDBServer: if ( self.osdb_token ) : searchlist = [] if item['mansearch']: - OS_search_string = item['mansearchstr'] + OS_search_string = urllib.unquote(item['mansearchstr']) elif len(item['tvshow']) > 0: OS_search_string = ("%s S%.2dE%.2d" % (item['tvshow'], int(item['season']), @@ -45,7 +46,7 @@ class OSDBServer: searchlist.append({'sublanguageid' :",".join(item['3let_language']), 'moviehash' :hash, 'moviebytesize':str(size) - }) + }) except: pass diff --git a/service.subtitles.opensubtitles/service.py b/service.subtitles.opensubtitles/service.py index e237539..5dfa45d 100644 --- a/service.subtitles.opensubtitles/service.py +++ b/service.subtitles.opensubtitles/service.py @@ -3,6 +3,7 @@ import os import sys import xbmc +import shutil import urllib import xbmcvfs import xbmcaddon @@ -20,72 +21,42 @@ __profile__ = xbmc.translatePath( __addon__.getAddonInfo('profile') ).decode( __resource__ = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ) ).decode("utf-8") __temp__ = xbmc.translatePath( os.path.join( __profile__, 'temp') ).decode("utf-8") -if not xbmcvfs.exists(__temp__): - xbmcvfs.mkdirs(__temp__) +if xbmcvfs.exists(__temp__): + shutil.rmtree(__temp__) +xbmcvfs.mkdirs(__temp__) sys.path.append (__resource__) from OSUtilities import OSDBServer, log, hashFile, normalizeString def Search( item ): + search_data = [] try: search_data = OSDBServer().searchsubtitles(item) except: log( __name__, "failed to connect to service for subtitle search") xbmc.executebuiltin((u'Notification(%s,%s)' % (__scriptname__ , __language__(32001))).encode('utf-8')) return - subtitles_list = [] if search_data != None: + search_data.sort(key=lambda x: [not x['MatchedBy'] == 'moviehash',x['LanguageName']]) for item_data in search_data: - if item_data["ISO639"]: - lang_index=0 - for user_lang_id in item['3let_language']: - if user_lang_id == item_data["ISO639"]: - break - lang_index+=1 - if str(item_data["MatchedBy"]) == "moviehash": - sync = True - else: - sync = False - - subtitles_list.append({'lang_index' : lang_index, - 'filename' : item_data["SubFileName"], - 'link' : item_data["ZipDownloadLink"], - 'language_name' : item_data["LanguageName"], - 'language_flag' : item_data["ISO639"], - 'language_id' : item_data["SubLanguageID"], - 'ID' : item_data["IDSubtitleFile"], - 'rating' : str(int(round(float(item_data["SubRating"])/2))), - 'format' : item_data["SubFormat"], - 'sync' : sync, - 'hearing_imp' : int(item_data["SubHearingImpaired"]) != 0 - }) - - subtitles_list.sort(key=lambda x: [not x['sync'],x['language_name']]) - - if subtitles_list: - for it in subtitles_list: - listitem = xbmcgui.ListItem(label=it["language_name"], - label2=it["filename"], - iconImage=it["rating"], - thumbnailImage=it["language_flag"] + listitem = xbmcgui.ListItem(label = item_data["LanguageName"], + label2 = item_data["SubFileName"], + iconImage = str(int(round(float(item_data["SubRating"])/2))), + thumbnailImage = item_data["ISO639"] ) - if it["sync"]: - listitem.setProperty( "sync", "true" ) - else: - listitem.setProperty( "sync", "false" ) - - if it.get("hearing_imp", False): - listitem.setProperty( "hearing_imp", "true" ) - else: - listitem.setProperty( "hearing_imp", "false" ) - - url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s" % (__scriptid__, it["link"], -it["ID"],it["filename"]) + + listitem.setProperty( "sync", ("false", "true")[str(item_data["MatchedBy"]) == "moviehash"] ) + listitem.setProperty( "hearing_imp", ("false", "true")[int(item_data["SubHearingImpaired"]) != 0] ) - xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listitem,isFolder=False) + url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s" % (__scriptid__, + item_data["ZipDownloadLink"], + item_data["IDSubtitleFile"], + item_data["SubFileName"] + ) + xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listitem,isFolder=False) def Download(id,url,filename, stack=False): subtitle_list = [] @@ -94,7 +65,7 @@ def Download(id,url,filename, stack=False): ## you can only retreive multiple subs in zip result = False else: - subtitle = os.path.join(__temp__,filename) + subtitle = os.path.join(__temp__,filename.decode("utf-8")) try: result = OSDBServer().download(id, subtitle) except: @@ -119,7 +90,6 @@ def Download(id,url,filename, stack=False): if xbmcvfs.exists(subtitle_list[0]): return subtitle_list - def get_params(string=""): param=[] if string == "": ----------------------------------------------------------------------- Summary of changes: service.subtitles.opensubtitles/addon.xml | 4 +- service.subtitles.opensubtitles/changelog.txt | 5 ++ .../resources/lib/OSUtilities.py | 5 +- service.subtitles.opensubtitles/service.py | 70 ++++++-------------- 4 files changed, 30 insertions(+), 54 deletions(-) hooks/post-receive -- Scripts ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Xbmc-addons mailing list Xbmc-addons@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xbmc-addons