diff --git a/autopyvideothumbnailer b/autopyvideothumbnailer index 00ac17b..c973ffb 100755 --- a/autopyvideothumbnailer +++ b/autopyvideothumbnailer @@ -71,6 +71,9 @@ def process(searchdir): video_files = find_video_files(searchdir) for video_file in video_files: + # Skip if dead symlink + if config.skip_dead_symlinks and not os.path.exists(video_file): + continue # Skip if .jpg file already exists thumbnails_file = video_file + ".jpg" if os.path.lexists(thumbnails_file): @@ -105,10 +108,12 @@ config = Dict() @click.command() @click.argument("searchdirs", nargs=-1) @click.option("-v", "--verbose", is_flag=True, default=False) -def main(searchdirs, verbose): +@click.option("--skip-dead-symlinks/--no-skip-dead-symlinks", default=True) +def main(searchdirs, verbose, skip_dead_symlinks): """Run pyvideothumbnailer for every video file found""" config.verbose = verbose + config.skip_dead_symlinks = skip_dead_symlinks config.width = 1600 config.columns = 4 # pyvideothumbnailer default config.every = 5 * 60 # seconds