class QueueItemAdd(QueueItem): def __init__(self, show=None): self.showDir = show # if we can't create the dir, bail if not os.path.isdir(self.showDir): if not helpers.makeDir(self.showDir): raise exceptions.NoNFOException("Unable to create the show dir " + self.showDir) if not os.path.isfile(os.path.join(self.showDir, "tvshow.nfo")): raise exceptions.NoNFOException("No tvshow.nfo found") # this will initialize self.show to None QueueItem.__init__(self, QueueActions.ADD) self.initialShow = TVShow(self.showDir) def _getName(self): if self.show == None: return self.showDir return self.show.name name = property(_getName) def _isLoading(self): if self.show == None: return True return False isLoading = property(_isLoading) def execute(self): QueueItem.execute(self) logger.log("Starting to add show "+self.showDir) otherShow = helpers.findCertainShow(sickbeard.showList, self.initialShow.tvdbid) if otherShow != None: logger.log("Show is already in your list, not adding it again") self.finish() return try: self.initialShow.getImages() self.initialShow.loadFromTVDB() except tvdb_exceptions.tvdb_exception, e: logger.log("Unable to add show due to an error with TVDB: "+str(e), logger.ERROR) webserve.flash.error("Unable to add "+str(self.initialShow.name)+" due to an error with TVDB") self._finishEarly() return except exceptions.NoNFOException: logger.log("Unable to load show from NFO", logger.ERROR) webserve.flash.error("Unable to add "+str(self.initialShow.name)+" from NFO, skipping") self._finishEarly() return
class QueueItemAdd(QueueItem): def __init__(self, show=None): self.showDir = show # if we can't create the dir, bail if not os.path.isdir(self.showDir): if not helpers.makeDir(self.showDir): raise exceptions.NoNFOException("Unable to create the show dir " + self.showDir) if not os.path.isfile(os.path.join(self.showDir, "tvshow.nfo")): raise exceptions.NoNFOException("No tvshow.nfo found") # this will initialize self.show to None QueueItem.__init__(self, QueueActions.ADD) self.initialShow = TVShow(self.showDir) def _getName(self): if self.show == None: return self.showDir return self.show.name name = property(_getName) def _isLoading(self): if self.show == None: return True return False isLoading = property(_isLoading) def execute(self): QueueItem.execute(self) logger.log("Starting to add show "+self.showDir) try: self.initialShow.getImages() self.initialShow.loadFromTVDB() except tvdb_exceptions.tvdb_exception, e: logger.log("Unable to add show due to an error with TVDB: "+str(e), logger.ERROR) self.finish() return except exceptions.NoNFOException: logger.log("Unable to load show from NFO", logger.ERROR) # take the show out of the loading list self.finish() return