Skip to content

Commit

Permalink
Fix: hotfix for audience rating (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu committed Dec 13, 2023
1 parent c59d6bd commit 3870dc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def update(self, metadata, media, lang, force=False):
_ = review.title # title is never used

# Audience Rating
scores = [i for i in reviews if i.score > 0]
scores = [i.score for i in reviews if i.score > 0]
metadata.audience_rating = utils.average(scores) * 2
metadata.audience_rating_image = self.get_audience_rating_image(metadata.audience_rating)

Expand Down
19 changes: 9 additions & 10 deletions Contents/Code/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def parse_date(s):
return datetime(1, 1, 1) # default value


def parse_list(s):
return [i.strip().upper() for i in s.split(',') if i.strip()]
def parse_list(s, sep=','):
return [i.strip().upper() for i in s.split(sep) if i.strip()]


def parse_table(s, sep=',', b64=False, origin_key=False):
Expand All @@ -47,15 +47,14 @@ def table_substitute(table, items):
return [(table[i.upper()] if i.upper() in table else i) for i in items]


def has_tag(s, *tags):
values = [i.upper() for i in re.split(r'[-_\s]', s)]
for tag in tags:
if tag.upper() in values:
return True
return False


def has_embedded_chinese_subtitle(video_name):
def has_tag(s, *tags):
values = [i.upper() for i in re.split(r'[-_\s]', s)]
for tag in tags:
if tag.upper() in values:
return True
return False

name, ext = os.path.splitext(
os.path.basename(video_name))
if ext.lower() not in VIDEO_EXTENSIONS:
Expand Down

0 comments on commit 3870dc0

Please sign in to comment.