Fetch the list of available Channels from the Freebox API
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "pyfbx"]
|
||||
path = pyfbx
|
||||
url = https://djib.fr/djib/pyfbx.git
|
@ -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()
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"tmdb-api":"yourapikey",
|
||||
"tmdb-language":["en","GB"],
|
||||
"minimum-rating":6.5
|
||||
}
|
||||
"minimum-rating":6.5,
|
||||
"pyfbx-session-token":"See https://framagit.org/sun/pyfbx"
|
||||
}
|
||||
|
1
pyfbx
Submodule
1
pyfbx
Submodule
Submodule pyfbx added at 69ae89806d
Reference in New Issue
Block a user