sya

split youtube audio tracks, with an optional pyqt gui
git clone git://src.gearsix.net/sya
Log | Files | Refs | Atom | README

commit 63f7e6e1ab24a8d3246cd97cfe826eecb1016405
parent be83735aba7e9f1d245ca43fb0cab3a78d95c5da
Author: gearsix <gearsix@tuta.io>
Date:   Mon, 27 Mar 2023 11:07:28 +0100

sya: `get_audio` only calls `--ffmpeg-location` if arg `--ffmpeg` is passed.

Diffstat:
Msrc/sya.py | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/sya.py b/src/sya.py @@ -34,12 +34,14 @@ def check_bin(*binaries): error_exit('failed to execute {}'.format(b)) # functions -def get_audio(youtubedl, url, outdir, format='mp3', quality='320K', keep=True, ffmpeg='ffmpeg'): +def get_audio(youtubedl, url, outdir, format='mp3', quality='320K', keep=True, ffmpeg=''): print('Downloading {} ({}, {})...'.format(url, format, quality)) fname = '{}/{}'.format(outdir, os.path.basename(outdir), format) cmd = [youtubedl, '--newline', '--extract-audio', '--audio-format', format, - '--audio-quality', quality, '--prefer-ffmpeg', '--ffmpeg-location', ffmpeg, - '-o', fname + '.%(ext)s'] + '--audio-quality', quality, '-o', fname + '.%(ext)s'] + if ffmpeg != '': + cmd.append('--ffmpeg-location') + cmd.append(ffmpeg) if keep == True: cmd.append('-k') cmd.append(url) @@ -174,8 +176,10 @@ def sya(args): url, tracklist = load_tracklist(t) output = args.output if args.output != None else os.path.splitext(t)[0] - audio_fpath = get_audio(args.youtubedl, url, output, - args.format, args.quality, args.keep, args.ffmpeg) + if args.ffmpeg == 'ffmpeg' or args.ffmpeg == 'ffmpeg.exe': + audio_fpath = get_audio(args.youtubedl, url, output, args.format, args.quality, args.keep, '') + else: + audio_fpath = get_audio(args.youtubedl, url, output, args.format, args.quality, args.keep, args.ffmpeg) if os.path.exists(audio_fpath) == False: error_exit('download failed, aborting')