Improve regexp and module docstring

This commit is contained in:
Vrihub 2025-09-30 15:46:26 +02:00
parent 0ac7fb42f5
commit 80ffa4879d

View file

@ -12,8 +12,8 @@
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
"""If the title is empty, try to extract track and title from the
filename.
"""If the title is empty, try to extract it from the filename
(possibly also extract track and artist)
"""
import os
@ -30,7 +30,7 @@ PATTERNS = [
r"(\s*-\s*(?P<tag>.*))?$"
),
r"^(?P<artist>.+?)\s*-\s*(?P<title>.+?)(\s*-\s*(?P<tag>.*))?$",
r"^(?P<track>\d+)\.?[\s\-_]+(?P<title>.+)$",
r"^(?P<track>\d+)\.?[\s_-]+(?P<title>.+)$",
r"^(?P<title>.+) by (?P<artist>.+)$",
r"^(?P<track>\d+).*$",
r"^(?P<title>.+)$",