Adapt the list of days to start with the current day
This commit is contained in:
@ -9,9 +9,11 @@ Todo :
|
||||
import json
|
||||
import logging
|
||||
import requests
|
||||
import datetime
|
||||
import tmdbsimple
|
||||
import textwrap
|
||||
from bs4 import BeautifulSoup
|
||||
from collections import deque
|
||||
|
||||
class FreeboxMoviePlanner:
|
||||
TV_GUIDE_URL = 'https://www.programme-television.org/{}?bouquet=tnt'
|
||||
@ -31,12 +33,18 @@ class FreeboxMoviePlanner:
|
||||
tag['data-nature']=='films-telefilms'
|
||||
)
|
||||
|
||||
|
||||
def getAllMovies(self):
|
||||
days = ['', 'dimanche', 'lundi', 'mardi', 'mercredi',
|
||||
'jeudi', 'vendredi', 'samedi']
|
||||
days = deque(['lundi', 'mardi', 'mercredi',
|
||||
'jeudi', 'vendredi', 'samedi', 'dimanche'])
|
||||
offset = datetime.datetime.today().weekday()
|
||||
days.rotate(-1-offset)
|
||||
days.appendleft('')
|
||||
|
||||
for day in days:
|
||||
print('=== {}'.format(day.title()))
|
||||
print('=== {}'.format(day.title()))
|
||||
self.getMovies(day)
|
||||
|
||||
|
||||
def getMovies(self, day=''):
|
||||
logging.info('Connecting to {}'.format(self.TV_GUIDE_URL))
|
||||
@ -79,6 +87,7 @@ class FreeboxMoviePlanner:
|
||||
logging.warning('No TMDB match for {}'.format(
|
||||
movie_title
|
||||
))
|
||||
|
||||
|
||||
def _getMovieRating(self, movie):
|
||||
logging.info("Searching for '{}' on TMDB".format(movie))
|
||||
@ -89,6 +98,7 @@ class FreeboxMoviePlanner:
|
||||
return search.results[0]
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(
|
||||
|
Reference in New Issue
Block a user