From 6033e5b6534551f28fb14467a6c01c48bc136880 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 21 Dec 2014 23:00:40 +0100 Subject: path --- imdb-lookup/imdbinfo.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'imdb-lookup') diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py index 6318bfb..7457c98 100755 --- a/imdb-lookup/imdbinfo.py +++ b/imdb-lookup/imdbinfo.py @@ -292,10 +292,15 @@ def do_index(args, imdb_ids): valid_extensions = [".mkv", ".avi", ".mov", ".mp4", ".mpg"] def listMovieFiles(path): - for root, dirs, files in os.walk(path): - for curfile in files: - if sum(map(curfile.endswith, valid_extensions)): - yield os.path.join(root, curfile) + def listFiles(): + for root, dirs, files in os.walk(path): + for curfile in files: + if sum(map(curfile.endswith, valid_extensions)): + yield os.path.join(root, curfile) + files = list(listFiles()) + if not files: + files = [path] + return files def install(filename): outpath = os.path.join(".index.html", os.path.dirname(filename)) -- cgit v1.2.1