diff --git a/FreeboxMoviePlanner.py b/FreeboxMoviePlanner.py index 88bca86..d22e38b 100755 --- a/FreeboxMoviePlanner.py +++ b/FreeboxMoviePlanner.py @@ -48,8 +48,20 @@ class Movie: class TVGuideScraper: TV_GUIDE_URL = 'https://www.programme-television.org/{}?bouquet=tnt' + def findAllMovies(): + movies = [] + days = deque(['lundi', 'mardi', 'mercredi', + 'jeudi', 'vendredi', 'samedi', 'dimanche']) + offset = datetime.datetime.today().weekday() + days.rotate(-1-offset) + days.appendleft('') + for day in days: + movies += TVGuideScraper._getMovies(day) + logging.info('Found the following movies: {}'.format(movies)) + return movies + @staticmethod - def getMovies(day=''): + def _getMovies(day=''): logging.info('Connecting to {}'.format(TVGuideScraper.TV_GUIDE_URL)) r = requests.get(TVGuideScraper.TV_GUIDE_URL.format(day)) r.raise_for_status() @@ -85,12 +97,12 @@ class TVGuideScraper: class FreeboxMoviePlanner: - def __init__(self): + def __init__(self, movies): logging.info('Opening config file: config.json') with open('config.json') as config_file: self.config = json.load(config_file) tmdbsimple.API_KEY = self.config['tmdb-api'] - self.movies = [] + self.movies = movies def __repr__(self): result = 'FreeboxMoviePlanner