Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tvdbcount #539

Merged
merged 1 commit into from
Jan 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Contents/Code/AnimeLists.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down