mirror of
https://github.com/beetbox/beets.git
synced 2026-01-20 23:24:28 +01:00
Refactored some regular expressions. Added changelog entry
Some more changes to the regular expressions in the "PATTERNS" list. Also allow "_" as a separator, where only "-" was allowed. Replaced similar regexps containing different combinations of \s, "-", "." with a single regexp using a set of characters [\s.\-_].
This commit is contained in:
parent
7132ad094b
commit
84cf3361ce
2 changed files with 8 additions and 12 deletions
|
|
@ -28,18 +28,13 @@ import six
|
||||||
# Filename field extraction patterns.
|
# Filename field extraction patterns.
|
||||||
PATTERNS = [
|
PATTERNS = [
|
||||||
# Useful patterns.
|
# Useful patterns.
|
||||||
r'^(?P<artist>.+)-(?P<title>.+)-(?P<tag>.*)$',
|
r'^(?P<artist>.+)[\-_](?P<title>.+)[\-_](?P<tag>.*)$',
|
||||||
r'^(?P<track>\d+)\s*-(?P<artist>.+)-(?P<title>.+)-(?P<tag>.*)$',
|
r'^(?P<track>\d+)[\s.\-_]+(?P<artist>.+)[\-_](?P<title>.+)[\-_](?P<tag>.*)$',
|
||||||
r'^(?P<track>\d+)\s(?P<artist>.+)-(?P<title>.+)-(?P<tag>.*)$',
|
r'^(?P<artist>.+)[\-_](?P<title>.+)$',
|
||||||
r'^(?P<artist>.+)-(?P<title>.+)$',
|
r'^(?P<track>\d+)[\s.\-_]+(?P<artist>.+)[\-_](?P<title>.+)$',
|
||||||
r'^(?P<track>\d+)\.\s*(?P<artist>.+)-(?P<title>.+)$',
|
|
||||||
r'^(?P<track>\d+)\s*-\s*(?P<artist>.+)-(?P<title>.+)$',
|
|
||||||
r'^(?P<track>\d+)\s*-(?P<artist>.+)-(?P<title>.+)$',
|
|
||||||
r'^(?P<track>\d+)\s(?P<artist>.+)-(?P<title>.+)$',
|
|
||||||
r'^(?P<title>.+)$',
|
r'^(?P<title>.+)$',
|
||||||
r'^(?P<track>\d+)\.\s*(?P<title>.+)$',
|
r'^(?P<track>\d+)[\s.\-_]+(?P<title>.+)$',
|
||||||
r'^(?P<track>\d+)\s*-\s*(?P<title>.+)$',
|
r'^(?P<track>\d+)\s+(?P<title>.+)$',
|
||||||
r'^(?P<track>\d+)\s(?P<title>.+)$',
|
|
||||||
r'^(?P<title>.+) by (?P<artist>.+)$',
|
r'^(?P<title>.+) by (?P<artist>.+)$',
|
||||||
r'^(?P<track>\d+).*$',
|
r'^(?P<track>\d+).*$',
|
||||||
]
|
]
|
||||||
|
|
@ -47,7 +42,6 @@ PATTERNS = [
|
||||||
# Titles considered "empty" and in need of replacement.
|
# Titles considered "empty" and in need of replacement.
|
||||||
BAD_TITLE_PATTERNS = [
|
BAD_TITLE_PATTERNS = [
|
||||||
r'^$',
|
r'^$',
|
||||||
r'\d+?\s?-?\s*track\s*\d+',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ Fixes:
|
||||||
"Edit Candidates" option is used. :bug:`2734`
|
"Edit Candidates" option is used. :bug:`2734`
|
||||||
* Fix a crash when numeric metadata fields contain just a minus or plus sign
|
* Fix a crash when numeric metadata fields contain just a minus or plus sign
|
||||||
with no following numbers. Thanks to :user:`eigengrau`. :bug:`2741`
|
with no following numbers. Thanks to :user:`eigengrau`. :bug:`2741`
|
||||||
|
* :doc:`/plugins/fromfilename`: Allow file names such as "01.mp3" to extract the track number.
|
||||||
|
Also allow "_" as a separator. Refactor some regular expressions. :bug:`2738`
|
||||||
|
|
||||||
For developers:
|
For developers:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue