Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion beetsplug/fromfilename.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
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"^(track ?)?(?P<track>\d+).*$",
r"^(?P<title>.+)$",
]

Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ New features
Archives are preserved if any file in the archive was not imported (e.g.
skipped as a duplicate, or the import was aborted), and in non-move import
modes.
- :doc:`plugins/fromfilename`: Support ``track`` prefix when parsing the track
number from the filename (e.g., ``track01.m4a``).

..
Bug fixes
Expand Down
4 changes: 4 additions & 0 deletions test/plugins/test_fromfilename.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def __init__(self, items):
("/tmp/Song One.m4a", 0, "", "Song One"),
("/tmp/Song Two.m4a", 0, "", "Song Two"),
),
(
("/tmp/track01.m4a", 1, "", "track01"),
("/tmp/track 2.m4a", 2, "", "track 2"),
),
],
)
def test_fromfilename(song1, song2):
Expand Down
Loading