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

Support specials when using absolute number #54

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
28 changes: 16 additions & 12 deletions resources/lib/episodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,22 @@ def get_series_episodes(id, settings):
xbmcplugin.setResolvedUrl(
HANDLE, False, xbmcgui.ListItem(offscreen=True))
return
seasonVar = 'airedSeason'
epNumberVar = 'airedEpisodeNumber'
if (settings.getSettingBool('dvdorder') == True):
seasonVar = 'dvdSeason'
epNumberVar = 'dvdEpisodeNumber'
for ep in episodes:
liz = xbmcgui.ListItem(ep['episodeName'], offscreen=True)
details = {'title': ep['episodeName'],
'aired': ep['firstAired']
}
if (settings.getSettingBool('absolutenumber') == True):
if (settings.getSettingBool('absolutenumber') == True and ep[seasonVar] > 0):
details['season'] = 1
details['episode'] = ep['absoluteNumber']
elif (settings.getSettingBool('dvdorder') == True):
details['season'] = ep['dvdSeason']
details['episode'] = ep['dvdEpisodeNumber']
else:
details['season'] = ep['airedSeason']
details['episode'] = ep['airedEpisodeNumber']
details['season'] = ep[seasonVar]
details['episode'] = ep[epNumberVar]
liz.setInfo('video', details)
xbmcplugin.addDirectoryItem(handle=HANDLE, url=str(
ep['id']), listitem=liz, isFolder=True)
Expand Down Expand Up @@ -84,15 +86,17 @@ def get_episode_details(id, images_url: str, settings):
details['sortepisode'] = ep.airsBeforeSeason
details['sortseason'] = ep.airsBeforeEpisode

if (settings.getSettingBool('absolutenumber') == True):
seasonFunc = lambda e: e.airedSeason
epNumberFunc = lambda e: e.airedEpisodeNumber
if (settings.getSettingBool('dvdorder') == True):
seasonFunc = lambda e: e.dvdSeason
epNumberFunc = lambda e: e.dvdEpisodeNumber
if (settings.getSettingBool('absolutenumber') == True and seasonFunc(ep) > 0):
details['season'] = 1
details['episode'] = ep.absoluteNumber
elif (settings.getSettingBool('dvdorder') == True):
details['season'] = ep.dvdSeason
details['episode'] = ep.dvdEpisodeNumber
else:
details['season'] = ep.airedSeason
details['episode'] = ep.airedEpisodeNumber
details['season'] = seasonFunc(ep)
details['episode'] = epNumberFunc(ep)

liz.setInfo('video', details)

Expand Down