Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions resources/lib/kodiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@

_LOGGER = logging.getLogger(__name__)

state = {
"program_title": None,
"episode_title": None,
"season": None,
"episode": None
}

class TitleItem:
""" This helper object holds all information to be used with Kodi xbmc's ListItem object """
Expand Down
1 change: 1 addition & 0 deletions resources/lib/modules/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def show_program(self, uuid):
kodiutils.end_of_directory()
return

kodiutils.state["program_title"] = program.title
# Go directly to the season when we have only one season
if len(program.seasons) == 1:
self.show_season(list(program.seasons.values())[0].uuid)
Expand Down
11 changes: 11 additions & 0 deletions resources/lib/modules/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ def generate_titleitem(item):
# Episode
#
if isinstance(item, Episode):
if not item.program_title:
item.program_title = kodiutils.state["program_title"]

if not item.season:
import re
m = re.match(r"[sS](\d+)[-]?[aA](\d+)", item.title)
_LOGGER.info(f'm is {m}')
if m:
item.season=int(m.group(1))
item.number=int(m.group(2))

info_dict.update({
'mediatype': 'episode',
'tvshowtitle': item.program_title,
Expand Down
Loading