本文整理汇总了Python中xbmc.getCleanMovieTitle函数的典型用法代码示例。如果您正苦于以下问题:Python getCleanMovieTitle函数的具体用法?Python getCleanMovieTitle怎么用?Python getCleanMovieTitle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCleanMovieTitle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search_subtitles
def search_subtitles( file_original_path, title, tvshow, year, season, episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
subtitles_list = []
msg = ""
searchstring_notclean = ""
searchstring = ""
global israr
israr = os.path.abspath(file_original_path)
israr = os.path.split(israr)
israr = israr[0].split(os.sep)
israr = string.split(israr[-1], '.')
israr = string.lower(israr[-1])
if len(tvshow) == 0:
if 'rar' in israr and searchstring is not None:
if 'cd1' in string.lower(title) or 'cd2' in string.lower(title) or 'cd3' in string.lower(title):
dirsearch = os.path.abspath(file_original_path)
dirsearch = os.path.split(dirsearch)
dirsearch = dirsearch[0].split(os.sep)
if len(dirsearch) > 1:
searchstring_notclean = dirsearch[-3]
searchstring = xbmc.getCleanMovieTitle(dirsearch[-3])
searchstring = searchstring[0]
else:
searchstring = title
else:
searchstring = title
elif 'cd1' in string.lower(title) or 'cd2' in string.lower(title) or 'cd3' in string.lower(title):
dirsearch = os.path.abspath(file_original_path)
dirsearch = os.path.split(dirsearch)
dirsearch = dirsearch[0].split(os.sep)
if len(dirsearch) > 1:
searchstring_notclean = dirsearch[-2]
searchstring = xbmc.getCleanMovieTitle(dirsearch[-2])
searchstring = searchstring[0]
else:
#We are at the root of the drive!!! so there's no dir to lookup only file#
title = os.path.split(file_original_path)
searchstring = title[-1]
else:
if title == "":
title = os.path.split(file_original_path)
searchstring = title[-1]
else:
searchstring = title
if len(tvshow) > 0:
searchstring = "%s S%#02dE%#02d" % (tvshow, int(season), int(episode))
log( __name__ ,"%s Search string = %s" % (debug_pretext, searchstring))
hasLang = languageTranslate(lang1,0,2) + " " + languageTranslate(lang2,0,2) + " " + languageTranslate(lang3,0,2)
if re.search('pt', hasLang) or re.search('en', hasLang) or re.search('es', hasLang) or re.search('pb', hasLang):
msgnote(debug_pretext,__language__(30153), 6000)
getallsubs(searchstring, languageTranslate(lang1,0,2), lang1, file_original_path, subtitles_list, searchstring_notclean)
getallsubs(searchstring, languageTranslate(lang2,0,2), lang2, file_original_path, subtitles_list, searchstring_notclean)
getallsubs(searchstring, languageTranslate(lang3,0,2), lang3, file_original_path, subtitles_list, searchstring_notclean)
else:
msg = "Won't work, LegendasDivx.com is only for PT, PTBR, ES or EN subtitles."
return subtitles_list, "", msg #standard output
开发者ID:SMALLplayer,项目名称:smallplayer-image-creator,代码行数:60,代码来源:service.py
示例2: search_subtitles
def search_subtitles( file_original_path, title, tvshow, year, season, episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
subtitles_list = []
msg = ""
searchstring_notclean = ""
searchstring = ""
global israr
israr = os.path.abspath(file_original_path)
israr = os.path.split(israr)
israr = israr[0].split(os.sep)
israr = string.split(israr[-1], '.')
israr = string.lower(israr[-1])
if len(tvshow) == 0:
if 'rar' in israr and searchstring is not None:
if 'cd1' in string.lower(title) or 'cd2' in string.lower(title) or 'cd3' in string.lower(title):
dirsearch = os.path.abspath(file_original_path)
dirsearch = os.path.split(dirsearch)
dirsearch = dirsearch[0].split(os.sep)
if len(dirsearch) > 1:
searchstring_notclean = dirsearch[-3]
searchstring = xbmc.getCleanMovieTitle(dirsearch[-3])
searchstring = searchstring[0]
else:
searchstring = title
else:
searchstring = title
elif 'cd1' in string.lower(title) or 'cd2' in string.lower(title) or 'cd3' in string.lower(title):
dirsearch = os.path.abspath(file_original_path)
dirsearch = os.path.split(dirsearch)
dirsearch = dirsearch[0].split(os.sep)
if len(dirsearch) > 1:
searchstring_notclean = dirsearch[-2]
searchstring = xbmc.getCleanMovieTitle(dirsearch[-2])
searchstring = searchstring[0]
else:
#We are at the root of the drive!!! so there's no dir to lookup only file#
title = os.path.split(file_original_path)
searchstring = title[-1]
else:
if title == "":
title = os.path.split(file_original_path)
searchstring = title[-1]
else:
searchstring = title
if len(tvshow) > 0:
searchstring = "%s S%#02dE%#02d" % (tvshow, int(season), int(episode))
log( __name__ ,"%s Search string = %s" % (debug_pretext, searchstring))
portuguese = 0
if string.lower(lang1) == "portuguese": portuguese = 1
elif string.lower(lang2) == "portuguese": portuguese = 2
elif string.lower(lang3) == "portuguese": portuguese = 3
getallsubs(searchstring, "pt", "Portuguese", file_original_path, subtitles_list, searchstring_notclean)
if portuguese == 0:
msg = "Won't work, LegendasDivx is only for Portuguese subtitles!"
return subtitles_list, "", msg #standard output
开发者ID:SMALLplayer,项目名称:smallplayer-image-creator,代码行数:60,代码来源:service.py
示例3: search_filename
def search_filename(filename, languages):
title, year = xbmc.getCleanMovieTitle(filename)
log(__name__, "clean title: \"%s\" (%s)" % (title, year))
try:
yearval = int(year)
except ValueError:
yearval = 0
if title and yearval > 1900:
search_string = title + "+" + year
search_argenteam_api(search_string)
else:
match = re.search(
r'\WS(?P<season>\d\d)E(?P<episode>\d\d)',
title,
flags=re.IGNORECASE
)
if match is not None:
tvshow = string.strip(title[:match.start('season')-1])
season = string.lstrip(match.group('season'), '0')
episode = string.lstrip(match.group('episode'), '0')
search_string = "%s S%#02dE%#02d" % (
tvshow,
int(season),
int(episode)
)
search_argenteam_api(search_string)
else:
search_argenteam_api(filename)
开发者ID:estemendoza,项目名称:service.subtitles.argenteam,代码行数:28,代码来源:service.py
示例4: searchsubtitles
def searchsubtitles( self, item):
if ( self.osdb_token ) :
searchlist = []
if len(item['tvshow']) > 0:
OS_search_string = ("%s S%.2dE%.2d" % (item['tvshow'],
int(item['season']),
int(item['episode']),)
).replace(" ","+")
else:
if str(item['year']) == "":
item['title'], item['year'] = xbmc.getCleanMovieTitle( item['title'] )
OS_search_string = item['title'].replace(" ","+")
log( __name__ , "Search String [ %s ]" % (OS_search_string,))
if not item['temp']:
try:
size, hash = hashFile(item['file_original_path'], item['rar'])
log( __name__ ,"OpenSubtitles module hash [%s] and size [%s]" % (hash, size,))
searchlist.append({'sublanguageid' :",".join(item['3let_language']),
'moviehash' :hash,
'moviebytesize':str(size)
})
except:
pass
searchlist.append({'sublanguageid':",".join(item['3let_language']),
'query' :OS_search_string
})
search = self.server.SearchSubtitles( self.osdb_token, searchlist )
if search["data"]:
return search["data"]
开发者ID:BTeodor,项目名称:service.subtitles.subsro,代码行数:32,代码来源:OSUtilities.py
示例5: searchsubtitles
def searchsubtitles( self, item):
if ( self.osdb_token ) :
searchlist = []
if item['mansearch']:
searchlist = [{'sublanguageid':",".join(item['3let_language']),
'query' :urllib.unquote(item['mansearchstr'])
}]
search = self.server.SearchSubtitles( self.osdb_token, searchlist )
if search["data"]:
return search["data"]
else:
return None
if len(item['tvshow']) > 0:
OS_search_string = ("%s S%.2dE%.2d" % (item['tvshow'],
int(item['season']),
int(item['episode']),)
).replace(" ","+")
else:
if str(item['year']) == "" and xbmc.Player().isPlaying():
item['title'], item['year'] = xbmc.getCleanMovieTitle( item['title'] )
OS_search_string = item['title'].replace(" ","+")
log( __name__ , "Search String [ %s ]" % (OS_search_string,))
if not item['temp']:
try:
size, hash = hashFile(item['file_original_path'], item['rar'])
log( __name__ ,"OpenSubtitles module hash [%s] and size [%s]" % (hash, size,))
searchlist.append({'sublanguageid' :",".join(item['3let_language']),
'moviehash' :hash,
'moviebytesize':str(size)
})
except:
pass
if xbmc.Player().isPlaying():
imdb = str(xbmc.Player().getVideoInfoTag().getIMDBNumber().replace('tt',''))
else:
imdb = str(xbmc.getInfoLabel("ListItem.IMDBNumber").replace('tt',''))
if ((not item['tvshow']) and imdb != ""):
searchlist.append({'sublanguageid' :",".join(item['3let_language']),
'imdbid' :imdb
})
searchlist.append({'sublanguageid':",".join(item['3let_language']),
'query' :OS_search_string
})
else:
searchlist = [{'sublanguageid':",".join(item['3let_language']),
'query' :OS_search_string
}]
search = self.server.SearchSubtitles( self.osdb_token, searchlist )
if search["data"]:
return search["data"]
开发者ID:amadu80,项目名称:repository.xvbmc,代码行数:60,代码来源:OSUtilities.py
示例6: search_filename
def search_filename(filename, languages):
title, year = xbmc.getCleanMovieTitle(filename)
log(__name__, "clean title: \"%s\" (%s)" % (title, year))
try:
yearval = int(year)
except ValueError:
yearval = 0
if title and yearval > 1900:
query_Film(title, year, item['3let_language'], filename)
开发者ID:NEOhidra,项目名称:service.subtitles.nlondertitels,代码行数:9,代码来源:service.py
示例7: search_movie
def search_movie(title, year, languages, filename):
title = string.strip(title)
log(__name__, "Search movie = %s" % title)
res = search_manual(title, languages, filename)
for result in res:
rtitle, ryear = xbmc.getCleanMovieTitle(result['filename'])
rtitle, ryear = rtitle.strip().lower(), ryear.strip().lower()
log(__name__, "Got cleaned movie result of %s (%s) '%s'" % (rtitle, ryear, result['filename']))
if (rtitle, ryear) == (title, year):
yield result
开发者ID:djay,项目名称:service.subtitles.thaisubtitle,代码行数:11,代码来源:service.py
示例8: keyboard
def keyboard(self, parent):
dir, self.year = xbmc.getCleanMovieTitle(os.path.split(os.path.split(self.file_original_path)[0])[1])
if self.rar:
tmp_dir = os.path.split(os.path.split(os.path.split(self.file_original_path)[0])[0])[1]
dir, self.year = xbmc.getCleanMovieTitle( tmp_dir )
if not parent:
kb = xbmc.Keyboard("%s ()" % (dir,), _( 751 ), False)
text = self.file_name
kb.doModal()
if (kb.isConfirmed()): text, self.year = xbmc.getCleanMovieTitle(kb.getText())
self.title = text
else:
self.title = dir
log( __name__ ,"Manual/Keyboard Entry: Title:[%s], Year: [%s]" % (self.title, self.year,))
if self.year != "" :
self.file_name = "%s (%s)" % (self.file_name, str(self.year),)
else:
self.file_name = self.title
self.tvshow = ""
self.Search_Subtitles()
开发者ID:Saviq,项目名称:script.xbmc.subtitles,代码行数:21,代码来源:gui.py
示例9: searchsubtitles
def searchsubtitles(self, item):
#print ("searchsubtitles 1")
if item['mansearch']:
searchParams = {'m' : urllib.unquote(item['mansearchstr']),
'l' : '0',
'c' : '',
'y' : '0',
'a' : '',
'd' : '',
'u' : '',
'g' : '',
't' : 'Submit'}
print ("manual search: %s" % searchParams)
elif len(item['tvshow']) > 0:
searchParams = {'m' : ("%s %.2dx%.2d" % (item['tvshow'],
int(item['season']),
int(item['episode']))),
'l' : '0',
'c' : '',
'y' : '0',
'a' : '',
'd' : '',
'u' : '',
'g' : '',
't' : 'Submit'}
print ("tvshow search: %s" % searchParams)
else:
if str(item['year']) == "":
item['title'], item['year'] = xbmc.getCleanMovieTitle(item['title'])
if str(item['year']) == "":
item['year'] = '0'
searchParams = {'m' : item['title'],
'l' : '0',
'c' : '',
'y' : '0',
'a' : '',
'd' : '',
'u' : '',
'g' : '',
't' : 'Submit'}
print ("title search: %s" % searchParams)
log( __name__ , "Search Parameters [ %s ]" % (str(searchParams)))
result = self.handleSearch(searchParams)
return result
开发者ID:kgkolev,项目名称:service.subtitles.subsunacs,代码行数:49,代码来源:OSUtilities.py
示例10: keyboard
def keyboard(self, parent):
dir, self.year = xbmc.getCleanMovieTitle(self.file_original_path, self.parsearch)
if not parent:
if self.man_search_str != "":
srchstr = self.man_search_str
else:
srchstr = "%s (%s)" % (dir,self.year,)
kb = xbmc.Keyboard(srchstr, _( 751 ), False)
text = self.file_name
kb.doModal()
if (kb.isConfirmed()): text, self.year = xbmc.getCleanMovieTitle(kb.getText())
self.title = text
self.man_search_str = text
else:
self.title = dir
log( __name__ ,"Manual/Keyboard Entry: Title:[%s], Year: [%s]" % (self.title, self.year,))
if self.year != "" :
self.file_name = "%s (%s)" % (self.file_name, str(self.year),)
else:
self.file_name = self.title
self.tvshow = ""
self.next = list(self.service_list)
self.Search_Subtitles()
开发者ID:yurybubnov,项目名称:script.fansubs.subtitles,代码行数:24,代码来源:gui.py
示例11: build_search_string
def build_search_string(item):
if item['mansearch']:
search_string = urllib.unquote(item['mansearchstr'])
elif len(item['tvshow']) > 0:
search_string = ("%s S%.2dE%.2d" % (item['tvshow'],
int(item['season']),
int(item['episode']),)
).replace(" ","+")
else:
if str(item['year']) == "":
item['title'], item['year'] = xbmc.getCleanMovieTitle( item['title'] )
search_string = item['title'].replace(" ","+")
log( __name__ , "Search String [ %s ]" % (search_string,))
return search_string
开发者ID:BDvirus,项目名称:service.subtitles.torec,代码行数:16,代码来源:SubtitleHelper.py
示例12: clean_movie_title
def clean_movie_title(item, use_dir):
debuglog("getCleanMovieTitle: %s" % use_dir)
infos = xbmc.getCleanMovieTitle(item['file_original_path'], use_dir)
if not 'year' in item or not item['year']:
item['year'] = infos[1]
title_pattern = r'^(?P<title>.+)S(?P<season>\d+)E(?P<episode>\d+).*$'
title_match = re.search(title_pattern, infos[0], re.IGNORECASE)
if title_match:
item['tvshow'] = title_match.group('title').strip()
item['season'] = title_match.group('season')
item['episode'] = title_match.group('episode')
return infos, (title_match is not None)
开发者ID:noba3,项目名称:KoTos,代码行数:16,代码来源:service.py
示例13: search_filename
def search_filename(filename, languages):
title, year = xbmc.getCleanMovieTitle(filename)
log(__name__, "clean title: \"%s\" (%s)" % (title, year))
try:
yearval = int(year)
except ValueError:
yearval = 0
match = re.search(r'\WS(?P<season>\d\d)E(?P<episode>\d\d)', filename, flags=re.IGNORECASE)
if match is not None:
tvshow = string.strip(title[:match.start('season') - 1])
season = string.lstrip(match.group('season'), '0')
episode = string.lstrip(match.group('episode'), '0')
search_tvshow(tvshow, season, episode, languages, filename)
elif title and yearval > 1900:
search_movie(title, year, languages, filename)
else:
search_manual(filename, languages, filename)
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:17,代码来源:service.py
示例14: Search
def Search( item ):
convertASS = (__addon__.getSetting("convertASS") == "true")
xbmc.log("Search GomTV with a file name, "+item['file_original_path'].encode('cp949', 'ignore'), level=xbmc.LOGDEBUG)
video_hash = hashFileMD5( item['file_original_path'], buff_size=1024*1024 )
if video_hash is None:
xbmc.log(u"Fail to access movie flie, "+item['file_original_path'].encode('cp949', 'ignore'), level=xbmc.LOGERROR)
return
q_url = "http://gom.gomtv.com/jmdb/search.html?key=%s" %video_hash
subtitles_list = SearchSubtitles( q_url )
if not subtitles_list:
xbmc.log("No result with hash, "+video_hash, level=xbmc.LOGNOTICE)
if item['tvshow']:
search_string = ("%s S%.2dE%.2d" %
(item['tvshow'], int(item['season']), int(item['episode']))).replace(" ","+")
else:
if str(item['year']) == "":
item['title'], item['year'] = xbmc.getCleanMovieTitle( item['title'] )
# use English title if available
query = ENG_TITLE_PTN.match(item['title'])
srch_title = query.group(2).strip() if query else item['title']
search_string = srch_title.replace(" ","+")
q_url = "http://gom.gomtv.com/main/index.html?ch=subtitles&pt=l&menu=subtitles&lang=0&sValue=%s" %search_string
subtitles_list = SearchSubtitles( q_url )
xbmc.log("Found %d subtitles in GomTV" %len(subtitles_list), level=xbmc.LOGINFO)
for sub in subtitles_list:
listitem = xbmcgui.ListItem(
label=sub['language_name'],
label2=sub['filename'],
iconImage=sub['rating'],
thumbnailImage=sub['language_flag'],
)
listitem.setProperty("sync", 'true' if sub["sync"] else 'false')
listitem.setProperty("hearing_imp", 'true' if sub.get("hearing_imp", False) else 'false')
url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s&format=%s" % (__scriptid__,
urllib.quote(sub["link"]),
sub["ID"],
sub["filename"],
'ass' if convertASS else sub["format"]
)
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False)
开发者ID:fuex80,项目名称:xbmc-korean,代码行数:46,代码来源:service.py
示例15: search_subtitles
def search_subtitles( file_original_path, title, tvshow, year, season, episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
ok = False
msg = ""
hash_search = False
osdb_server = OSDBServer()
subtitles_list = []
if len(tvshow) > 0: # TvShow
OS_search_string = ("%s S%.2dE%.2d" % (tvshow, int(season), int(episode),)).replace(" ","+")
else: # Movie or not in Library
if str(year) == "": # Not in Library
title, year = xbmc.getCleanMovieTitle( title )
else: # Movie in Library
year = year
title = title
OS_search_string = title.replace(" ","+")
log( __name__ , "Search String [ %s ]" % (OS_search_string,))
if set_temp :
hash_search = False
file_size = "000000000"
hashTry = "000000000000"
else:
try:
try:
file_size, hashTry = xbmc.subHashAndFileSize(file_original_path)
log( __name__ ,"xbmc module hash and size")
except:
hashTry = timeout(set_filehash, args=(file_original_path, rar), timeout_duration=5)
file_size = str(os.path.getsize( file_original_path ))
hash_search = True
except:
file_size = ""
hashTry = ""
hash_search = False
log( __name__ ,"File Size [%s]" % file_size)
log( __name__ ,"File Hash [%s]" % hashTry)
log( __name__ ,"Search by hash and name %s" % (os.path.basename( file_original_path ),))
subtitles_list, msg = osdb_server.searchsubtitles( OS_search_string, lang1, lang2, lang3, hash_search, hashTry, file_size )
return subtitles_list, "", msg #standard output
开发者ID:070499,项目名称:repo-scripts,代码行数:46,代码来源:service.py
示例16: search_filename
def search_filename(filename, languages):
title, year = xbmc.getCleanMovieTitle(filename)
log(__name__, 'clean title: "%s" (%s)' % (title, year))
try:
yearval = int(year)
except ValueError:
yearval = 0
if title and yearval > 1900:
query_Film(title, year, item["3let_language"], filename)
else:
match = re.search(r"\WS(?P<season>\d\d)E(?P<episode>\d\d)", title, flags=re.IGNORECASE)
if match is not None:
tvshow = string.strip(title[: match.start("season") - 1])
season = string.lstrip(match.group("season"), "0")
episode = string.lstrip(match.group("episode"), "0")
query_TvShow(tvshow, season, episode, item["3let_language"], filename)
else:
search_manual(filename, item["3let_language"], filename)
开发者ID:niceman4u,项目名称:service.subtitles.addic7ed,代码行数:18,代码来源:service.py
示例17: search
def search(self,item):
if item['mansearch']:
title = item['mansearchstr']
elif item['tvshow']:
title = "%s S%02dE%02d" % (self.normalize_input_title(item['tvshow']), int(item['season']), int(item['episode'])) # Searching TV Show
else: # Searching movie
title = item['title'] if item['year'] else xbmc.getCleanMovieTitle(item['title'])[0]
title = self.normalize_input_title(title)
log(__name__, "Search pattern: " + title)
found_subtitles = self.search_subtitle(title)
log(__name__, "Parsed subtitles: %s" % found_subtitles )
lang_filetred_found_subtitles = self.filter_subtitles_by_language(item['3let_language'], found_subtitles)
log(__name__, ["Language filter", lang_filetred_found_subtitles])
if not lang_filetred_found_subtitles: return results_with_stats(None, self.addon, title, item)
file_size = get_file_size(item['file_original_path'], item['rar'])
if not (file_size == -1): file_size = round(float(file_size)/(1024*1024),2)
log(__name__, "File size: %s" % file_size)
max_down_count = self.detect_max_download_stats(lang_filetred_found_subtitles)
result_subtitles = []
for found_subtitle in lang_filetred_found_subtitles:
print_out_filename = (found_subtitle['version'], found_subtitle['title'])[found_subtitle['version'] == '' or found_subtitle['version'] == None]
if not found_subtitle['author'] == None: print_out_filename += " by " + found_subtitle['author']
result_subtitles.append({
'filename': HTMLParser.HTMLParser().unescape(print_out_filename),
'id': found_subtitle['id'],
'lang': found_subtitle['lang'],
'rating': str(found_subtitle['down_count']*5/max_down_count) if max_down_count > 0 else "0",
'sync': (found_subtitle['size'] == file_size and file_size > 0),
'lang_flag': xbmc.convertLanguage(found_subtitle['lang'],xbmc.ISO_639_1),
})
log(__name__,["Search result", result_subtitles])
return results_with_stats(result_subtitles, self.addon, title, item)
开发者ID:beam,项目名称:service.subtitles.titulky.com,代码行数:41,代码来源:TitulkyClient.py
示例18: search_subtitles
def search_subtitles( file_original_path, title, tvshow, year, season, episode, set_temp, rar, lang1, lang2, lang3, stack ): #standard input
ok = False
msg = ""
hash_search = False
subtitles_list = []
if len(tvshow) > 0: # TvShow
OS_search_string = ("%s S%.2dE%.2d" % (tvshow,
int(season),
int(episode),)
).replace(" ","+")
else: # Movie or not in Library
if str(year) == "": # Not in Library
title, year = xbmc.getCleanMovieTitle( title )
else: # Movie in Library
year = year
title = title
OS_search_string = title.replace(" ","+")
log( __name__ , "Search String [ %s ]" % (OS_search_string,))
if set_temp :
hash_search = False
file_size = "000000000"
SubHash = "000000000000"
else:
try:
file_size, SubHash = hashFile(file_original_path, rar)
log( __name__ ,"xbmc module hash and size")
hash_search = True
except:
file_size = ""
SubHash = ""
hash_search = False
if file_size != "" and SubHash != "":
log( __name__ ,"File Size [%s]" % file_size )
log( __name__ ,"File Hash [%s]" % SubHash)
log( __name__ ,"Search by hash and name %s" % (os.path.basename( file_original_path ),))
subtitles_list, msg = OSDBServer().searchsubtitles( OS_search_string, lang1, lang2, lang3, hash_search, SubHash, file_size )
return subtitles_list, "", msg #standard output
开发者ID:CaTzil,项目名称:XBMC-1,代码行数:41,代码来源:service.py
示例19: search
def search(item):
res = []
filename = os.path.splitext(os.path.basename(item['file_original_path']))[0]
log(__name__, "Search_thaisubtitle='%s', filename='%s', addon_version=%s" % (item, filename, __version__))
if item['mansearch']:
res = search_manual(item['mansearchstr'], item['3let_language'], filename)
return append_subtitles(res)
elif item['tvshow']:
res = search_tvshow(item['tvshow'], item['season'], item['episode'], item['3let_language'], filename)
if res:
return append_subtitles(res)
elif item['title'] and item['year']:
res = search_manual(item['title'], item['3let_language'], filename, )
if res:
return append_subtitles(res)
title, year = xbmc.getCleanMovieTitle(filename)
log(__name__, "clean title: \"%s\" (%s)" % (title, year))
try:
yearval = int(year)
except ValueError:
yearval = 0
if title and yearval > 1900:
res = search_movie(title, year, item['3let_language'], filename)
if res:
return append_subtitles(res)
match = re.search(r'\WS(?P<season>\d\d)E(?P<episode>\d\d)', title, flags=re.IGNORECASE)
if match is not None:
tvshow = string.strip(title[:match.start('season')-1])
season = string.lstrip(match.group('season'), '0')
episode = string.lstrip(match.group('episode'), '0')
res = search_tvshow(tvshow, season, episode, item['3let_language'], filename)
if res:
return append_subtitles(res)
# last fall back
if len(filename) < 30:
res = search_manual(filename, item['3let_language'], filename)
if res:
return append_subtitles(res)
return []
开发者ID:djay,项目名称:service.subtitles.thaisubtitle,代码行数:41,代码来源:service.py
示例20: Search
def Search(item):
it = []
_item = dict(item)
it.append(item)
_item['title'], _item['year'] = xbmc.getCleanMovieTitle( item['title'] )
it.append(_item)
sub_data = read_sub(*it)
#### Do whats needed to get the list of subtitles from service site
#### use item["some_property"] that was set earlier
#### once done, set xbmcgui.ListItem() below and pass it to xbmcplugin.addDirectoryItem()
if sub_data != None:
log_my(sub_data)
for it in sub_data:
listitem = xbmcgui.ListItem(label="Bulgarian", # language name for the found subtitle
label2=get_info(it), # file name for the found subtitle
iconImage=str(int(round(float(it['rating'])))), # rating for the subtitle, string 0-5
thumbnailImage="bg" # language flag, ISO_639_1 language + gif extention, e.g - "en.gif"
)
listitem.setProperty( "sync", '{0}'.format("false").lower() ) # set to "true" if subtitle is matched by hash,
# indicates that sub is 100 Comaptible
listitem.setProperty( "hearing_imp", '{0}'.format("false").lower() ) # set to "true" if subtitle is for hearing impared
## below arguments are optional, it can be used to pass any info needed in download function
## anything after "action=download&" will be sent to addon once user clicks listed subtitle to downlaod
url = "plugin://%s/?action=download&link=%s&ID=%s&filename=%s" % (__scriptid__,
it['url'],
it['id'],
"filename of the subtitle")
## add it to list, this can be done as many times as needed for all subtitles found
xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=listitem,isFolder=False)
Notify('Server', 'ok')
else:
Notify('Server', 'error')
开发者ID:promusic1974,项目名称:service.subtitles.unacs,代码行数:38,代码来源:service.py
注:本文中的xbmc.getCleanMovieTitle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论