From 31ab16a8bfb26e5dee62a878a39efd9e172688c3 Mon Sep 17 00:00:00 2001 From: Praxinator <120422552+Praxinator@users.noreply.github.com> Date: Fri, 13 Jan 2023 18:57:45 -0600 Subject: [PATCH] Fix tvdbcount tvdbcount should be calculated in the second, full loop. Also piggybacking off the collection array, no need for a separate dict. --- Contents/Code/AnimeLists.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Contents/Code/AnimeLists.py b/Contents/Code/AnimeLists.py index 4d677b3..a2b1913 100644 --- a/Contents/Code/AnimeLists.py +++ b/Contents/Code/AnimeLists.py @@ -77,7 +77,6 @@ def GetMetadata(media, movie, error_log, id): TMDBid = "" IMDBid = "" tvdb_numbering = True if not movie and (TVDB_id or AniDB_id and max(map(int, media.seasons.keys()))>1) else False - tvdbcounts = {} ### Search for match ### Log.Info("tvdb_numbering: {}".format(tvdb_numbering)) @@ -114,9 +113,6 @@ def anime_core(anime): else: continue found = True - # record the number of entries using the same tvdb id - SaveDict(Dict(tvdbcounts, TVDBid, default=0)+1, tvdbcounts, TVDBid) - defaulttvdbseason, episodeoffset, s1_mapping_count, is_primary_series = anime_core(anime) if not tvdb_numbering and not TVDB_id: TVDB_id2 = TVDBid @@ -201,8 +197,6 @@ def anime_core(anime): Log.Info(' ----- ------') Log.Info(' {:>5} {:>6}'.format(AniDB_winner, TVDB_winner)) - - SaveDict(Dict(tvdbcounts, TVDB_winner), mappingList, 'tvdbcount') if source=="tvdb": for s in media.seasons: @@ -223,6 +217,8 @@ def anime_core(anime): if anime_core(anime)[3]: #[3]==is_primary_series title = AniDB.GetAniDBTitle(AniDB.AniDBTitlesDB.xpath('/animetitles/anime[@aid="{}"]/title'.format(anime.get("anidbid", ""))))[0] #returns [title, main, language_rank] studio = GetXml(anime, "supplemental-info/studio") + # record the number of entries using the same tvdb id + SaveDict(len(TVDB_collection), mappingList, 'tvdbcount') if len(TVDB_collection)>1 and title: # Require that there be at least 2 anidb mappings for a collection Log.Info("[ ] collection: TVDBid '%s' is part of collection: '%s', related_anime_list: %s" % (TVDB_winner, SaveDict([title + ' Collection'], AnimeLists_dict, 'collections'), TVDB_collection)) else: Log.Info("[ ] collection: TVDBid '%s' is not part of any collection" % TVDB_winner)