mirror of
https://github.com/beetbox/beets.git
synced 2026-02-04 06:24:13 +01:00
parent
6d6a055fa9
commit
588ecd0d7b
2 changed files with 13 additions and 6 deletions
|
|
@ -153,10 +153,14 @@ def google_art(album):
|
|||
|
||||
# Art from the filesystem.
|
||||
|
||||
def sort_by_keywords_priority(image, cover_names):
|
||||
"""Sorting function for image names. Return indexes of cover names found
|
||||
in the image filename."""
|
||||
return [idx for (idx, x) in enumerate(cover_names) if x in image]
|
||||
def filename_priority(filename, cover_names):
|
||||
"""Sort order for image names.
|
||||
|
||||
Return indexes of cover names found in the image filename. This
|
||||
means that images with lower-numbered and more keywords will have higher
|
||||
priority.
|
||||
"""
|
||||
return [idx for (idx, x) in enumerate(cover_names) if x in filename]
|
||||
|
||||
|
||||
def art_in_path(path, cover_names, cautious):
|
||||
|
|
@ -172,8 +176,7 @@ def art_in_path(path, cover_names, cautious):
|
|||
images.append(fn)
|
||||
|
||||
# Look for "preferred" filenames.
|
||||
images = sorted(images, key=lambda x: sort_by_keywords_priority(x,
|
||||
cover_names))
|
||||
images = sorted(images, key=lambda x: filename_priority(x, cover_names))
|
||||
cover_pat = r"(\b|_)({0})(\b|_)".format('|'.join(cover_names))
|
||||
for fn in images:
|
||||
if re.search(cover_pat, os.path.splitext(fn)[0], re.I):
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ Little improvements and fixes:
|
|||
the previous release.)
|
||||
* :doc:`/plugins/replaygain`: Logging is now quieter during import. Thanks to
|
||||
Yevgeny Bezman.
|
||||
* :doc:`/plugins/fetchart`: When loading art from the filesystem, we now
|
||||
prioritize covers with more keywords in them. This means that
|
||||
``cover-front.jpg`` will now be taken before ``cover-back.jpg`` because it
|
||||
contains two keywords rather than one.
|
||||
|
||||
|
||||
1.3.6 (May 10, 2014)
|
||||
|
|
|
|||
Loading…
Reference in a new issue