The branch, gotham has been updated via f2cf0c377e08b801e64c605eda262e96444b65dc (commit) from 97850c2c52e9278b7264dfddae055366eb725c1d (commit)
- Log ----------------------------------------------------------------- http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=f2cf0c377e08b801e64c605eda262e96444b65dc commit f2cf0c377e08b801e64c605eda262e96444b65dc Author: amet <amet.nos...@gmail.com> Date: Mon Apr 14 11:13:18 2014 +0400 [service.subtitles.opensubtitles] -v5.0.7 5.0.7 - fix: Do not use unsafe file names, thx Cesar Canassa diff --git a/service.subtitles.opensubtitles/addon.xml b/service.subtitles.opensubtitles/addon.xml index bf45b35..54ba2a9 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.6" + version="5.0.7" provider-name="amet"> <requires> <import addon="xbmc.python" version="2.1.0"/> diff --git a/service.subtitles.opensubtitles/changelog.txt b/service.subtitles.opensubtitles/changelog.txt index 767414e..5dc8a9f 100644 --- a/service.subtitles.opensubtitles/changelog.txt +++ b/service.subtitles.opensubtitles/changelog.txt @@ -1,3 +1,6 @@ +5.0.7 +- fix: Do not use unsafe file names, thx Cesar Canassa + 5.0.6 - clean temp folder - add login details to addon settings diff --git a/service.subtitles.opensubtitles/service.py b/service.subtitles.opensubtitles/service.py index 5dfa45d..2c55834 100644 --- a/service.subtitles.opensubtitles/service.py +++ b/service.subtitles.opensubtitles/service.py @@ -1,13 +1,14 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- import os -import sys -import xbmc import shutil +import sys import urllib -import xbmcvfs +import xbmc import xbmcaddon import xbmcgui,xbmcplugin +import xbmcvfs +import uuid __addon__ = xbmcaddon.Addon() __author__ = __addon__.getAddonInfo('author') @@ -49,7 +50,7 @@ def Search( item ): listitem.setProperty( "sync", ("false", "true")[str(item_data["MatchedBy"]) == "moviehash"] ) listitem.setProperty( "hearing_imp", ("false", "true")[int(item_data["SubHearingImpaired"]) != 0] ) - + url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s" % (__scriptid__, item_data["ZipDownloadLink"], item_data["IDSubtitleFile"], @@ -58,14 +59,15 @@ def Search( item ): xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listitem,isFolder=False) -def Download(id,url,filename, stack=False): + +def Download(id,url, stack=False): subtitle_list = [] exts = [".srt", ".sub", ".txt", ".smi", ".ssa", ".ass" ] if stack: ## we only want XMLRPC download if movie is not in stack, ## you can only retreive multiple subs in zip result = False else: - subtitle = os.path.join(__temp__,filename.decode("utf-8")) + subtitle = os.path.join(__temp__, str(uuid.uuid4())) try: result = OSDBServer().download(id, subtitle) except: @@ -86,16 +88,16 @@ def Download(id,url,filename, stack=False): subtitle_list.append(file) else: subtitle_list.append(subtitle) - + if xbmcvfs.exists(subtitle_list[0]): return subtitle_list - + def get_params(string=""): param=[] if string == "": paramstring=sys.argv[2] else: - paramstring=string + paramstring=string if len(paramstring)>=2: params=paramstring cleanedparams=params.replace('?','') @@ -108,7 +110,7 @@ def get_params(string=""): splitparams=pairsofparams[i].split('=') if (len(splitparams))==2: param[splitparams[0]]=splitparams[1] - + return param params = get_params() @@ -126,29 +128,29 @@ if params['action'] == 'search' or params['action'] == 'manualsearch': item['title'] = normalizeString(xbmc.getInfoLabel("VideoPlayer.OriginalTitle"))# try to get original title item['file_original_path'] = urllib.unquote(xbmc.Player().getPlayingFile().decode('utf-8'))# Full path of a playing file item['3let_language'] = [] #['scc','eng'] - + if 'searchstring' in params: item['mansearch'] = True - item['mansearchstr'] = params['searchstring'] - + item['mansearchstr'] = params['searchstring'] + for lang in urllib.unquote(params['languages']).decode('utf-8').split(","): if lang == "Portuguese (Brazil)": lan = "pob" - else: + else: lan = xbmc.convertLanguage(lang,xbmc.ISO_639_2) if lan == "gre": lan = "ell" item['3let_language'].append(lan) - + if item['title'] == "": log( __name__, "VideoPlayer.OriginalTitle not found") item['title'] = normalizeString(xbmc.getInfoLabel("VideoPlayer.Title")) # no original title, get just Title - + if item['episode'].lower().find("s") > -1: # Check if season is "Special" item['season'] = "0" # item['episode'] = item['episode'][-1:] - + if ( item['file_original_path'].find("http") > -1 ): item['temp'] = True @@ -159,24 +161,14 @@ if params['action'] == 'search' or params['action'] == 'manualsearch': elif ( item['file_original_path'].find("stack://") > -1 ): stackPath = item['file_original_path'].split(" , ") item['file_original_path'] = stackPath[0][8:] - - Search(item) + + Search(item) elif params['action'] == 'download': - subs = Download(params["ID"],params["link"],params["filename"]) + subs = Download(params["ID"], params["link"]) for sub in subs: listitem = xbmcgui.ListItem(label=sub) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=sub,listitem=listitem,isFolder=False) - - + + xbmcplugin.endOfDirectory(int(sys.argv[1])) - - - - - - - - - - ----------------------------------------------------------------------- Summary of changes: service.subtitles.opensubtitles/addon.xml | 2 +- service.subtitles.opensubtitles/changelog.txt | 3 + service.subtitles.opensubtitles/service.py | 58 +++++++++++-------------- 3 files changed, 29 insertions(+), 34 deletions(-) hooks/post-receive -- Scripts ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Xbmc-addons mailing list Xbmc-addons@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xbmc-addons