Download fanart en bigger poster when needed
This commit is contained in:
@@ -111,18 +111,20 @@ class LibraryPlugin(Plugin):
|
|||||||
|
|
||||||
# Files
|
# Files
|
||||||
images = info.get('images', [])
|
images = info.get('images', [])
|
||||||
for type in images:
|
for image_type in ['poster']:
|
||||||
for image in images[type]:
|
for image in images.get(image_type, []):
|
||||||
if not isinstance(image, str):
|
if not isinstance(image, (str, unicode)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
file_path = fireEvent('file.download', url = image, single = True)
|
file_path = fireEvent('file.download', url = image, single = True)
|
||||||
if file_path:
|
if file_path:
|
||||||
file_obj = fireEvent('file.add', path = file_path, type_tuple = ('image', type), single = True)
|
file_obj = fireEvent('file.add', path = file_path, type_tuple = ('image', image_type), single = True)
|
||||||
try:
|
try:
|
||||||
file_obj = db.query(File).filter_by(id = file_obj.get('id')).one()
|
file_obj = db.query(File).filter_by(id = file_obj.get('id')).one()
|
||||||
library.files.append(file_obj)
|
library.files.append(file_obj)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
break
|
||||||
except:
|
except:
|
||||||
log.debug('Failed to attach to library: %s', traceback.format_exc())
|
log.debug('Failed to attach to library: %s', traceback.format_exc())
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,18 @@ class MetaDataBase(Plugin):
|
|||||||
if file_type.get('identifier') == wanted_file_type:
|
if file_type.get('identifier') == wanted_file_type:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# See if it is in current files
|
||||||
for cur_file in data['library'].get('files', []):
|
for cur_file in data['library'].get('files', []):
|
||||||
if cur_file.get('type_id') is file_type.get('id') and os.path.isfile(cur_file.get('path')):
|
if cur_file.get('type_id') is file_type.get('id') and os.path.isfile(cur_file.get('path')):
|
||||||
return cur_file.get('path')
|
return cur_file.get('path')
|
||||||
|
|
||||||
|
# Download using existing info
|
||||||
|
try:
|
||||||
|
images = data['library']['info']['images'][wanted_file_type]
|
||||||
|
file_path = fireEvent('file.download', url = images[0], single = True)
|
||||||
|
return file_path
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def getFanart(self, movie_info = {}, data = {}):
|
def getFanart(self, movie_info = {}, data = {}):
|
||||||
return self.getThumbnail(movie_info = movie_info, data = data, wanted_file_type = 'backdrop_original')
|
return self.getThumbnail(movie_info = movie_info, data = data, wanted_file_type = 'backdrop_original')
|
||||||
|
|||||||
Reference in New Issue
Block a user