def handle_quote_request(self): # TODO: an elegant function to handle quote loops subtitles = get_subtitle(self.movie) chain = guess_subtitle_chain(subtitles, self.req_dictionary) if isinstance(chain, list): self.chain = chain raise exceptions.ChainRequest if not self.multiple: logger.info("Trying multiple subs") quotes = get_complete_quote(subtitles, self.content) multiple_quote = len(quotes) > 1 pils = [] for q in quotes: split_quote = split_dialogue(q) if isinstance(split_quote, list): for short in split_quote: pils.append( get_final_frame(self.path, None, short, True, self.dar)) else: pils.append( get_final_frame( self.path, None, split_quote, multiple_quote, self.dar, )) self.pill = pils self.discriminator = self.movie["title"] + quotes[0]["message"] else: logger.info("Trying multiple subs") quote = find_quote(subtitles, self.content) split_quote = split_dialogue(quote) if isinstance(split_quote, list): pils = [] for short in split_quote: pils.append( get_final_frame(self.path, None, short, True, self.dar)) to_dupe = split_quote[0]["message"] self.pill = pils else: self.pill = [ get_final_frame(self.path, None, split_quote, self.multiple, self.dar) ] to_dupe = split_quote["message"] self.discriminator = self.movie["title"] + to_dupe handle_json(self.discriminator, self.req_dictionary["verified"])
def handle_chain_request(self): self.discriminator = self.movie["title"] + self.chain[0]["message"] pils = [] for q in self.chain: split_quote = split_dialogue(q) if isinstance(split_quote, list): for short in split_quote: pils.append(get_final_frame(self.path, None, short, True, self.dar)) else: pils.append( get_final_frame(self.path, None, split_quote, True, self.dar) ) self.pill = pils handle_json(self.discriminator, self.verified, self.on_demand)
def handle_minute_request(self): is_valid_timestamp_request(self.req_dictionary, self.movie) self.pill = [ get_final_frame(self.path, self.content, None, self.multiple, self.dar) ] self.discriminator = f"{self.query}{self.content}" handle_json(self.discriminator, self.req_dictionary["verified"])
def handle_minute_request(self): is_valid_timestamp_request(self.req_dictionary, self.movie) self.pill = [ get_final_frame( self.path, self.content, None, self.multiple if not self.legacy_palette else self.legacy_palette, self.dar, ) ] self.discriminator = f"{self.movie['title']}{self.content}" handle_json(self.get_discriminator(self.discriminator), self.verified)
def handle_quote_request(self): # TODO: an elegant function to handle quote loops subtitles = get_subtitle(self.movie) chain = guess_subtitle_chain(subtitles, self.req_dictionary) if isinstance(chain, list): self.chain = chain raise exceptions.ChainRequest if not self.multiple: logger.info("Trying multiple subs") try: quotes = get_complete_quote(subtitles, self.content) except IndexError: quotes = [find_quote(subtitles, self.content)] multiple_quote = len(quotes) > 1 pils = [] for q in quotes: split_quote = split_dialogue(q) if isinstance(split_quote, list): for short in split_quote: pils.append( get_final_frame(self.path, None, short, True, self.dar)) else: pils.append( get_final_frame( self.path, None, split_quote, multiple_quote, self.dar, )) self.pill = pils self.discriminator = self.movie["title"] + quotes[0]["message"] else: logger.info("Trying multiple subs") quote = find_quote(subtitles, self.content) # parallel key == list or None is_parallel_ = (self.req_dictionary["parallel"] is not None or self.legacy_palette) if is_parallel_: split_quote = quote self.quote = split_quote["message"] else: split_quote = split_dialogue(quote) if isinstance(split_quote, list): pils = [] for short in split_quote: pils.append( get_final_frame(self.path, None, short, True, self.dar)) to_dupe = split_quote[0]["message"] self.pill = pils else: self.pill = [ get_final_frame( self.path, None, split_quote, self.multiple, self.dar, is_parallel_, ) ] to_dupe = split_quote["message"] self.discriminator = self.movie["title"] + to_dupe handle_json(self.get_discriminator(self.discriminator), self.verified)