added fallback for local cover discovery
This commit is contained in:
parent
9171871af0
commit
bd8365f489
1 changed files with 19 additions and 6 deletions
25
mcg.py
25
mcg.py
|
@ -6,13 +6,16 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import mpd
|
|
||||||
import os
|
|
||||||
import threading
|
|
||||||
import queue
|
|
||||||
from hashlib import md5
|
|
||||||
import urllib.request
|
|
||||||
import configparser
|
import configparser
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import queue
|
||||||
|
import threading
|
||||||
|
import urllib.request
|
||||||
|
from hashlib import md5
|
||||||
|
|
||||||
|
import mpd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -530,6 +533,16 @@ class MCGAlbum:
|
||||||
filename = os.path.join(self._image_dir, path, '.'.join([name, ext]))
|
filename = os.path.join(self._image_dir, path, '.'.join([name, ext]))
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
return filename
|
return filename
|
||||||
|
return self._find_cover_local_fallback()
|
||||||
|
|
||||||
|
|
||||||
|
def _find_cover_local_fallback(self):
|
||||||
|
for path in self._pathes:
|
||||||
|
for ext in self._FILE_EXTS:
|
||||||
|
filename = os.path.join(self._image_dir, path, "*."+ext)
|
||||||
|
files = glob.glob(filename)
|
||||||
|
if len(files) > 0:
|
||||||
|
return files[0]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue