diff --git a/resources/lib/objects/__init__.py b/resources/lib/objects/__init__.py index e6fc1114..2c2dcac9 100644 --- a/resources/lib/objects/__init__.py +++ b/resources/lib/objects/__init__.py @@ -1,4 +1,4 @@ -version = "171076019" +version = "171076021" from movies import Movies from musicvideos import MusicVideos diff --git a/resources/lib/objects/actions.py b/resources/lib/objects/actions.py index ab22a320..aaae665c 100644 --- a/resources/lib/objects/actions.py +++ b/resources/lib/objects/actions.py @@ -99,14 +99,13 @@ class Actions(object): if get_play_action() == "Resume": seektime = True - if transcode and not seektime and resume: + if transcode and not seektime: choice = self.resume_dialog(api.API(item, self.server).adjust_resume((resume or 0) / 10000000.0)) if choice is None: - return + raise Exception("User backed out of resume dialog.") - elif not choice: - seektime = False + seektime = False if not choice else True if settings('enableCinema.bool') and not seektime: self._set_intros(item) diff --git a/resources/lib/objects/tvshows.py b/resources/lib/objects/tvshows.py index 604bd7eb..d55ef93e 100644 --- a/resources/lib/objects/tvshows.py +++ b/resources/lib/objects/tvshows.py @@ -4,8 +4,9 @@ import json import logging -from ntpath import dirname +import sqlite3 import urllib +from ntpath import dirname from obj import Objects from kodi import TVShows as KodiDb, queries as QU @@ -325,7 +326,7 @@ class TVShows(KodiDb): obj['AirsBeforeEpisode'] = 4096 # Kodi default number for afterseason ordering if obj['MultiEpisode']: - obj['MultiEpisode'] = "| %02d | %s" % (obj['MultiEpisode'], obj['Title']) + obj['Title'] = "| %02d | %s" % (obj['MultiEpisode'], obj['Title']) if not self.get_show_id(obj): return False @@ -371,7 +372,15 @@ class TVShows(KodiDb): obj['PathId'] = self.add_path(*values(obj, QU.add_path_obj)) obj['FileId'] = self.add_file(*values(obj, QU.add_file_obj)) - self.add_episode(*values(obj, QU.add_episode_obj)) + try: + self.add_episode(*values(obj, QU.add_episode_obj)) + except sqlite3.IntegrityError as error: + + LOG.error("IntegrityError for %s", obj) + obj['EpisodeId'] = self.create_entry_episode() + + return self.episode_add(obj) + self.emby_db.add_reference(*values(obj, QUEM.add_reference_episode_obj)) LOG.debug("ADD episode [%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['Id'], obj['Title'])