From 306778dfda83106c003f9d707d7cc90f44a27cd6 Mon Sep 17 00:00:00 2001 From: neingeist Date: Wed, 7 Feb 2024 23:42:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20autopyvideothumbnailer:=20skip=20de?= =?UTF-8?q?ad=20symlinks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autopyvideothumbnailer | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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