Closed KurtzPT closed 3 years ago
HTTP API does give the option for 'tag' tag in series xml like you pasted. I believe HAMA should display the same as AniDB anime page, so should do away from the weight, especially if meaningful tags like "Shonen" are ignored
Change line 202 from:
if GetXml(tag, 'name') and tag.get('weight', '').isdigit() and int(tag.get('weight', '') or '200') >= int(Prefs['MinimumWeight'] or '200'):
To:
if tag.get('infobox', ''):
And report if it behaves correctly
https://github.com/ZeroQI/Hama.bundle/blob/master/Contents/Code/AniDB.py LINES 199-216 for the genre code:
### genre ###
RESTRICTED_GENRE = {"18 restricted": 'X', "pornography": 'X', "tv censoring": 'TV-MA', "borderline porn": 'TV-MA'}
for tag in xml.xpath('tags/tag'):
if GetXml(tag, 'name') and tag.get('weight', '').isdigit() and int(tag.get('weight', '') or '200') >= int(Prefs['MinimumWeight'] or '200'):
SaveDict( [string.capwords(GetXml(tag, 'name'), '-')], AniDB_dict, 'genres')
if GetXml(tag, 'name').lower() in RESTRICTED_GENRE: AniDB_dict['content_rating'] = RESTRICTED_GENRE[ GetXml(tag, 'name').lower() ]
if Dict(AniDB_dict, 'genres'): AniDB_dict['genres'].sort()
SaveDict( "Continuing" if GetXml(xml, 'Anime/enddate')=="1970-01-01" else "Ended", AniDB_dict, 'status')
Log.Info("[ ] genres ({}/{} above {} weight): {}".format(len(Dict(AniDB_dict, 'genres')), len(xml.xpath('tags/tag')), int(Prefs['MinimumWeight'] or 200), Dict(AniDB_dict, 'genres')))
for element in AniDBMovieSets.xpath("/anime-set-list/set/anime"):
if element.get('anidbid') == AniDBid or element.get('anidbid') in full_array:
node = element.getparent()
title, main, language_rank = GetAniDBTitle(node.xpath('titles')[0])
if title not in Dict(AniDB_dict, 'collections', default=[]):
Log.Info("[ ] title: {}, main: {}, language_rank: {}".format(title, main, language_rank))
SaveDict([title], AniDB_dict, 'collections')
Log.Info("[ ] collection: AniDBid '%s' is part of movie collection: '%s', related_anime_list: %s" % (AniDBid, title, str(full_array)))
if not Dict(AniDB_dict, 'collections'): Log.Info("[ ] collection: AniDBid '%s' is not part of any collection, related_anime_list: %s" % (AniDBid, str(full_array)))
#roles ### NEW, NOT IN Plex FrameWork Documentation 2.1.1 ###
Log.Info(("--- %s.actors ---" % AniDBid).ljust(157, '-'))
for role in xml.xpath('characters/character[(@type="secondary cast in") or (@type="main character in")]'):
try:
if GetXml(role, 'seiyuu') and GetXml(role, 'name'):
role_dict = {'role': role.find('name').text, 'name': role.find('seiyuu').text, 'photo': ANIDB_PIC_BASE_URL + role.find('seiyuu').get('picture')}
SaveDict([role_dict], AniDB_dict, 'roles')
Log.Info('[ ] role: {:<20}, name: {:<20}, photo: {}'.format(role_dict['role'], role_dict['name'], role_dict['photo']))
except Exception as e: Log.Info("Seyiuu error: {}".format(e))
HTTP API does give the option for 'tag' tag in series xml like you pasted.
it does, check this URL and CTRL+F infobox
, you should have 5 matches which correspondes to the 5 genres the anime has on AniDB page: https://anidb.net/anime/4196
I'll give it a try that change later tomorrow and report if it worked.
Did it work as expected?
That change did work, I'll try later to submit a PR with an optional flag on hama settings to activate this behavior if enabled.
Do we need a setting though? If the behaviour is the same as AniDB web page, I am ok with that being the only setting
I mean the weight option is working fine, I'm in favor of adding new features and having more options than removing them. Submitted the PR #467
AniDB genres at the moment are chosen via a weight number on the Hama settings page with the option
AniDB genre minimum weight
. So if I choose 400 here, plex will use all tags that have 400 or more weight on the API response.Unfortunately the main page of each anime series on AniDB doesn't go for this logic, but instead uses a specific attribute called "infobox". If this attribute is set to true for one genre, that genre will appear on the AniDB series main page.
My suggestion is having something like a checkbox on the Hama settings that if checked will use the AniDB logic and ignore the weight number altogether. I would rather use this logic instead of the weight one which either puts way too many genres and fails to put important genres that are usually set with the weight as zero.
Example of an API response with the attribute set to true and with weight at zero: