Skip to content

Commit 82914a7

Browse files
committed
Tags source configuration for nfoSceneParser plugin
1 parent b7f6705 commit 82914a7

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

plugins/nfoSceneParser/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
user_rating_field = "userrating"
5252
user_rating_multiplier = 1
5353

54+
# Let you decide from where genres should be loaded from.
55+
# Possible values: "tags", "genres", "both"
56+
load_tags_from = "both"
57+
5458
###############################################################################
5559
# Do not change config below unless you are absolutely sure of what you do...
5660
###############################################################################

plugins/nfoSceneParser/nfoParser.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,20 @@ def __extract_nfo_date(self):
127127
return self._nfo_root.findtext("premiered") or year
128128

129129
def __extract_nfo_tags(self):
130+
source = config.load_tags_from.lower()
130131
file_tags = []
131-
# from nfo <tag>
132-
tags = self._nfo_root.findall("tag")
133-
for tag in tags:
134-
if tag.text:
135-
file_tags.append(tag.text)
136-
# from nfo <genre>
137-
genres = self._nfo_root.findall("genre")
138-
for genre in genres:
139-
if genre.text:
140-
file_tags.append(genre.text)
132+
if source in ["tags", "both"]:
133+
# from nfo <tag>
134+
tags = self._nfo_root.findall("tag")
135+
for tag in tags:
136+
if tag.text:
137+
file_tags.append(tag.text)
138+
if source in ["genres", "both"]:
139+
# from nfo <genre>
140+
genres = self._nfo_root.findall("genre")
141+
for genre in genres:
142+
if genre.text:
143+
file_tags.append(genre.text)
141144
return list(set(file_tags))
142145

143146
def __extract_nfo_actors(self):

0 commit comments

Comments
 (0)