Skip to content

Commit f13997a

Browse files
committed
0.3rc1
1 parent 4a9ff34 commit f13997a

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/TranscodeSession.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, file, args):
6868
self.validate()
6969

7070
# Build HandBrakeCLI command
71-
self.command = "HandBrakeCLI --encoder-preset {encoder_preset} --preset-import-file presets.json --preset {preset_name} --quality {quality} --encopts {encopts} --input {source_path} --output {output_path}".format(encoder_preset=self.encoder_preset, preset_name=self.preset_name, quality=str(self.encoder_quality), encopts=self.encoder_options, source_path=self.path["source"], output_path=self.path["output"])
71+
self.command = "HandBrakeCLI --encoder-preset {encoder_preset} --preset-import-file {json_path} --preset {preset_name} --quality {quality} --encopts {encopts} --input {source_path} --output {output_path}".format(encoder_preset=self.encoder_preset, json_path=os.path.join(sys.path[0], "src/presets.json"), preset_name=self.preset_name, quality=str(self.encoder_quality), encopts=self.encoder_options, source_path=self.path["source"], output_path=self.path["output"])
7272

7373
def signal_handler(self, sig, frame):
7474
""" Delete output file if ctrl+c is caught, since file will be corrupt

src/__init__.py

Whitespace-only changes.

transcode.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
from datetime import datetime
55
import os
66
import sys
7-
from src import TranscodeSession
7+
sys.path.append(os.path.join(sys.path[0], "src"))
8+
from TranscodeSession import Session
89

910
"""
1011
1112
TODO:
1213
- allow comma-separated string for --preset, e.g. medium,slow,slower, map to list
1314
- ~~if presets.json does not exist, download from github~~
1415
- need to format source / output filenames: drop resolution suffixes
16+
- add check: if working directory == script location, exit with warning to symlink transcode.py onto $PATH
17+
- add --install arg to create symlink at /usr/local/bin?
1518
1619
"""
1720

@@ -32,7 +35,7 @@ def main():
3235
valid_arguments = False
3336

3437
# Validate command-line arguments
35-
if not set(["source", "presets.json"]).issubset(set(os.listdir())):
38+
if not "source" in os.listdir():
3639
print("FATAL: invalid working directory!")
3740
elif args.file and not os.path.exists(args.file):
3841
print("FATAL:", args.file, "not found!")
@@ -47,7 +50,7 @@ def main():
4750
elif args.all and args.quality:
4851
print("Warning! Combining --all and --quality options is not recommended and may not produce optimal HEVC transcodes.")
4952
while "need response":
50-
reply = str(input("Proceed? (y/n) cccccccccc" )).lower().strip()
53+
reply = str(input("Proceed? (y/n)" )).lower().strip()
5154
if reply[0] == "y":
5255
break
5356
if reply[0] == "n":
@@ -61,7 +64,7 @@ def main():
6164
else:
6265
source_files = [args.file]
6366
for source_file in source_files:
64-
session = TranscodeSession.Session(source_file, args)
67+
session = Session(source_file, args)
6568
if os.path.exists(session.path["output"]):
6669
print(" Skipping", source_file)
6770
source_files = [file for file in source_files if file is not source_file]
@@ -77,7 +80,7 @@ def main():
7780
# Do the thing
7881
task_start_time = datetime.now()
7982
for file in source_files:
80-
session = TranscodeSession.Session(file, args)
83+
session = Session(file, args)
8184
session.summarize()
8285
print(session.command + "\n")
8386
job_start_time = datetime.now()

0 commit comments

Comments
 (0)