sya

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

commit ef5ea988c3de5ea2dd3301d883d6af12ebacf89d
parent 6c4c41d8b00b5b9901eedaf334cb0396f916f039
Author: GeaRSiX <gearsix@tuta.io>
Date:   Sat, 29 May 2021 14:33:38 +0100

added default output path back; set get_audio output to {output}/{output dirname}.{ext}

Diffstat:
Msya.py | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/sya.py b/sya.py @@ -6,7 +6,6 @@ import re import os import sys import gui -import PyQt5.QtWidgets as pyqt Timestamp = re.compile('[\[,\(]?(:?\d{1,2}){3}[\],\)]?') @@ -55,10 +54,11 @@ def check_bin(*binaries): print(b, 'failed to execute, check it exists in your $PATH.\n' 'Otherwise you can point to the binary using the relevant optional argument.') -def get_audio(youtubedl, url, format='mp3', quality='320K', keep=True, ffmpeg='ffmpeg'): +def get_audio(youtubedl, url, outdir, format='mp3', quality='320K', keep=True, ffmpeg='ffmpeg'): log('{} getting {}, {} ({})'.format(youtubedl, format, quality, url)) cmd = [youtubedl, url, '--extract-audio', '--audio-format', format, - '--audio-quality', quality, '-o', 'audio.%(ext)s', '--prefer-ffmpeg'] + '--audio-quality', quality, '-o', '{}/{}.%(ext)s'.format(outdir, os.path.basename(outdir)), + '--prefer-ffmpeg'] if keep == True: cmd.append('-k') if ffmpeg != 'ffmpeg': @@ -131,10 +131,12 @@ if __name__ == '__main__': sys.exit() if check_bin(args.youtubedl, args.ffmpeg) == False: error_exit('required binaries are missing') - if args.tracklist == None or args.output == None: - error_exit('tracklist and/or output paths are missing') + if args.tracklist == None: + error_exit('missing tracklist') + if args.output == None: + args.output = "./out" tracklist = load_tracklist(args.tracklist) - audio_fpath = get_audio(args.youtubedl, tracklist[0], + audio_fpath = get_audio(args.youtubedl, tracklist[0], args.output, args.format, args.quality, args.keep, args.ffmpeg) tracks = parse_tracks(tracklist[1:]) missing = missing_times(tracks)