Skip to content

Commit

Permalink
fix ytdlp
Browse files Browse the repository at this point in the history
  • Loading branch information
NevermindNilas committed Dec 25, 2024
1 parent 17e5102 commit 7b67a3d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
- Fixed Rife Elexor issues.
- Couple of import issues for `--restore`
- Fixed an issue where the script would attempt to use an incompatible `--encode_method` with the `.webm` container.
- Fixed a bug where if `--output` was declared and no other processing method was declared tas would only output the temp file.

#### Adobe Edition

Expand Down
42 changes: 28 additions & 14 deletions src/utils/argumentsChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import sys
import argparse
import shutil

from .checkSpecs import checkSystem
from .downloadModels import downloadModels, modelsList
Expand All @@ -10,6 +11,21 @@
from src.version import __version__ as version
from .generateOutput import outputNameGenerator

def isAnyOtherProcessingMethodEnabled(args):
proccessingMethods = [
args.interpolate,
args.scenechange,
args.upscale,
args.segment,
args.restore,
args.sharpen,
args.resize,
args.dedup,
args.depth,
args.autoclip,
]

return any(proccessingMethods)

def str2bool(arg):
"""
Expand Down Expand Up @@ -631,22 +647,10 @@ def adjustFeature(
logging.error("Error processing input")
sys.exit()

processingMethods = [
args.interpolate,
args.scenechange,
args.upscale,
args.segment,
args.restore,
args.sharpen,
args.resize,
args.dedup,
args.depth,
args.autoclip,
]
if not any(processingMethods):
if not isAnyOtherProcessingMethodEnabled(args):
logging.error("No processing methods specified, exiting")
sys.exit()

return args


Expand All @@ -668,6 +672,9 @@ def processURL(args, outputPath):
args.output = os.path.join(
outputFolder, outputNameGenerator(args, args.input)
)
elif os.path.isdir(args.output):
outputFolder = args.output
os.makedirs(os.path.join(outputFolder), exist_ok=True)
else:
outputFolder = os.path.dirname(args.output)
os.makedirs(os.path.join(outputFolder), exist_ok=True)
Expand All @@ -682,9 +689,16 @@ def processURL(args, outputPath):
args.ffmpeg_path,
args.ae,
)
print(green(f"Video downloaded to: {tempOutput}"))

if not isAnyOtherProcessingMethodEnabled(args):
shutil.move(tempOutput, args.output)
sys.exit()

args.input = str(tempOutput)
logging.info(f"New input path: {args.input}")


else:
logging.error(
"URL is invalid or not a YouTube URL, please check the URL and try again"
Expand Down

0 comments on commit 7b67a3d

Please sign in to comment.