From f3ac6cd34467adbd40cf7770aab3542f442b005a Mon Sep 17 00:00:00 2001 From: Brandon Egger Date: Sat, 8 Jun 2024 21:08:00 -0500 Subject: [PATCH] add note if directory mounted --- plex-media-converter/main.py | 10 ++++++++++ plex-media-converter/utils/directory.py | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 plex-media-converter/utils/directory.py diff --git a/plex-media-converter/main.py b/plex-media-converter/main.py index 24e0f19..b552519 100644 --- a/plex-media-converter/main.py +++ b/plex-media-converter/main.py @@ -1,14 +1,24 @@ import typer from rich import print +from utils.directory import is_mounted_directory app = typer.Typer() @app.command() def scan(directory: str): + """ + Scan a path for mkv files. Used to test the directory before running a conversion job. + """ print("Scanning directory:", directory) + if is_mounted_directory(directory): + print("Directory is detected as mounted. To improve file I/O performance, when performing conversions the mkv file will be copied locally during video encoding.") + @app.command() def convert(directory: str): + """ + Convert all mkv files in a directory to mp4 and split subtitles. + """ pass if __name__ == "__main__": diff --git a/plex-media-converter/utils/directory.py b/plex-media-converter/utils/directory.py new file mode 100644 index 0000000..2f94c52 --- /dev/null +++ b/plex-media-converter/utils/directory.py @@ -0,0 +1,8 @@ + +import os + +def is_mounted_directory(path: str) -> bool: + """ + Check if a directory is a mounted directory. + """ + return os.path.ismount(path)