Esempio n. 1
0
    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show "+self.showDir)

        try:
            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = sickbeard.QUALITY_DEFAULT
            self.show.seasonfolders = sickbeard.SEASON_FOLDERS_DEFAULT
            self.show.paused = False

        except tvdb_exceptions.tvdb_exception, e:
            logger.log(u"Unable to add show due to an error with TVDB: "+str(e).decode('utf-8'), logger.ERROR)
            if self.show:
                ui.flash.error("Unable to add "+str(self.show.name)+" due to an error with TVDB")
            else:
                ui.flash.error("Unable to add show due to an error with TVDB")
            self._finishEarly()
            return
    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show "+self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms['language'] = self.lang
        
                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]
                if not s or not s['seriesname']:
                    ui.flash.error("Unable to add show", "Show in "+str(self.showDir)+" has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language.")
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                ui.flash.error("Unable to add show", "Unable to look up the show in "+str(self.showDir)+" on TVDB, not using the NFO. Delete .nfo and add manually in the correct language.")
                self._finishEarly()
                return

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.seasonfolders = self.season_folders if self.season_folders != None else sickbeard.SEASON_FOLDERS_DEFAULT
            self.show.paused = False
Esempio n. 3
0
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
Esempio n. 4
0
    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show " + self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms["language"] = self.lang

                logger.log(u"TVDB: " + repr(ltvdb_api_parms))

                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]

                # this usually only happens if they have an NFO in their show dir which gave us a TVDB ID that has no
                # proper english version of the show
                if not s or not s["seriesname"]:
                    ui.notifications.error(
                        "Unable to add show",
                        "Show in "
                        + self.showDir
                        + " has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language.",
                    )
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                logger.log(u"Error contacting TVDB: " + ex(e), logger.ERROR)
                ui.notifications.error(
                    "Unable to add show",
                    "Unable to look up the show in "
                    + self.showDir
                    + " on TVDB, not using the NFO. Delete .nfo and add manually in the correct language.",
                )
                self._finishEarly()
                return

            # clear the name cache
            name_cache.clearCache()

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.flatten_folders = (
                self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT
            )
            self.show.paused = False

            # be smartish about this
            if self.show.genre and "talk show" in self.show.genre.lower():
                self.show.air_by_date = 1
Esempio n. 5
0
    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show " + self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms['language'] = self.lang

                logger.log(u"TVDB: " + repr(ltvdb_api_parms))

                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]

                # this usually only happens if they have an NFO in their show dir which gave us a TVDB ID that has no
                # proper english version of the show
                if not s or not s['seriesname']:
                    ui.notifications.error(
                        "Unable to add show", "Show in " + self.showDir +
                        " has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language."
                    )
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                logger.log(
                    u"Error contacting TVDB: " +
                    e.message.decode(sickbeard.SYS_ENCODING), logger.ERROR)
                ui.notifications.error(
                    "Unable to add show",
                    "Unable to look up the show in " + self.showDir +
                    " on TVDB, not using the NFO. Delete .nfo and add manually in the correct language."
                )
                self._finishEarly()
                return

            # clear the name cache
            name_cache.clearCache()

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.seasonfolders = self.season_folders if self.season_folders != None else sickbeard.SEASON_FOLDERS_DEFAULT
            self.show.paused = False

            # be smartish about this
            if self.show.genre and "talk show" in self.show.genre.lower():
                self.show.air_by_date = 1
Esempio n. 6
0
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
Esempio n. 7
0
    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show " + self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms['language'] = self.lang

                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]
                if not s or not s['seriesname']:
                    ui.flash.error(
                        "Unable to add show", "Show in " + str(self.showDir) +
                        " has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language."
                    )
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                ui.flash.error(
                    "Unable to add show",
                    "Unable to look up the show in " + str(self.showDir) +
                    " on TVDB, not using the NFO. Delete .nfo and add manually in the correct language."
                )
                self._finishEarly()
                return

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.seasonfolders = self.season_folders if self.season_folders != None else sickbeard.SEASON_FOLDERS_DEFAULT
            self.show.paused = False
Esempio n. 8
0
    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show " + self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms['language'] = self.lang

                logger.log(u"TVDB: " + repr(ltvdb_api_parms))

                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]

                # this usually only happens if they have an NFO in their show dir which gave us a TVDB ID that has no proper english version of the show
                if not s['seriesname']:
                    logger.log(
                        u"Show in " + self.showDir +
                        " has no name on TVDB, probably the wrong language used to search with.",
                        logger.ERROR)
                    ui.notifications.error(
                        "Unable to add show", "Show in " + self.showDir +
                        " has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language."
                    )
                    self._finishEarly()
                    return
                # if the show has no episodes/seasons
                if not s:
                    logger.log(
                        u"Show " + str(s['seriesname']) +
                        " is on TVDB but contains no season/episode data.",
                        logger.ERROR)
                    ui.notifications.error(
                        "Unable to add show", "Show " + str(s['seriesname']) +
                        " is on TVDB but contains no season/episode data.")
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                logger.log(u"Error contacting TVDB: " + ex(e), logger.ERROR)
                ui.notifications.error(
                    "Unable to add show",
                    "Unable to look up the show in " + self.showDir +
                    " on TVDB, not using the NFO. Delete .nfo and add manually in the correct language."
                )
                self._finishEarly()
                return

            # clear the name cache
            name_cache.clearCache()

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.flatten_folders = self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT
            self.show.stay_ahead = self.stay_ahead if self.stay_ahead != None else sickbeard.STAY_AHEAD_DEFAULT
            self.show.paused = 0
            self.show.added_date = int(time.time())

            # be smartish about this
            if self.show.genre and "talk show" in self.show.genre.lower():
                self.show.air_by_date = 1