From 4b6948aca3967b7aa86e5f12fb88303c2ab8d185 Mon Sep 17 00:00:00 2001 From: Jeremy Hansen Date: Sun, 9 Aug 2026 20:06:04 -0700 Subject: [PATCH] Remove obsolete cinemagoer piculet parser function Newer cinemagoer versions removed the code allowing parsing imdb pages. This removes the attempt to parse imdb pages. --- sickchill/movies.py | 7 -- sickchill/show/recommendations/imdb.py | 9 --- sickchill/tv.py | 107 +------------------------ 3 files changed, 2 insertions(+), 121 deletions(-) diff --git a/sickchill/movies.py b/sickchill/movies.py index 0b7249efc..ed3c1072b 100644 --- a/sickchill/movies.py +++ b/sickchill/movies.py @@ -5,7 +5,6 @@ import threading import imdb import tmdbsimple -from imdb.parser.http.piculet import Path, Rule from sqlalchemy import create_engine from sqlalchemy.orm import Session from tmdbsimple import movies, search @@ -41,12 +40,6 @@ class MovieList: self.session: Session = db_cons[self.filename] self.imdb = imdb.IMDb() - try: - self.imdb.topBottomProxy.moviemeter100_parser.rules[0].extractor.rules.append( - Rule(key="cover url", extractor=Path('./td[@class="posterColumn"]/a/img/@src')) - ) - except: - pass def __iter__(self): for item in self.query.all(): diff --git a/sickchill/show/recommendations/imdb.py b/sickchill/show/recommendations/imdb.py index 485c2c292..bf31da2e6 100644 --- a/sickchill/show/recommendations/imdb.py +++ b/sickchill/show/recommendations/imdb.py @@ -2,7 +2,6 @@ import os import re import imdb -from imdb.parser.http.piculet import Path, Rule from sickchill import settings from sickchill.oldbeard import helpers @@ -13,14 +12,6 @@ class imdbPopular(object): """Gets a list of most popular TV series from imdb""" self.session = helpers.make_session() - self.imdb = imdb.IMDb() - try: - self.imdb.topBottomProxy.tvmeter100_parser.rules[0].extractor.rules.append( - Rule(key="cover url", extractor=Path('./td[@class="posterColumn"]/a/img/@src')) - ) - except Exception: - pass - def fetch_popular_shows(self): """Get popular show information from IMDB""" return self.imdb.get_popular100_tv() diff --git a/sickchill/tv.py b/sickchill/tv.py index 77f2727d0..124238b25 100644 --- a/sickchill/tv.py +++ b/sickchill/tv.py @@ -14,7 +14,6 @@ from weakref import WeakKeyDictionary from xml.etree import ElementTree import imdb -from imdb import Cinemagoer from unidecode import unidecode from urllib3.exceptions import MaxRetryError, NewConnectionError @@ -879,110 +878,8 @@ class TVShow(object): self.check_imdb_id() if not self.imdb_id: - # TODO: Load tvmaze/tvdb info into other imdb_info fields - # noinspection PyBroadException - try: - self.imdb_id = helpers.imdb_from_tvdbid_on_tvmaze(self.indexerid) - except Exception: - self.imdb_id = None - - try: - client = Cinemagoer() - - if self.name and not self.imdb_id: - logger.debug(f"{self.indexerid}: Trying to find the imdbID for {self.name}") - # Add regular name and custom name to be searched first - attempts = set() - # custom name first, then the name returned by thetvdb - for name in {self.custom_name, self.show_name}: - if name: - if self.startyear and not name.strip(")").endswith(f"{self.startyear}"): - # add name (year) first, as it is the most restrictive for matching - attempts.add(f"{name} ({self.startyear})".strip('" ')) - # then bare name, without year - attempts.add(name.strip('" ')) - - for attempt in attempts: - logger.debug(f"{self.indexerid}: searching IMDb with {attempt}") - result = client.title2imdbID(attempt, kind="tv series") - if not result: - continue - - if isinstance(result, str): - # if the result is a string each criterion has matched, we can stop searching and use it - logger.debug(f"{self.indexerid}: found IMDb id: {result} for {attempt}, using it") - self.imdb_id = result - break - - if not self.imdb_id: - logger.debug(f"{self.indexerid}: new method failed to determine IMDb id, trying a modified old method") - for attempt in attempts: - results = client.search_movie_advanced(attempt, adult=True) - - series_results = [ - x for x in results if x["title"].strip('" ') in attempts and x["kind"].startswith("tv") and not x["kind"].endswith("episode") - ] - if self.startyear: - series_results = [x for x in results if x["year"] == self.startyear] - - imdb_id_set = {x.getID() for x in series_results} - if len(imdb_id_set) == 1: - self.imdb_id = imdb_id_set.pop() - break - - if len(series_results) == 1: - self.imdb_id = list(series_results)[0].getID() - break - - logger.debug(f"{self.indexerid}: more than imdb one result was found with titles in {attempts}, not using any of them") - - # Make sure the lib didn't give us back something bogus - self.check_imdb_id() - - if not self.imdb_id: - logger.debug(f"{self.indexerid}: not loading show info from IMDb, because we don't know the imdb_id") - return - - logger.debug(f"{self.indexerid}: Loading show info from IMDb") - imdb_title: dict = client.get_movie(self.imdb_id.strip("t")) - if not imdb_title: - return - - self.imdb_info = { - "indexer_id": self.indexerid, - "imdb_id": imdb_title.setdefault("imdbID", self.imdb_id), - "title": imdb_title.setdefault("title", self.name), - "year": imdb_title.setdefault("year", self.startyear), - "akas": "|".join(imdb_title.setdefault("akas", [])), - "runtimes": imdb_title.setdefault("runtimes", [self.runtime])[0], - "genres": "|".join(imdb_title.setdefault("genres", [])), - "countries": "|".join(imdb_title.get("countries", [])), - "country_codes": "|".join(imdb_title.get("country codes", [])), - "certificates": "|".join(imdb_title.setdefault("certificates", [])), - "rating": str(imdb_title.setdefault("rating", 0.0)), - "votes": str(imdb_title.setdefault("votes", 0)), - "last_update": datetime.date.today().toordinal(), - } - - logger.debug(f"{self.indexerid}: Obtained info from IMDb ->{self.imdb_info}") - except KeyError: - logger.info(f"Could not get IMDB info for {self.name}") - except ( - TypeError, - ValueError, - LookupError, - IOError, - OperationalError, - TimeoutError, - imdb.IMDbDataAccessError, - imdb.IMDbError, - NewConnectionError, - MaxRetryError, - ) as error: - logger.info(f"Could not get IMDB info: see debug logs for details") - logger.debug(f"IMDB traceback: {error}", exc_info=True) - except (SyntaxError, KeyError): - logger.info("Could not get info from IDMb, pip install lxml") + logger.debug(f"{self.indexerid}: no IMDb id available; skipping IMDb info") + return def next_episode(self): current_date = datetime.date.today().toordinal() -- 2.46.4