Skip to content

Commit 344e032

Browse files
committed
nfoSceneParser plugin config backwards compability
1 parent 5aa428d commit 344e032

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plugins/nfoSceneParser/nfoParser.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, scene_path, defaults=None, folder_mode=False):
2222
# look in current dir & parents for a folder.nfo file...
2323
self._nfo_file = self._find_in_parents(dir_path, "folder.nfo")
2424
else:
25-
if len(config.custom_nfo_name) > 0:
25+
if len(getattr(config, "custom_nfo_name", "")) > 0:
2626
self._nfo_file = os.path.join(dir_path, config.custom_nfo_name)
2727
else:
2828
self._nfo_file = os.path.splitext(scene_path)[0] + ".nfo"
@@ -106,7 +106,8 @@ def __extract_cover_images_b64(self):
106106
return file_images
107107

108108
def __extract_nfo_rating(self):
109-
user_rating = round(float(self._nfo_root.findtext(config.user_rating_field) or 0) * config.user_rating_multiplier)
109+
multiplier = getattr(config, "user_rating_multiplier", 1)
110+
user_rating = round(float(self._nfo_root.findtext(getattr(config, "user_rating_field", "userrating")) or 0) * multiplier)
110111
if user_rating > 0:
111112
return user_rating
112113
# <rating> is converted to a scale of 5 if needed
@@ -127,7 +128,7 @@ def __extract_nfo_date(self):
127128
return self._nfo_root.findtext("premiered") or year
128129

129130
def __extract_nfo_tags(self):
130-
source = config.load_tags_from.lower()
131+
source = getattr(config, "load_tags_from", "both").lower()
131132
file_tags = []
132133
if source in ["tags", "both"]:
133134
# from nfo <tag>

0 commit comments

Comments
 (0)