commit 08c6998379374b62dcfdda01d9f2caa685e6c0b3
parent a01f511a70c5a8678db905a98f00b096d85be9ca
Author: gearsix <gearsix@tuta.io>
Date: Thu, 1 Dec 2022 21:09:50 +0000
v1.0.2 Merge branch 'develop'
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sya.py b/sya.py
@@ -9,6 +9,8 @@ import sys
Version = 'v1.0.1'
+UnsafeFilenameChars = re.compile('[/\\?%*:|\"<>\x7F\x00-\x1F]')
+TrackNum = re.compile('(?:\d+.? ?-? ?)')
Timestamp = re.compile('(?:[\t ]+?)?[\[\(]+?((\d+[:.])+(\d+))[\]\)]?(?:[\t ]+)?')
class TracklistItem:
@@ -75,8 +77,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