Add margin before and after in settings
This commit is contained in:
@ -4,12 +4,10 @@ Simple script that extracts information from Télé 7 jours and TMDB
|
||||
to help choosing the movies you want to record with your Freebox
|
||||
|
||||
Todo :
|
||||
* Scrape beginning and end time
|
||||
* Schedule recordings on Freebox using the FB API
|
||||
https://dev.freebox.fr/sdk/os/pvr/#pvr-programmed-records
|
||||
* Add a configuration setting for beginning and end margin
|
||||
* Display conflicts if any
|
||||
"""
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
@ -42,8 +40,6 @@ class Movie:
|
||||
def __str__(self):
|
||||
return '{}: {} - {} ({})\n TMDB: {} - {}\n @ {}\n {}'.format(
|
||||
'Today' if self.day == '' else self.day,
|
||||
self.start_time,
|
||||
self.end_time,
|
||||
self.title,
|
||||
self.genre,
|
||||
self.channel,
|
||||
@ -184,9 +180,11 @@ class FreeboxMoviePlanner:
|
||||
def askForUserSelection(self):
|
||||
for movie in self.movies:
|
||||
print(movie)
|
||||
reply = input("Interested? (y/N)")
|
||||
reply = input("Interested? (y)es/(N)o/(s)kip")
|
||||
if reply.upper() == "Y":
|
||||
movie.user_selected = True
|
||||
elif reply.upper() == "S":
|
||||
break
|
||||
print()
|
||||
|
||||
def findMoviesOnTMDB(self):
|
||||
@ -237,13 +235,17 @@ class FreeboxMoviePlanner:
|
||||
|
||||
def programMovies(self):
|
||||
for movie in self.movies:
|
||||
logging.info("Programming '{}'".format(movie))
|
||||
data = {
|
||||
'channel_uuid': self.channels[movie.channel],
|
||||
'start': int(movie.start_time.timestamp()),
|
||||
'end': int(movie.end_time.timestamp()),
|
||||
'name': movie.title
|
||||
'name': movie.title,
|
||||
'margin_before': self.config['margin-before'],
|
||||
'margin_after': self.config['margin-after']
|
||||
}
|
||||
self.freebox.Pvr.Create_a_precord(data)
|
||||
print("Programmed '{}'".format(movie))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -251,5 +253,16 @@ if __name__ == '__main__':
|
||||
level=logging.INFO,
|
||||
format=' %(asctime)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
fmp = FreeboxMoviePlanner(TVGuideScraper.findAllMovies())
|
||||
# fmp = FreeboxMoviePlanner(TVGuideScraper._getMovies())
|
||||
parser = argparse.ArgumentParser(description='Plan movies on your Freebox')
|
||||
parser.add_argument(
|
||||
'-d', '--day',
|
||||
action='store_true',
|
||||
help='Search for a single day ahead'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.day:
|
||||
movies = TVGuideScraper._getMovies()
|
||||
else:
|
||||
movies = TVGuideScraper.findAllMovies()
|
||||
fmp = FreeboxMoviePlanner(movies)
|
||||
|
@ -2,5 +2,7 @@
|
||||
"tmdb-api":"yourapikey",
|
||||
"tmdb-language":"en-GB",
|
||||
"minimum-rating":6.5,
|
||||
"pyfbx-session-token":"See https://framagit.org/sun/pyfbx"
|
||||
"pyfbx-session-token":"See https://framagit.org/sun/pyfbx",
|
||||
"margin-before":5,
|
||||
"margin-after":25
|
||||
}
|
||||
|
Reference in New Issue
Block a user