commit 606bedaf766fd3368790d72704192f1ca819003b
parent d3d274dc6618b8a6ca7a4848202fda81fae82a0b
Author: gearsix <gearsix@tuta.io>
Date: Thu, 1 Dec 2022 21:26:26 +0000
Merge branch 'develop' into develop-v1.1.0
Diffstat:
4 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/BUGS.md b/BUGS.md
@@ -12,7 +12,9 @@
---
-**2021-07-31** [ ] don't apply file numbering when song names include file number already
+**2021-07-31** [*] don't apply file numbering when song names include file number already
+
+ - Instead file numbering is just removed from track titles using regex.
#regex-improvement
diff --git a/setup.py b/setup.py
@@ -3,17 +3,17 @@ import setuptools
DESC='download & split long youtube videos as audio tracks'
LONG_DESC='download long youtube videos as audio tracks using youtube-dl and split them into multiple audio tracks using ffmpeg.'
-with open('README.txt', 'r') as f:
+with open('README.md', 'r') as f:
LONG_DESC = f.read()
setuptools.setup(
name='sya',
- version='0.8.0',
+ version='1.0.1',
author='gearsix',
author_email='gearsix@tuta.io',
description=DESC,
long_description=LONG_DESC,
- long_description_content_type='text/plain',
+ long_description_content_type='text/markdown',
url='https://notabug.org/gearsix/sya',
packages=setuptools.find_packages(),
classifiers=[
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,11 @@ import re
import os
import sys
-Timestamp = re.compile('[\[\(]?((\d+:)+(\d+))[\]\)]?')
+Version = 'v1.0.1'
+
+UnsafeFilenameChars = re.compile('[/\\?%*:|\"<>\x7F\x00-\x1F]')
+TrackNum = re.compile('(?:\d+.? ?-? ?)')
+Timestamp = re.compile('(?:[\t ]+?)?[\[\(]+?((\d+[:.])+(\d+))[\]\)]?(?:[\t ]+)?')
class TracklistItem:
def __init__(self, timestamp, title):
@@ -63,7 +67,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:
@@ -72,8 +76,9 @@ def parse_tracks(tracklist):
if timestamp == None:
print('line {}, missing timestamp: "{}"'.format(lcount, line))
- title = ' '.join(sline).strip(' ')
- title = re.sub(r"[/\\?%*:|\"<>\x7F\x00-\x1F]", '', title)
+ line = ' '.join(sline)
+ line = re.sub(TrackNum, '', line)
+ title = re.sub(UnsafeFilenameChars, '', line)
tracks.append(TracklistItem(timestamp, title))
return tracks
@@ -170,7 +175,8 @@ def sya(args):
error_exit('download failed, aborting')
- tracks = parse_tracks(tracklist)
+ tracks = parse_tracks(tracklist[1:])
+
missing = missing_times(tracks)
if len(missing) > 0:
error_exit('some tracks are missing timestamps')