updated logic about folder creation
This commit is contained in:
@@ -106,15 +106,29 @@ def main():
|
|||||||
|
|
||||||
check_tools()
|
check_tools()
|
||||||
|
|
||||||
|
# Define directory paths but don't create them yet
|
||||||
DIR_COMPLETED = Path("completed")
|
DIR_COMPLETED = Path("completed")
|
||||||
DIR_ORIGINAL = Path("original")
|
DIR_ORIGINAL = Path("original")
|
||||||
DIR_LOGS = Path("conv_logs")
|
DIR_LOGS = Path("conv_logs")
|
||||||
|
current_dir = Path(".")
|
||||||
|
|
||||||
|
# Check if there are any MKV files to process
|
||||||
|
files_to_process = sorted(
|
||||||
|
f for f in current_dir.glob("*.mkv")
|
||||||
|
if not f.name.startswith("temp-output-")
|
||||||
|
)
|
||||||
|
|
||||||
|
if not files_to_process:
|
||||||
|
print("No MKV files found to process. Exiting.")
|
||||||
|
return # Exit without creating directories
|
||||||
|
|
||||||
|
# Create directories only when we actually have files to process
|
||||||
DIR_COMPLETED.mkdir(exist_ok=True)
|
DIR_COMPLETED.mkdir(exist_ok=True)
|
||||||
DIR_ORIGINAL.mkdir(exist_ok=True)
|
DIR_ORIGINAL.mkdir(exist_ok=True)
|
||||||
DIR_LOGS.mkdir(exist_ok=True)
|
DIR_LOGS.mkdir(exist_ok=True)
|
||||||
current_dir = Path(".")
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
# Re-check for files in case new ones were added
|
||||||
files_to_process = sorted(
|
files_to_process = sorted(
|
||||||
f for f in current_dir.glob("*.mkv")
|
f for f in current_dir.glob("*.mkv")
|
||||||
if not f.name.startswith("temp-output-")
|
if not f.name.startswith("temp-output-")
|
||||||
|
|||||||
Reference in New Issue
Block a user