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

master
neingeist 1 year ago
parent a53fa548ef
commit 3872b5ed0d

@ -6,6 +6,7 @@
import math import math
import os import os
import subprocess import subprocess
import click
from pymediainfo import MediaInfo from pymediainfo import MediaInfo
@ -58,10 +59,9 @@ def call_thumbnailer(video_file, width, rows, *, skip_seconds=10):
] ]
) )
def process(searchdir):
def main():
VIDEO_FILE_EXT = [".mp4", ".mkv", ".avi", ".mov", ".wmv"] 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: for video_file in video_files:
# Skip if .jpg file already exists # Skip if .jpg file already exists
@ -90,5 +90,15 @@ def main():
print(f"Error for {video_file}: {e}") 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__": if __name__ == "__main__":
main() main()
Loading…
Cancel
Save