Skip to content

Commit

Permalink
tvdb2/3 mode: support specials
Browse files Browse the repository at this point in the history
Some show have absolute numbers that became specials in TheTVDB (Mob psycho 100 ep 26, Hibike Euphonium ep 14, K-ON ep 19, etc...)

I have changed to simpler code to treat them as they are declared in TheTVDB

#491
  • Loading branch information
ZeroQI authored May 21, 2024
1 parent 979a851 commit 7121c1d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Scanners/Series/Absolute Series Scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,16 +823,10 @@ def Scan(path, files, media, dirs, language=None, root=None, **kwargs): #get cal
page = Dict(episodes_json_page, 'links', 'next')

# SORT JSON EPISODES
sorted_episodes_json = {}
for episode_json in episodes_json: sorted_episodes_json['s{:02d}e{:03d}'.format(Dict(episode_json, 'airedSeason'), Dict(episode_json, 'airedEpisodeNumber'))] = episode_json
sorted_episodes_index_list = sorted(sorted_episodes_json, key=natural_sort_key) #Log.Info(u'len: {}, sorted_episodes_index_list: {}'.format(len(sorted_episodes_index_list), sorted_episodes_index_list))

# Loop through sorted episodes list
absolute_number, tvdb_mapping = 0, {}
for index in sorted_episodes_index_list:
if Dict(sorted_episodes_json[index], 'airedSeason')>0: #continue
absolute_number = absolute_number + 1
tvdb_mapping[int(absolute_number)] = (Dict(sorted_episodes_json[index], 'airedSeason'), Dict(sorted_episodes_json[index], 'airedEpisodeNumber') if source =='tvdb2' else int(absolute_number))
tvdb_mapping = {}
for episode_json in episodes_json: tvdb_mapping [Dict(episode_json, 'absoluteNumber')] = ( Dict(episode_json, 'airedSeason'), Dict(episode_json, 'airedEpisodeNumber') if source =='tvdb2' else Dict(episode_json, 'absoluteNumber') )
tvdb_mapping = sorted(tvdb_mapping, key=natural_sort_key) #Log.Info(u'len: {}, tvdb_mapping: {}'.format(len(tvdb_mapping), tvdb_mapping))

except Exception as e: Log.error("json loading issue, Exception: %s" % e)

#tvdb4 - Absolute numbering in any season arrangements aka saga mode
Expand Down

0 comments on commit 7121c1d

Please sign in to comment.