From 6511fbdfdbaa7fe6a182e384737e98e8420f3b14 Mon Sep 17 00:00:00 2001 From: djdembeck Date: Mon, 30 Aug 2021 16:12:04 -0500 Subject: [PATCH] CodeFactor updates --- Contents/Code/__init__.py | 12 ++++++------ Contents/Code/search_tools.py | 2 +- Contents/Code/update_tools.py | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Contents/Code/__init__.py b/Contents/Code/__init__.py index 75ca219..738fa07 100644 --- a/Contents/Code/__init__.py +++ b/Contents/Code/__init__.py @@ -70,7 +70,7 @@ def getStringContentFromXPath(self, source, query): def getAnchorUrlFromXPath(self, source, query): anchor = source.xpath(query) - if len(anchor) == 0: + if not anchor: return None return anchor[0].get('href') @@ -78,7 +78,7 @@ def getAnchorUrlFromXPath(self, source, query): def getImageUrlFromXPath(self, source, query): img = source.xpath(query) - if len(img) == 0: + if not img: return None return img[0].get('src') @@ -468,9 +468,9 @@ def score_result(self, f, helper, i, info, valid_itemId, year): ) # Because builtin sum() isn't available - sum=lambda numberlist:reduce(lambda x,y:x+y,numberlist,0) + sum_scores=lambda numberlist:reduce(lambda x,y:x+y,numberlist,0) # Subtract difference from initial score - score = INITIAL_SCORE - sum(all_scores) + score = INITIAL_SCORE - sum_scores(all_scores) log.info("Result #" + str(i + 1)) # Log basic metadata @@ -851,7 +851,7 @@ def getStringContentFromXPath(self, source, query): def getAnchorUrlFromXPath(self, source, query): anchor = source.xpath(query) - if len(anchor) == 0: + if not anchor: return None return anchor[0].get('href') @@ -859,7 +859,7 @@ def getAnchorUrlFromXPath(self, source, query): def getImageUrlFromXPath(self, source, query): img = source.xpath(query) - if len(img) == 0: + if not img: return None return img[0].get('src') diff --git a/Contents/Code/search_tools.py b/Contents/Code/search_tools.py index adb2cbf..74360db 100644 --- a/Contents/Code/search_tools.py +++ b/Contents/Code/search_tools.py @@ -82,7 +82,7 @@ def pre_search_logging(self): self.media.album = self.media.name def strip_title(self, normalizedName): - if len(normalizedName) == 0: + if not normalizedName: normalizedName = self.media.album log.debug( 'normalizedName = %s', normalizedName diff --git a/Contents/Code/update_tools.py b/Contents/Code/update_tools.py index 2d2461d..2b551b0 100644 --- a/Contents/Code/update_tools.py +++ b/Contents/Code/update_tools.py @@ -80,11 +80,9 @@ def writeInfo(self): # Log basic metadata stored in arrays multi_arr = [ - # {'Collection': self.metadata.collections}, - {'Genre': self.metadata.genres}, + {'Genres & Series': self.metadata.genres}, {'Moods(Authors)': self.metadata.moods}, {'Styles(Narrators)': self.metadata.styles}, - # {'Fan art URL': self.metadata.art}, ] log.metadata_arrs(multi_arr, log_level="info")