Interactive movie selection
This commit is contained in:
@ -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()
|
||||
|
Reference in New Issue
Block a user