Detect conflicts
This commit is contained in:
@ -2,10 +2,6 @@
|
||||
"""
|
||||
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 :
|
||||
* Add a configuration setting for beginning and end margin
|
||||
* Display conflicts if any
|
||||
"""
|
||||
import argparse
|
||||
import datetime
|
||||
@ -155,6 +151,7 @@ class FreeboxMoviePlanner:
|
||||
self.askForUserSelection()
|
||||
self.excludeNotSelected()
|
||||
self.programMovies()
|
||||
self.checkForConflicts()
|
||||
|
||||
def __repr__(self):
|
||||
result = 'FreeboxMoviePlanner <Movies:\n'
|
||||
@ -247,17 +244,34 @@ class FreeboxMoviePlanner:
|
||||
self.freebox.Pvr.Create_a_precord(data)
|
||||
print("Programmed '{}'".format(movie))
|
||||
|
||||
def checkForConflicts(self):
|
||||
programmed_movies = self.freebox.Pvr.Getting_the_list_of_precords()
|
||||
conflicting_movies = [m for m in programmed_movies if m['conflict']]
|
||||
if conflicting_movies:
|
||||
print(
|
||||
"!!!!!!!!!\n"
|
||||
"!Warning!\n"
|
||||
"!!!!!!!!!\n"
|
||||
"Conflicting records detected, please "
|
||||
"check your Freebox interface"
|
||||
)
|
||||
logging.info("Conflicting records detected '{}'".format(
|
||||
conflicting_movies
|
||||
))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
level=logging.WARNING,
|
||||
format=' %(asctime)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
parser = argparse.ArgumentParser(description='Plan movies on your Freebox')
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Schedule movie recordings on your Freebox'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-d', '--day',
|
||||
action='store_true',
|
||||
help='Search for a single day ahead'
|
||||
help='Search movies for current day only instead of a full week'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
Reference in New Issue
Block a user