mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-12 21:22:17 +00:00
scandir for covers too
This commit is contained in:
parent
007a6e139b
commit
0bb61b6c7d
@ -7,11 +7,13 @@
|
||||
#
|
||||
# Distributed under terms of the GNU AGPLv3 license.
|
||||
|
||||
import os, os.path
|
||||
import os.path
|
||||
import re
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from .py23 import scandir
|
||||
|
||||
EXTENSIONS = (".jpg", ".jpeg", ".png", ".bmp")
|
||||
NAMING_SCORE_RULES = (
|
||||
("cover", 5),
|
||||
@ -67,16 +69,11 @@ def find_cover_in_folder(path, album_name=None):
|
||||
raise ValueError("Invalid path")
|
||||
|
||||
candidates = []
|
||||
for f in os.listdir(path):
|
||||
try:
|
||||
file_path = os.path.join(path, f)
|
||||
except UnicodeError:
|
||||
for entry in scandir(path):
|
||||
if not is_valid_cover(entry.path):
|
||||
continue
|
||||
|
||||
if not is_valid_cover(file_path):
|
||||
continue
|
||||
|
||||
cover = CoverFile(f, album_name)
|
||||
cover = CoverFile(entry.name, album_name)
|
||||
candidates.append(cover)
|
||||
|
||||
if not candidates:
|
||||
|
Loading…
Reference in New Issue
Block a user