Browse Source

Interactive movie selection

master
djib 2 years ago
parent
commit
6587cb2457
  1. 22
      FreeboxMoviePlanner.py

22
FreeboxMoviePlanner.py

@ -28,6 +28,7 @@ class Movie:
self.good = False
self.tmdb_id = ''
self.url = ''
self.user_selected = False
def __str__(self):
return '{}: {} - {} ({})\n TMDB: {} - {}\n @ {}\n {}'.format(
@ -42,7 +43,12 @@ class Movie:
)
def __repr__(self):
return 'Movie <{}({})>'.format(self.title, self.rating)
return 'Movie <{} ({} :: {} :: {})>'.format(
self.title,
self.day,
self.channel,
self.rating
)
class TVGuideScraper:
@ -112,8 +118,16 @@ class FreeboxMoviePlanner:
return result
def printAllMovies(self):
for movie in self.movies:
print('{!r}'.format(movie))
print()
def askForUserSelection(self):
for movie in self.movies:
print(movie)
reply = input("Interested? (y/N)")
if reply.upper() == "Y":
movie.user_selected = True
print()
def findMoviesOnTMDB(self):
@ -141,6 +155,9 @@ class FreeboxMoviePlanner:
m for m in self.movies if m.channel not in paid_channels
]
def excludeNotSelected(self):
self.movies = [m for m in self.movies if m.user_selected]
def _findMovieOnTMDB(self, movie):
logging.info("Searching for '{}' on TMDB".format(movie))
search = tmdbsimple.Search()
@ -164,4 +181,7 @@ if __name__ == '__main__':
fmp.findMoviesOnTMDB()
fmp.excludeBadRatings()
fmp.excludePaidChannels()
fmp.askForUserSelection()
fmp.excludeNotSelected()
print('\n====== Selected ======\n')
fmp.printAllMovies()
Loading…
Cancel
Save