Bläddra i källkod

Fetch the list of available Channels from the Freebox API

tags/v1.0.0
djib 6 månader sedan
förälder
incheckning
30e251ac09
4 ändrade filer med 31 tillägg och 6 borttagningar
  1. +3
    -0
      .gitmodules
  2. +24
    -4
      FreeboxMoviePlanner.py
  3. +3
    -2
      config.template.json
  4. +1
    -0
      pyfbx

+ 3
- 0
.gitmodules Visa fil

@@ -0,0 +1,3 @@
[submodule "pyfbx"]
path = pyfbx
url = https://djib.fr/djib/pyfbx.git

+ 24
- 4
FreeboxMoviePlanner.py Visa fil

@@ -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()

+ 3
- 2
config.template.json Visa fil

@@ -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
- 0
pyfbx

@@ -0,0 +1 @@
Subproject commit 69ae89806dfb0724d0c14fb6f78629090efde692

Laddar…
Avbryt
Spara