Skip to content

Commit

Permalink
add new flag to detect if the script is ran from AE interface
Browse files Browse the repository at this point in the history
  • Loading branch information
NevermindNilas committed Jun 5, 2024
1 parent 49c4f8c commit a28cd2f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 2 additions & 1 deletion PARAMETERS.MD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The Anime Scripter is a powerful tool for enhancing and manipulating videos with
- `--version` (action=store_true): Outputs the script version.
- `--benchmark` (action=store_true): Enable benchmarking. This will not output any video and it will only test the performance of the script without any additional processing.
- `--offline` (action=store_true): Enable offline mode, this will download all available models and store them locally in the weights folder, due to Github rate limiting and variables like internet connection this can take up to 5 minutes but it will make the script work 100% offline. ( except for YTDLP )
- `--consent` (action=store_true): WIP! Enable fully anonymous logging of usage, this will store data from log.txt and send it to my server, the only data that is being processed from log.txt are: " Arguments " ( excluding input/output ), " System Specs " and " Processing Outputs ". This can help provide better insight on usage and errors.
- `--consent` (action=store_true, default=False): WIP! Enable fully anonymous logging of usage, this will store data from log.txt and send it to my server, the only data that is being processed from log.txt are: " Arguments " ( excluding input/output ), " System Specs " and " Processing Outputs ". This can help provide better insight on usage and errors.
- `--ae` (actions=store_true, default=False): A simple flag for the script to know if it's ran from the After Effects interface or not.

#### Input and Output:

Expand Down
2 changes: 2 additions & 0 deletions TheAnimeScripter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ var TheAnimeScripter = (function () {
"--resize_factor", resizeValue(),
"--nt", threadsValue(),
"--denoise_method", denoiseMethod().toLowerCase(),
"--ae",
];

if (checkboxInterpolateValue()) {
Expand Down Expand Up @@ -1003,6 +1004,7 @@ var TheAnimeScripter = (function () {
"\"" + exeFile + "\"",
"--output", "\"" + outputName + "\"",
"--input", "\"" + textGetVideo.text + "\"",
"--ae",
];
var command = attempt.join(" ");
callCommand(command);
Expand Down
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def start(self):
argparser.add_argument(
"--scenechange", action="store_true", help="Detect scene changes", required=False
)
argparser.add_argument("--ae", action="store_true", help="A simple flag for notifying if the script is ran from the After Effects interface", required=False)

args = argparser.parse_args()
args = argumentChecker(args, mainPath, scriptVersion)
Expand Down
1 change: 1 addition & 0 deletions src/argumentsChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def processURL(args, mainPath):
args.encode_method,
args.custom_encoder,
args.ffmpeg_path,
args.ae,
)

args.input = str(args.output)
Expand Down
13 changes: 7 additions & 6 deletions src/ytdlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

class VideoDownloader:
def __init__(
self, video_link, output, encodeMethod, customEncoder, ffmpegPath: str = None
self, video_link, output, encodeMethod, customEncoder, ffmpegPath: str = None, ae: bool = False
):
self.link = video_link
self.output = output
self.encodeMethod = encodeMethod
self.customEncoder = customEncoder
self.ffmpegPath = ffmpegPath
self.ae = ae

resolutions = self.listResolutions()

Expand All @@ -32,10 +33,10 @@ def __init__(

self.resolution = answers["resolution"]

if self.resolution > 1080:
toPrint = f"The selected resolution {self.resolution} is higher than 1080p, this will require an aditional step of encoding the video for compatibility with After Effects, [WIP]"
logging.warning(toPrint)
print(toPrint)
if self.resolution > 1080 and self.ae:
toPrint = f"The selected resolution {self.resolution} is higher than 1080p, this will require an aditional step of encoding the video for compatibility with After Effects"
logging.warning(toPrint)
print(toPrint)
else:
toPrint = f"Selected resolution: {self.resolution}"
logging.info(toPrint)
Expand Down Expand Up @@ -65,7 +66,7 @@ def downloadVideo(self):
ydl.download([self.link])

def getOptions(self):
if self.resolution > 1080:
if self.resolution > 1080 and self.ae:
return {
"format": f"bestvideo[height<={self.resolution}]+bestaudio[ext=m4a]/best[ext=mp4]",
"outtmpl": os.path.splitext(self.output)[0],
Expand Down

0 comments on commit a28cd2f

Please sign in to comment.