Fetch the list of available Channels from the Freebox API

master
djib 4 years ago
parent 1ff676b8a4
commit 30e251ac09
  1. 3
      .gitmodules
  2. 28
      FreeboxMoviePlanner.py
  3. 5
      config.template.json
  4. 1
      pyfbx

3
.gitmodules vendored

@ -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"
}

@ -0,0 +1 @@
Subproject commit 69ae89806dfb0724d0c14fb6f78629090efde692
Loading…
Cancel
Save