|
|
@ -149,18 +149,18 @@ class Library(ABC):
|
|
|
|
except Failed as e:
|
|
|
|
except Failed as e:
|
|
|
|
logger.error(e)
|
|
|
|
logger.error(e)
|
|
|
|
|
|
|
|
|
|
|
|
def upload_images(self, item, poster=None, background=None):
|
|
|
|
def upload_images(self, item, poster=None, background=None, overlay=False):
|
|
|
|
image = None
|
|
|
|
|
|
|
|
image_compare = None
|
|
|
|
|
|
|
|
poster_uploaded = False
|
|
|
|
poster_uploaded = False
|
|
|
|
if self.config.Cache:
|
|
|
|
|
|
|
|
image, image_compare, _ = self.config.Cache.query_image_map(item.ratingKey, self.image_table_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if poster is not None:
|
|
|
|
if poster is not None:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if image_compare and str(poster.compare) != str(image_compare):
|
|
|
|
image_compare = None
|
|
|
|
image = None
|
|
|
|
if self.config.Cache:
|
|
|
|
if image is None or image != item.thumb:
|
|
|
|
_, image_compare, _ = self.config.Cache.query_image_map(item.ratingKey, self.image_table_name)
|
|
|
|
|
|
|
|
if not image_compare or str(poster.compare) != str(image_compare):
|
|
|
|
|
|
|
|
test = [la.tag for la in self.item_labels(item)]
|
|
|
|
|
|
|
|
if overlay and "Overlay" in test:
|
|
|
|
|
|
|
|
item.removeLabel("Overlay")
|
|
|
|
|
|
|
|
item.saveEdits()
|
|
|
|
self._upload_image(item, poster)
|
|
|
|
self._upload_image(item, poster)
|
|
|
|
poster_uploaded = True
|
|
|
|
poster_uploaded = True
|
|
|
|
logger.info(f"Detail: {poster.attribute} updated {poster.message}")
|
|
|
|
logger.info(f"Detail: {poster.attribute} updated {poster.message}")
|
|
|
@ -173,12 +173,10 @@ class Library(ABC):
|
|
|
|
background_uploaded = False
|
|
|
|
background_uploaded = False
|
|
|
|
if background is not None:
|
|
|
|
if background is not None:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
image = None
|
|
|
|
image_compare = None
|
|
|
|
if self.config.Cache:
|
|
|
|
if self.config.Cache:
|
|
|
|
image, image_compare, _ = self.config.Cache.query_image_map(item.ratingKey, f"{self.image_table_name}_backgrounds")
|
|
|
|
_, image_compare, _ = self.config.Cache.query_image_map(item.ratingKey, f"{self.image_table_name}_backgrounds")
|
|
|
|
if str(background.compare) != str(image_compare):
|
|
|
|
if not image_compare or str(background.compare) != str(image_compare):
|
|
|
|
image = None
|
|
|
|
|
|
|
|
if image is None or image != item.art:
|
|
|
|
|
|
|
|
self._upload_image(item, background)
|
|
|
|
self._upload_image(item, background)
|
|
|
|
background_uploaded = True
|
|
|
|
background_uploaded = True
|
|
|
|
logger.info(f"Detail: {background.attribute} updated {background.message}")
|
|
|
|
logger.info(f"Detail: {background.attribute} updated {background.message}")
|
|
|
@ -187,12 +185,11 @@ class Library(ABC):
|
|
|
|
except Failed:
|
|
|
|
except Failed:
|
|
|
|
logger.stacktrace()
|
|
|
|
logger.stacktrace()
|
|
|
|
logger.error(f"Detail: {background.attribute} failed to update {background.message}")
|
|
|
|
logger.error(f"Detail: {background.attribute} failed to update {background.message}")
|
|
|
|
|
|
|
|
|
|
|
|
if self.config.Cache:
|
|
|
|
if self.config.Cache:
|
|
|
|
if poster_uploaded:
|
|
|
|
if poster_uploaded:
|
|
|
|
self.config.Cache.update_image_map(item.ratingKey, self.image_table_name, item.thumb, poster.compare if poster else "")
|
|
|
|
self.config.Cache.update_image_map(item.ratingKey, self.image_table_name, "", poster.compare if poster else "")
|
|
|
|
if background_uploaded:
|
|
|
|
if background_uploaded:
|
|
|
|
self.config.Cache.update_image_map(item.ratingKey, f"{self.image_table_name}_backgrounds", item.art, background.compare)
|
|
|
|
self.config.Cache.update_image_map(item.ratingKey, f"{self.image_table_name}_backgrounds", "", background.compare)
|
|
|
|
|
|
|
|
|
|
|
|
return poster_uploaded, background_uploaded
|
|
|
|
return poster_uploaded, background_uploaded
|
|
|
|
|
|
|
|
|
|
|
@ -223,6 +220,10 @@ class Library(ABC):
|
|
|
|
def edit_tags(self, attr, obj, add_tags=None, remove_tags=None, sync_tags=None, do_print=True):
|
|
|
|
def edit_tags(self, attr, obj, add_tags=None, remove_tags=None, sync_tags=None, do_print=True):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
|
|
|
|
def item_labels(self, item):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
@abstractmethod
|
|
|
|
def get_all(self, collection_level=None, load=False):
|
|
|
|
def get_all(self, collection_level=None, load=False):
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|