Skip to content

Commit

Permalink
Refactor regexps in PATTERNS
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrihub committed Jun 15, 2024
1 parent 0966042 commit e6b7735
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions beetsplug/fromfilename.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
# Filename field extraction patterns.
PATTERNS = [
# Useful patterns.
r"^(?P<artist>.+)[\-_](?P<title>.+)[\-_](?P<tag>.*)$",
r"^(?P<track>\d+)[\s.\-_]+(?P<artist>.+)[\-_](?P<title>.+)[\-_](?P<tag>.*)$",
r"^(?P<artist>.+)[\-_](?P<title>.+)$",
r"^(?P<track>\d+)[\s.\-_]+(?P<artist>.+)[\-_](?P<title>.+)$",
r"^(?P<track>\d+)[\s.\-_]+(?P<title>.+)$",
r"^(?P<track>\d+)\s+(?P<title>.+)$",
(r"^(?P<track>\d+)\.?\s*-\s*(?P<artist>.+?)\s*-\s*(?P<title>.+?)"
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<title>.+) by (?P<artist>.+)$",
r"^(?P<track>\d+).*$",
r"^(?P<title>.+)$",
Expand Down

0 comments on commit e6b7735

Please sign in to comment.