diff options
-rwxr-xr-x | imdb-lookup/imdbinfo.py | 13 |
1 files changed, 9 insertions, 4 deletions
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)) |