Skip to content

Commit

Permalink
CodeFactor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
djdembeck committed Aug 30, 2021
1 parent 5893fbb commit 6511fbd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
12 changes: 6 additions & 6 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ 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')

def getImageUrlFromXPath(self, source, query):
img = source.xpath(query)

if len(img) == 0:
if not img:
return None

return img[0].get('src')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -851,15 +851,15 @@ 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')

def getImageUrlFromXPath(self, source, query):
img = source.xpath(query)

if len(img) == 0:
if not img:
return None

return img[0].get('src')
Expand Down
2 changes: 1 addition & 1 deletion Contents/Code/search_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions Contents/Code/update_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 6511fbd

Please sign in to comment.