|
|
|
@ -12,6 +12,7 @@ import requests |
|
|
|
|
import datetime |
|
|
|
|
import tmdbsimple |
|
|
|
|
import textwrap |
|
|
|
|
from pyfbx.pyfbx import Fbx |
|
|
|
|
from bs4 import BeautifulSoup |
|
|
|
|
from collections import deque |
|
|
|
|
|
|
|
|
@ -92,6 +93,14 @@ class FreeboxMoviePlanner: |
|
|
|
|
tmdbsimple.API_KEY = self.config['tmdb-api'] |
|
|
|
|
self.movies = [] |
|
|
|
|
|
|
|
|
|
logging.info('Opening Freebox session') |
|
|
|
|
self.freebox = Fbx() |
|
|
|
|
self.freebox.mksession( |
|
|
|
|
app_id='FreeboxMoviePlanner', |
|
|
|
|
token=self.config['freebox-session-token'] |
|
|
|
|
) |
|
|
|
|
self.getListOfAvailableChannels() |
|
|
|
|
|
|
|
|
|
def __repr__(self): |
|
|
|
|
result = 'FreeboxMoviePlanner <Movies:\n' |
|
|
|
|
for movie in self.movies: |
|
|
|
@ -99,9 +108,20 @@ class FreeboxMoviePlanner: |
|
|
|
|
result += '>' |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
def getListOfAvailableChannels(self): |
|
|
|
|
logging.info('Getting the list of available channels') |
|
|
|
|
self.channels = {} |
|
|
|
|
for channel in self.freebox.Tv.Getting_the_list_of_channels().values(): |
|
|
|
|
if channel['available']: |
|
|
|
|
self.channels[channel['name']] = channel['uuid'] |
|
|
|
|
else: |
|
|
|
|
logging.info("Dropping '{}'".format(channel['name'])) |
|
|
|
|
logging.info('Got the following channels: {}'.format(self.channels)) |
|
|
|
|
|
|
|
|
|
def printAllMovies(self): |
|
|
|
|
for movie in self.movies: |
|
|
|
|
print(movie) |
|
|
|
|
input("Press enter") |
|
|
|
|
print() |
|
|
|
|
|
|
|
|
|
def scapeAllMovies(self): |
|
|
|
@ -153,7 +173,7 @@ if __name__ == '__main__': |
|
|
|
|
format=' %(asctime)s - %(levelname)s - %(message)s' |
|
|
|
|
) |
|
|
|
|
fmp = FreeboxMoviePlanner() |
|
|
|
|
fmp.scapeAllMovies() |
|
|
|
|
fmp.findMoviesOnTMDB() |
|
|
|
|
fmp.filterBadRatings() |
|
|
|
|
fmp.printAllMovies() |
|
|
|
|
# fmp.scapeAllMovies() |
|
|
|
|
# fmp.findMoviesOnTMDB() |
|
|
|
|
# fmp.filterBadRatings() |
|
|
|
|
# fmp.printAllMovies() |
|
|
|
|