How to use the sickrage.helper.exceptions.NoNFOException function in sickrage

To help you get started, we’ve selected a few sickrage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pymedusa / Medusa / sickbeard / tv.py View on Github external
logger.log(u"Failed to rename your episode's NFO file - "
                                   u'you need to delete it or fix it: ' + ex(e), logger.ERROR)
                    raise NoNFOException('Error in NFO format')

                for ep_details in list(show_xml.iter('episodedetails')):
                    if ep_details.findtext('season') is None or int(ep_details.findtext('season')) != self.season or \
                       ep_details.findtext('episode') is None or int(ep_details.findtext('episode')) != self.episode:
                        logger.log(u'{id}: NFO has an  block for a different episode - '
                                   u'wanted {ep_wanted} but got {ep_found}'.format
                                   (id=self.show.indexerid, ep_wanted=episode_num(self.season, self.episode),
                                    ep_found=episode_num(ep_details.findtext('season'),
                                                         ep_details.findtext('episode'))), logger.DEBUG)
                        continue

                    if ep_details.findtext('title') is None or ep_details.findtext('aired') is None:
                        raise NoNFOException('Error in NFO format (missing episode title or airdate)')

                    self.name = ep_details.findtext('title')
                    self.episode = int(ep_details.findtext('episode'))
                    self.season = int(ep_details.findtext('season'))

                    xem_refresh(self.show.indexerid, self.show.indexer)

                    self.scene_absolute_number = get_scene_absolute_numbering(
                        self.show.indexerid,
                        self.show.indexer,
                        self.absolute_number
                    )

                    self.scene_season, self.scene_episode = get_scene_numbering(
                        self.show.indexerid,
                        self.show.indexer,
github pymedusa / Medusa / sickbeard / tv.py View on Github external
def _specify_episode(self, season, episode):

        sql_results = self.load_from_db(season, episode)

        if not sql_results:
            # only load from NFO if we didn't load from DB
            if self.is_location_valid():
                try:
                    self.__load_from_nfo(self.location)
                except NoNFOException:
                    logger.log(u'{id}: There was an error loading the NFO for episode {ep}'.format
                               (id=self.show.indexerid, ep=episode_num(season, episode)), logger.ERROR)

                # if we tried loading it from NFO and didn't find the NFO, try the Indexers
                if not self.hasnfo:
                    try:
                        result = self.load_from_indexer(season, episode)
                    except EpisodeDeletedException:
                        result = False

                    # if we failed SQL *and* NFO, Indexers then fail
                    if not result:
                        raise EpisodeNotFoundException(
                            u"Couldn't find episode {ep}".format(ep=episode_num(season, episode)))
github pymedusa / Medusa / sickbeard / tv.py View on Github external
nfo_file = replace_extension(self.location, 'nfo')
            logger.log(str(self.show.indexerid) + u': Using NFO name ' + nfo_file, logger.DEBUG)

            if ek(os.path.isfile, nfo_file):
                try:
                    show_xml = ETree.ElementTree(file=nfo_file)
                except (SyntaxError, ValueError) as e:
                    logger.log(u'Error loading the NFO, backing up the NFO and skipping for now: ' + ex(e),
                               logger.ERROR)
                    try:
                        ek(os.rename, nfo_file, nfo_file + '.old')
                    except Exception as e:
                        logger.log(u"Failed to rename your episode's NFO file - "
                                   u'you need to delete it or fix it: ' + ex(e), logger.ERROR)
                    raise NoNFOException('Error in NFO format')

                for ep_details in list(show_xml.iter('episodedetails')):
                    if ep_details.findtext('season') is None or int(ep_details.findtext('season')) != self.season or \
                       ep_details.findtext('episode') is None or int(ep_details.findtext('episode')) != self.episode:
                        logger.log(u'{id}: NFO has an  block for a different episode - '
                                   u'wanted {ep_wanted} but got {ep_found}'.format
                                   (id=self.show.indexerid, ep_wanted=episode_num(self.season, self.episode),
                                    ep_found=episode_num(ep_details.findtext('season'),
                                                         ep_details.findtext('episode'))), logger.DEBUG)
                        continue

                    if ep_details.findtext('title') is None or ep_details.findtext('aired') is None:
                        raise NoNFOException('Error in NFO format (missing episode title or airdate)')

                    self.name = ep_details.findtext('title')
                    self.episode = int(ep_details.findtext('episode'))