⚙️ autopyvideothumbnailer: take cli argument for the dirs to search

master
neingeist 9 months ago
parent a53fa548ef
commit 3872b5ed0d

@ -6,6 +6,7 @@
import math
import os
import subprocess
import click
from pymediainfo import MediaInfo
@ -58,10 +59,9 @@ def call_thumbnailer(video_file, width, rows, *, skip_seconds=10):
]
)
def main():
def process(searchdir):
VIDEO_FILE_EXT = [".mp4", ".mkv", ".avi", ".mov", ".wmv"]
video_files = find_video_files(".", VIDEO_FILE_EXT)
video_files = find_video_files(searchdir, VIDEO_FILE_EXT)
for video_file in video_files:
# Skip if .jpg file already exists
@ -90,5 +90,15 @@ def main():
print(f"Error for {video_file}: {e}")
@click.command()
@click.argument('searchdirs', nargs=-1)
def main(searchdirs):
"""Run pyvideothumbnailer for every video file found"""
if not searchdirs:
searchdirs=["."]
for searchdir in searchdirs:
process(searchdir)
if __name__ == "__main__":
main()
Loading…
Cancel
Save