def matched(self): if not self._matched_result: # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = [copy.copy(node.guess) for node in self.nodes() if node.guess] # 1- try to merge similar information together and give it a higher # confidence for int_part in ('year', 'season', 'episodeNumber'): merge_similar_guesses(parts, int_part, choose_int) for string_part in ('title', 'series', 'container', 'format', 'releaseGroup', 'website', 'audioCodec', 'videoCodec', 'screenSize', 'episodeFormat', 'audioChannels', 'idNumber'): merge_similar_guesses(parts, string_part, choose_string) # 2- merge the rest, potentially discarding information not properly # merged before result = merge_all(parts, append=['language', 'subtitleLanguage', 'other']) log.debug('Final result: ' + result.nice_string()) self._matched_result = result return self._matched_result
def matched(self): # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = [node.guess for node in self.match_tree.nodes() if node.guess] parts = copy.deepcopy(parts) # 1- try to merge similar information together and give it a higher # confidence for int_part in ('year', 'season', 'episodeNumber'): merge_similar_guesses(parts, int_part, choose_int) for string_part in ('title', 'series', 'container', 'format', 'releaseGroup', 'website', 'audioCodec', 'videoCodec', 'screenSize', 'episodeFormat', 'audioChannels'): merge_similar_guesses(parts, string_part, choose_string) # 2- merge the rest, potentially discarding information not properly # merged before result = merge_all(parts, append=['language', 'subtitleLanguage', 'other']) log.debug('Final result: ' + result.nice_string()) return result
def matched(self): # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = [node.guess for node in self.nodes() if node.guess] parts = copy.deepcopy(parts) # 1- try to merge similar information together and give it a higher # confidence for int_part in ("year", "season", "episodeNumber"): merge_similar_guesses(parts, int_part, choose_int) for string_part in ( "title", "series", "container", "format", "releaseGroup", "website", "audioCodec", "videoCodec", "screenSize", "episodeFormat", "audioChannels", "idNumber", ): merge_similar_guesses(parts, string_part, choose_string) # 2- merge the rest, potentially discarding information not properly # merged before result = merge_all(parts, append=["language", "subtitleLanguage", "other"]) log.debug("Final result: " + result.nice_string()) return result
def matched(self): # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = copy.deepcopy(self.parts) # 1- start by doing some common preprocessing tasks # 1.1- ", the" at the end of a series title should be prepended to it for part in parts: if "series" not in part: continue series = part["series"] lseries = series.lower() if lseries[-4:] == ",the": part["series"] = "The " + series[:-4] if lseries[-5:] == ", the": part["series"] = "The " + series[:-5] # 2- try to merge similar information together and give it a higher confidence for int_part in ("year", "season", "episodeNumber"): merge_similar_guesses(parts, int_part, choose_int) for string_part in ( "title", "series", "container", "format", "releaseGroup", "website", "audioCodec", "videoCodec", "screenSize", "episodeFormat", ): merge_similar_guesses(parts, string_part, choose_string) result = merge_all(parts, append=["language", "subtitleLanguage", "other"]) # 3- some last minute post-processing if result["type"] == "episode" and "season" not in result and result.get("episodeFormat", "") == "Minisode": result["season"] = 0 log.debug("Final result: " + result.nice_string()) return result
def matched(self): # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = copy.deepcopy(self.parts) # 1- start by doing some common preprocessing tasks # 1.1- ", the" at the end of a series title should be prepended to it for part in parts: if 'series' not in part: continue series = part['series'] lseries = series.lower() if lseries[-4:] == ',the': part['series'] = 'The ' + series[:-4] if lseries[-5:] == ', the': part['series'] = 'The ' + series[:-5] # 2- try to merge similar information together and give it a higher confidence for int_part in ('year', 'season', 'episodeNumber'): merge_similar_guesses(parts, int_part, choose_int) for string_part in ('title', 'series', 'container', 'format', 'releaseGroup', 'website', 'audioCodec', 'videoCodec', 'screenSize', 'episodeFormat'): merge_similar_guesses(parts, string_part, choose_string) result = merge_all(parts, append = ['language', 'subtitleLanguage', 'other']) # 3- some last minute post-processing if (result['type'] == 'episode' and 'season' not in result and result.get('episodeFormat', '') == 'Minisode'): result['season'] = 0 log.debug('Final result: ' + result.nice_string()) return result
def matched(self): # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = [node.guess for node in self.match_tree.nodes() if node.guess] parts = copy.deepcopy(parts) # 1- try to merge similar information together and give it a higher # confidence for int_part in ('year', 'season', 'episodeNumber'): merge_similar_guesses(parts, int_part, choose_int) for string_part in ('title', 'series', 'container', 'format', 'releaseGroup', 'website', 'audioCodec', 'videoCodec', 'screenSize', 'episodeFormat'): merge_similar_guesses(parts, string_part, choose_string) result = merge_all(parts, append=['language', 'subtitleLanguage', 'other']) log.debug('Final result: ' + result.nice_string()) return result