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

Skip episode if another is mapped to its value #518

Merged
merged 1 commit into from
Jun 30, 2022
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
18 changes: 15 additions & 3 deletions Contents/Code/TheTVDBv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ def GetMetadata(media, movie, error_log, lang, metadata_source, AniDBid, TVDBid,

### episode loop ###
tvdb_special_missing, summary_missing_special, summary_missing, summary_present, episode_missing, episode_missing_season, episode_missing_season_all, abs_number, ep_count = [], [], [], [], [], [], True, 0, 0

# To avoid duplicate mapping we will remember episodes that have been mapped to a different value
mapped_episodes = []
for key in sorted(sorted_episodes_json):
episode_json = sorted_episodes_json[key]
episode = str(Dict(episode_json, 'airedEpisodeNumber'))
season = str(Dict(episode_json, 'airedSeason' ))
season, episode, anidbid = AnimeLists.anidb_ep(mappingList, season, episode)
if anidbid != 'xxxxxxx': mapped_episodes.append((season, episode))

for key in sorted(sorted_episodes_json):

# Episode and Absolute number calculation engine, episode translation
Expand Down Expand Up @@ -185,9 +195,11 @@ def GetMetadata(media, movie, error_log, lang, metadata_source, AniDBid, TVDBid,

### Check for Missing Episodes ###
is_missing = False
if not(str(Dict(episode_json, 'airedSeason'))=='0' and str(Dict(episode_json, 'airedEpisodeNumber')) in list_sp_eps) and \
not(metadata_source in ('tvdb3', 'tvdb4') and str(abs_number) in list_abs_eps) and \
not(not movie and season in media.seasons and episode in media.seasons[season].episodes):
if (not(str(Dict(episode_json, 'airedSeason'))=='0' and str(Dict(episode_json, 'airedEpisodeNumber')) in list_sp_eps) and
not(metadata_source in ('tvdb3', 'tvdb4') and str(abs_number) in list_abs_eps) and
not(not movie and season in media.seasons and episode in media.seasons[season].episodes)) or \
(not movie and season in media.seasons and episode in media.seasons[season].episodes and
anidbid == 'xxxxxxx' and (season, episode) in mapped_episodes):
is_missing = True
Log.Info('[ ] {:>7} s{:0>2}e{:0>3} anidbid: {:>7} air_date: {}'.format(numbering, season, episode, anidbid, Dict(episode_json, 'firstAired')))
air_date = Dict(episode_json, 'firstAired')
Expand Down