def correctName(self, check_name, movie_name): check_names = [check_name] # Match names between " try: check_names.append(re.search(r'([\'"])[^\1]*\1', check_name).group(0)) except: pass # Match longest name between [] try: check_names.append(max(re.findall(r'[^[]*\[([^]]*)\]', check_name), key = len).strip()) except: pass for check_name in removeDuplicate(check_names): check_movie = fireEvent('scanner.name_year', check_name, single = True) try: check_words = removeEmpty(re.split('\W+', check_movie.get('name', ''))) movie_words = removeEmpty(re.split('\W+', simplifyString(movie_name))) if len(check_words) > 0 and len(movie_words) > 0 and len(list(set(check_words) - set(movie_words))) == 0: return True except: pass return False
def getWatchlist(self): enablers = [tryInt(x) for x in splitString(self.conf('automation_urls_use'))] urls = splitString(self.conf('automation_urls')) index = -1 movies = [] for username in urls: index += 1 if not enablers[index]: continue soup = BeautifulSoup(self.getHTMLData(self.url % username)) for movie in soup.find_all('a', attrs = {'class': 'frame'}): match = removeEmpty(self.pattern.split(movie['title'])) movies.append({'title': match[0], 'year': match[1] }) return movies
def getWatchlist(self): enablers = [ tryInt(x) for x in splitString(self.conf('automation_urls_use')) ] urls = splitString(self.conf('automation_urls')) index = -1 movies = [] for username in urls: index += 1 if not enablers[index]: continue soup = BeautifulSoup(self.getHTMLData(self.url % username)) for movie in soup.find_all('a', attrs={'class': 'frame'}): match = removeEmpty(self.pattern.split(movie['title'])) movies.append({'title': match[0], 'year': match[1]}) return movies