@@ -1,9 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from couchpotato import CPLog
|
from couchpotato import CPLog, md5
|
||||||
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
|
from couchpotato.core.event import addEvent, fireEvent, fireEventAsync
|
||||||
from couchpotato.core.helpers.encoding import toUnicode
|
from couchpotato.core.helpers.encoding import toUnicode
|
||||||
|
from couchpotato.core.helpers.variable import getExt
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@@ -92,7 +93,15 @@ class MediaBase(Plugin):
|
|||||||
if not isinstance(image, (str, unicode)):
|
if not isinstance(image, (str, unicode)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if file_type not in existing_files or len(existing_files.get(file_type, [])) == 0:
|
# Check if it has top image
|
||||||
|
filename = '%s.%s' % (md5(image), getExt(image))
|
||||||
|
existing = existing_files.get(file_type, [])
|
||||||
|
has_latest = False
|
||||||
|
for x in existing:
|
||||||
|
if filename in x:
|
||||||
|
has_latest = True
|
||||||
|
|
||||||
|
if not has_latest or file_type not in existing_files or len(existing_files.get(file_type, [])) == 0:
|
||||||
file_path = fireEvent('file.download', url = image, single = True)
|
file_path = fireEvent('file.download', url = image, single = True)
|
||||||
if file_path:
|
if file_path:
|
||||||
existing_files[file_type] = [toUnicode(file_path)]
|
existing_files[file_type] = [toUnicode(file_path)]
|
||||||
|
|||||||
Reference in New Issue
Block a user