Browse Source

Fix error when there is no release date

master
djib 2 years ago
parent
commit
68b5f05928
  1. 17
      FreeboxMoviePlanner.py

17
FreeboxMoviePlanner.py

@ -76,8 +76,9 @@ class TVGuideScraper:
@staticmethod
def _getMovies(day='', date=datetime.date.today()):
logging.info('Connecting to {}'.format(TVGuideScraper.TV_GUIDE_URL))
r = requests.get(TVGuideScraper.TV_GUIDE_URL.format(day))
url = TVGuideScraper.TV_GUIDE_URL.format(day)
logging.info('Connecting to {}'.format(url))
r = requests.get(url)
r.raise_for_status()
html = BeautifulSoup(r.text, 'html.parser')
movies = []
@ -219,9 +220,15 @@ class FreeboxMoviePlanner:
float(movie.rating) >= self.config['minimum-rating']
movie.url = 'https://www.themoviedb.org/movie/{}?language={}' \
.format(movie.tmdb_id, self.config['tmdb-language'])
movie.year = datetime.datetime.strptime(
tmdb_details['release_date'], '%Y-%m-%d'
).year
try:
movie.year = datetime.datetime.strptime(
tmdb_details['release_date'], '%Y-%m-%d'
).year
except ValueError:
logging.warning(
'No release date for {}'.format(movie.title)
)
pass
def _findMovieOnTMDB(self, movie):
logging.info("Searching for '{}' on TMDB".format(movie))

Loading…
Cancel
Save