Skip to content

Commit

Permalink
Update describealign.py
Browse files Browse the repository at this point in the history
Changed default output directories on Mac and Linux to be in user folder to fix relative path crash in Mac app bundle
  • Loading branch information
julbean authored Jan 17, 2024
1 parent ba5ad9c commit 59295f1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions describealign.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@
IS_RUNNING_WINDOWS = platform.system() == 'Windows'
if IS_RUNNING_WINDOWS:
import PySimpleGUIWx as sg
default_output_dir = 'videos_with_ad'
default_alignment_dir = 'alignment_plots'
else:
import PySimpleGUIQt as sg
default_output_dir = os.path.expanduser('~') + '/videos_with_ad'
default_alignment_dir = os.path.expanduser('~') + '/alignment_plots'

def display(text, func=None):
if func:
Expand Down Expand Up @@ -815,8 +819,8 @@ def is_ffmpeg_installed():
# this is the main function of this script, it calls the other functions in order
def combine(video, audio, smoothness=50, stretch_audio=False, keep_non_ad=False,
boost=0, ad_detect_sensitivity=.6, boost_sensitivity=.4, yes=False,
prepend="ad_", no_pitch_correction=False, output_dir="videos_with_ad",
alignment_dir="alignment_plots", extension="copy", display_func=None):
prepend="ad_", no_pitch_correction=False, output_dir=default_output_dir,
alignment_dir=default_alignment_dir, extension="copy", display_func=None):
video_files, video_file_types = get_sorted_filenames(video, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS)

if yes == False and sum(video_file_types) > 0:
Expand Down Expand Up @@ -956,8 +960,8 @@ def read_config_file(config_path):
'boost_sensitivity': config.getfloat('alignment', 'boost_sensitivity', fallback=.4),
'prepend': config.get('alignment', 'prepend', fallback='ad_'),
'no_pitch_correction': config.getboolean('alignment', 'no_pitch_correction', fallback=False),
'output_dir': config.get('alignment', 'output_dir', fallback='videos_with_ad'),
'alignment_dir': config.get('alignment', 'alignment_dir', fallback='alignment_plots'),
'output_dir': config.get('alignment', 'output_dir', fallback=default_output_dir),
'alignment_dir': config.get('alignment', 'alignment_dir', fallback=default_alignment_dir),
'extension': config.get('alignment', 'extension', fallback='copy')}
if not config.has_section('alignment'):
write_config_file(config_path, settings)
Expand Down Expand Up @@ -1192,9 +1196,9 @@ def error(self, message):
parser.add_argument('--no_pitch_correction', action='store_true',
help='Skips pitch correction step when stretching audio. ' + \
'Requires --stretch_audio to be set, otherwise does nothing.')
parser.add_argument("--output_dir", default="videos_with_ad",
parser.add_argument("--output_dir", default=default_output_dir,
help='Directory combined output media is saved to. Default is "videos_with_ad"')
parser.add_argument("--alignment_dir", default="alignment_plots",
parser.add_argument("--alignment_dir", default=default_alignment_dir,
help='Directory alignment data and plots are saved to. Default is "alignment_plots"')
parser.add_argument("--extension", default="copy",
help='File type of output video (e.g. mkv). When set to "copy", copies the ' + \
Expand Down

0 comments on commit 59295f1

Please sign in to comment.