commit 8119c02c7aa3702da3833381dce1ac2037402ce4
parent 0ccde1a9477b53b04d33c07b1f0f481e8d77706a
Author: gearsix <gearsix@tuta.io>
Date: Mon, 7 Nov 2022 22:51:09 +0000
minor fixes & adjustments to argument defaults
- default yt-dlp & ffmpeg argument have '.exe' on default for windows (if not provided)
- sya-pyqt accepts yt-dlp & ffmpeg args (without overriding for bundled)
- bugfix to logger text cursor, now it *always* appends (even if you click to move it)
- check_options_ok called on *any* options change
Diffstat:
2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/sya-pyqt.py b/sya-pyqt.py
@@ -110,9 +110,8 @@ class SyaGui(qtwidg.QMainWindow):
# Runtime Methods
def log(self, msg):
- cursor = self.loggerTextbox.textCursor()
- cursor.insertText(msg)
- self.loggerTextbox.setTextCursor(cursor)
+ self.loggerTextbox.moveCursor(qtgui.QTextCursor.End)
+ self.loggerTextbox.textCursor().insertText(msg)
self.loggerTextbox.ensureCursorVisible()
def cancel(self):
@@ -257,14 +256,17 @@ class SyaGui(qtwidg.QMainWindow):
if option not in self.availableFormats:
return
self.optionsValue[self.formatLabel] = option
+ self.update_options_ok()
def set_quality(self, option):
if option not in self.availableQualities:
return
self.optionsValue[self.qualityLabel] = option
+ self.update_options_ok()
def toggle_keep(self):
self.optionsValue[self.keepLabel] = not self.optionsValue[self.keepLabel]
+ self.update_options_ok()
def update_options_ok(self):
tracklist = self.optionsValue[self.tracklistLabel]
@@ -316,11 +318,10 @@ if __name__ == '__main__':
args.tracklist = ''
if args.output is None:
args.output = ''
- args.youtubedl = resource_path('yt-dlp')
- args.ffmpeg = resource_path('ffmpeg')
- if sys.platform == 'win32':
- args.youtubedl += '.exe'
- args.ffmpeg += '.exe'
+ if args.youtubedl == None:
+ args.youtubedl = resource_path('yt-dlp') if sys.platform != 'win32' else resource_path('yt-dlp.exe')
+ if args.ffmpeg == None:
+ args.youtubedl = resource_path('ffmpeg') if sys.platform != 'win32' else resource_path('ffmpeg.exe')
gui = SyaGui(sya.sya, args)
sys.exit(app.exec_())
diff --git a/sya.py b/sya.py
@@ -113,21 +113,32 @@ def parse_args():
parser.add_argument('tracklist', metavar='TRACKLIST', nargs='?',
help='tracklist to split audio by')
# options
- parser.add_argument('-o', '--output', metavar='PATH', type=str, nargs='?', dest='output',
+ parser.add_argument('-o', '--output',
+ metavar='PATH', type=str, nargs='?', dest='output',
help='specify the directory to write output files to (default: ./out)')
- parser.add_argument('-f', '--format', type=str, nargs='?', default='mp3', dest='format',
+ parser.add_argument('-f', '--format',
+ type=str, nargs='?', default='mp3', dest='format',
help='specify the --audio-format argument to pass to yt-dlp (default: mp3)')
- parser.add_argument('-q', '--quality', type=str, nargs='?', default='320K', dest='quality',
+ parser.add_argument('-q', '--quality',
+ type=str, nargs='?', default='320K', dest='quality',
help='specify the --audio-quality argument to pass to yt-dlp (default: 320K)')
- parser.add_argument('--yt-dlp', metavar='PATH', type=str, nargs='?', default='yt-dlp', dest='youtubedl',
+ parser.add_argument('--yt-dlp',
+ metavar='PATH', type=str, nargs='?', dest='youtubedl',
help='path of the "yt-dlp" binary to use')
- parser.add_argument('--ffmpeg', metavar='PATH', type=str, nargs='?', default='ffmpeg', dest='ffmpeg',
+ parser.add_argument('--ffmpeg',
+ metavar='PATH', type=str, nargs='?', dest='ffmpeg',
help='path of the "ffmpeg" binary to use')
- parser.add_argument('-k', '--keep', action='store_true', default=False, dest='keep',
+ parser.add_argument('-k', '--keep',
+ action='store_true', default=False, dest='keep',
help='keep any files removed during processing (full video/audio file)')
return parser.parse_args()
def sya(args):
+ if args.youtubedl == None:
+ args.youtubedl = 'yt-dlp.exe' if sys.platform == 'win32' else 'yt-dlp'
+ if args.ffmpeg == None:
+ args.ffmpeg = 'ffmpeg.exe' if sys.platform == 'win32' else 'ffmpeg'
+
if check_bin(args.youtubedl, args.ffmpeg) == False:
error_exit('required binaries are missing')
if args.tracklist == None or os.path.exists(args.tracklist) == False: