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