Browse Source

Filter movies on available channels

master
djib 2 years ago
parent
commit
a54bff144b
  1. 28
      FreeboxMoviePlanner.py

28
FreeboxMoviePlanner.py

@ -43,11 +43,15 @@ class Movie:
)
def __repr__(self):
return 'Movie <{}({})>'.format(self.title, self.rating)
return "Movie <{} (Ch:{} – R:{})>".format(
self.title,
self.channel,
self.rating
)
class TVGuideScraper:
TV_GUIDE_URL = 'https://www.programme-television.org/{}?bouquet=tnt'
TV_GUIDE_URL = 'https://www.programme-television.org/{}?bouquet=free'
@staticmethod
def getMovies(day=''):
@ -100,6 +104,10 @@ class FreeboxMoviePlanner:
token=self.config['freebox-session-token']
)
self.getListOfAvailableChannels()
self.scapeAllMovies()
# self.findMoviesOnTMDB()
# self.filterBadRatings()
self.filterUnavailableChannels()
def __repr__(self):
result = 'FreeboxMoviePlanner <Movies:\n'
@ -151,7 +159,18 @@ class FreeboxMoviePlanner:
.format(movie.tmdb_id, self.config['tmdb-language'])
def filterBadRatings(self):
self.movies = [movie for movie in self.movies if movie.good]
logging.info('Dropping bad ratings: {}'.format(
[m for m in self.movies if not m.good]
))
self.movies = [m for m in self.movies if m.good]
logging.info('Kept {}'.format(self.movies))
def filterUnavailableChannels(self):
logging.info('Dropping unavailable channels: {}'.format(
[m for m in self.movies if m.channel not in self.channels]
))
self.movies = [m for m in self.movies if m.channel in self.channels]
logging.info('Kept {}'.format(self.movies))
def _findMovieOnTMDB(self, movie):
logging.info("Searching for '{}' on TMDB".format(movie))
@ -173,7 +192,4 @@ if __name__ == '__main__':
format=' %(asctime)s - %(levelname)s - %(message)s'
)
fmp = FreeboxMoviePlanner()
# fmp.scapeAllMovies()
# fmp.findMoviesOnTMDB()
# fmp.filterBadRatings()
# fmp.printAllMovies()
Loading…
Cancel
Save