Fix excluded directory not working

This commit is contained in:
2020-03-14 16:04:53 +01:00
parent 0214112d7b
commit 0ff1f73039

View File

@ -136,7 +136,7 @@ class TVGuideScraper:
class FreeboxMoviePlanner: class FreeboxMoviePlanner:
def __init__(self, movies, excluded_channels=[], excluded_directory=False): def __init__(self, movies, excluded_channels=[], excluded_directory=[]):
logging.debug('Opening config file: config.json') logging.debug('Opening config file: config.json')
with open('config.json') as config_file: with open('config.json') as config_file:
self.config = json.load(config_file) self.config = json.load(config_file)
@ -157,8 +157,8 @@ class FreeboxMoviePlanner:
self.excludeTelevisionFilm() self.excludeTelevisionFilm()
self.findMoviesOnTMDB() self.findMoviesOnTMDB()
self.excludeBadRatings() self.excludeBadRatings()
if self.excluded_directory: for directory in self.excluded_directory:
self.excludeLocalMovies() self.excludeLocalMovies(directory)
self.askForUserSelection() self.askForUserSelection()
self.excludeNotSelected() self.excludeNotSelected()
self.programMovies() self.programMovies()
@ -276,9 +276,11 @@ class FreeboxMoviePlanner:
m for m in self.movies if not m.genre.startswith("Téléfilm") m for m in self.movies if not m.genre.startswith("Téléfilm")
] ]
def excludeLocalMovies(self): def excludeLocalMovies(self, directory):
(_, _, filenames) = next(os.walk('.')) (_, _, filenames) = next(os.walk(directory))
logging.info('Dropping movies already recorded: {}'.format( for f in filenames:
print(f)
logging.warning('Dropping movies already recorded: {}'.format(
[ m for m in self.movies if m.title+'.m2ts' in filenames ] [ m for m in self.movies if m.title+'.m2ts' in filenames ]
)) ))
self.movies = [ self.movies = [