commit 3f655faddf6a1c6c7b0ad4d1f876195191c4509a
parent e132740e7229762c457312bc37b206fa46496e73
Author: gearsix <gearsix@tuta.io>
Date:   Thu,  1 Dec 2022 17:01:05 +0000
v1.0.1 minor changes & fixe
- added version to sya.py
- automatically set output on init if tracklist passed as argument
- set window title for logger to base name of output directory
- fix track number in title
- logger is moved right of the options window
- minor improvements to Timestamp
- added window title & icon to help window
Diffstat:
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/sya-pyqt.py b/sya-pyqt.py
@@ -140,7 +140,7 @@ class SyaGui(qtwidg.QMainWindow):
         self.loggerTextbox.clear()
     
     def show_help(self):
-        x = self.options.x() - self.options.width() - 50
+        x = self.options.x() - self.options.width() - 100
         y = self.options.y() - self.options.height()
         self.help.move(x, y)
         self.help.show()
@@ -151,6 +151,10 @@ class SyaGui(qtwidg.QMainWindow):
         self.optionsHelp.setEnabled(True)
 
     def preMain(self):
+        x = self.options.x() + self.options.width() + 50
+        y = self.options.y() - self.options.height()
+        self.logger.move(x, y)
+        self.logger.setWindowTitle('sya {}'.format(self.fnSyaArgs.output))
         self.optionsOk.setEnabled(False)
         self.loggerDone.setEnabled(False)
 
@@ -168,7 +172,6 @@ class SyaGui(qtwidg.QMainWindow):
         self.main_t.started.connect(self.preMain)
         self.main_t.finished.connect(self.postMain)
 
-        self.logger.setWindowTitle(self.fnSyaArgs.output)
         self.logger.show()
         self.running += 1
         self.main_t.start()
@@ -229,6 +232,8 @@ class SyaGui(qtwidg.QMainWindow):
     def _init_options_output(self):
         label = self.outputLabel
         layout, self.optionsOutput = sya_gui_filepicker(self.options, label, self.select_output, self.set_output, self.optionsValue[label], 'folder')
+        if self.optionsValue[self.tracklistLabel] != None and self.optionsValue[self.tracklistLabel] != '':
+            self.set_output(os.path.splitext(self.optionsValue[self.tracklistLabel])[0])
         return layout
 
     def _init_options_keep(self):
@@ -292,6 +297,8 @@ class SyaGui(qtwidg.QMainWindow):
     # Help Widget
     def _init_help(self):
         self.help = qtwidg.QTextEdit()
+        self.help.setWindowIcon(qtgui.QIcon(resource_path('sya.png')))
+        self.help.setWindowTitle('sya help')
         with open(resource_path("HELP.md")) as f:
             self.help.setMarkdown(f.read())
         self.help.resize(500, 500)
diff --git a/sya.py b/sya.py
@@ -7,7 +7,9 @@ import re
 import os
 import sys
 
-Timestamp = re.compile('[\[\(]?((\d+:)+(\d+))[\]\)]?')
+Version = 'v1.0.1'
+
+Timestamp = re.compile('(?:[\t ]+?)?[\[\(]+?((\d+[:.])+(\d+))[\]\)]?(?:[\t ]+)?')
 
 class TracklistItem:
     def __init__(self, timestamp, title):
@@ -64,7 +66,7 @@ def parse_tracks(tracklist):
                 continue
             elif Timestamp.match(l):
                 if timestamp == None or weightR > weightL:
-                    timestamp = l.strip('[()]')
+                    timestamp = l.strip(' \t[()]')
                 if i == 0:
                     weightL += 1
                 else: