|
@@ -30,6 +30,7 @@ from select import select
|
|
|
from time import sleep
|
|
|
from urllib.parse import urlparse
|
|
|
import subprocess
|
|
|
+import hashlib
|
|
|
|
|
|
# ABCMeta
|
|
|
from abc import ABCMeta, abstractmethod
|
|
@@ -717,6 +718,10 @@ class AlbumArt(Worker, threading.Thread):
|
|
|
def extractCoverArt(self, config, current):
|
|
|
if 'file' in current:
|
|
|
song_file = config + '/' + current['file']
|
|
|
+ cache_file = self.TEMP_DIR + '/' + hashlib.sha256(song_file.encode()).hexdigest() + '.jpg'
|
|
|
+ if os.path.exists(cache_file):
|
|
|
+ return cache_file
|
|
|
+
|
|
|
if urlparse(song_file).scheme == 'smb':
|
|
|
song_path = config + '/' + os.path.dirname(current['file'])
|
|
|
song_ext = os.path.splitext(current['file'])[1]
|
|
@@ -738,9 +743,9 @@ class AlbumArt(Worker, threading.Thread):
|
|
|
del smb
|
|
|
|
|
|
if os.path.exists(song_file):
|
|
|
- r = subprocess.run([self.EXTRACTCA, song_file, self.TEMP_DIR+'/aa.jpg'])
|
|
|
+ r = subprocess.run([self.EXTRACTCA, song_file, cache_file])
|
|
|
if r.returncode == 0:
|
|
|
- return (self.TEMP_DIR+'/aa.jpg')
|
|
|
+ return cache_file
|
|
|
else:
|
|
|
return None
|
|
|
else:
|