def __init__(self, show, season, episode):
        for i in range(3):
            try:
                self.tvdb_show = Tvdb(interactive=False,
                                      cache=False,
                                      banners=True,
                                      actors=True,
                                      forceConnect=True)
                self.show = show
                self.season = season
                self.episode = episode
                self.HD = None

                #Gather information from theTVDB
                self.showdata = self.tvdb_show[self.show]
                self.seasondata = self.showdata[self.season]
                self.episodedata = self.seasondata[self.episode]

                self.show = self.showdata['seriesname']
                self.genre = self.showdata['genre']
                self.network = self.showdata['network']

                self.title = self.episodedata['episodename']
                self.description = self.episodedata['overview']
                self.airdate = self.episodedata['firstaired']
                self.director = self.episodedata['director']
                self.writer = self.episodedata['writer']

                #Generate XML tags for Actors/Writers/Directors
                self.xml = self.xmlTags()
                break
            except:
                print "Failed to connect to TVDB, trying again in 20 seconds"
                time.sleep(20)
Exemple #2
0
    def RetrieveItemFromProvider(self, **kwargs):

        #Log("In TVDBProvider.RetrieveItemFromProvider with args: " + str(kwargs))
        mediaInfo = MediaInfo()
        mediaInfo.type = "tv"

        try:

            t = Tvdb(banners=True)
            show = None

            if ('imdb_id' in kwargs and kwargs['imdb_id']):
                try:
                    show = t[kwargs['imdb_id']]
                except tvdb_shownotfound, ex:
                    pass

            if (not show and 'show_name' in kwargs and kwargs['show_name']):
                try:
                    #Log(kwargs['show_name'])
                    show = t[kwargs['show_name']]
                    if (show['seriesname'].lower() !=
                            kwargs['show_name'].lower()):
                        show = None
                except tvdb_shownotfound, ex:
                    pass
Exemple #3
0
    def __init__(self, show, season, episode, original=None, language='en', logger=None, settings=None, guessData = None):
        if logger:
            self.log = logger
        else:
            self.log = LoggingAdapter.getLogger(__name__)

        if settings is not None:
            self.settings = settings
        else:
            self.settings = settingsProvider().defaultSettings

        self.guessData = guessData

        for i in range(3):
            try:
                self.tvdb_show = Tvdb(interactive=False, cache=False, banners=self.settings.artwork, actors=True, forceConnect=True, language=language)
                self.show = show
                self.season = season
                self.episode = episode
                self.rating = None
                self.HD = None
                self.original = original

                self.provider = 'tvdb'
                self.providerid = show
                
                # Gather information from theTVDB
                self.showdata = self.tvdb_show[self.show]
                self.seasondata = self.showdata[self.season]
                self.episodedata = self.seasondata[self.episode]

                self.show = self.showdata['seriesname']
                self.genre = self.showdata['genre']
                self.network = self.showdata['network']
                self.contentrating = self.showdata['contentrating']

                self.title = self.episodedata['episodename']
                self.description = self.episodedata['overview']
                self.airdate = self.episodedata['firstaired']
                self.director = self.episodedata['director']
                self.writer = self.episodedata['writer']

                # Generate XML tags for Actors/Writers/Directors
                self.xml = self.xmlTags()
                break
            except HTTPError as e:
                if e.code == 404:
                    self.log.exception("Invalid TMDB data received for request.")
                else:
                    self.log.exception("Error occured during movie data scraping.")
                    raise(e)
            except Exception as e:
                self.log.exception("Failed to connect to TVDB, trying again in 20 seconds.")
                time.sleep(20)
Exemple #4
0
    def __init__(self,
                 show,
                 season,
                 episode,
                 original=None,
                 language='en',
                 logger=None):

        if logger:
            self.log = logger
        else:
            self.log = logging.getLogger(__name__)

        for i in range(3):
            try:
                self.tvdb_show = Tvdb(interactive=False,
                                      cache=False,
                                      banners=True,
                                      actors=True,
                                      forceConnect=True,
                                      language=language)
                self.show = show
                self.showid = show
                self.season = season
                self.episode = episode
                self.rating = None
                self.HD = None
                self.original = original

                # Gather information from theTVDB
                self.showdata = self.tvdb_show[self.show]
                self.seasondata = self.showdata[self.season]
                self.episodedata = self.seasondata[self.episode]

                self.show = self.showdata['seriesname']
                self.genre = self.showdata['genre']
                self.network = self.showdata['network']
                self.contentrating = self.showdata['contentrating']

                self.title = self.episodedata['episodename']
                self.description = self.episodedata['overview']
                self.airdate = self.episodedata['firstaired']
                self.director = self.episodedata['director']
                self.writer = self.episodedata['writer']

                # Generate XML tags for Actors/Writers/Directors
                self.xml = self.xmlTags()
                break
            except Exception as e:
                self.log.exception(
                    "Failed to connect to TVDB, trying again in 20 seconds.")
                time.sleep(20)
Exemple #5
0
                    "Parsed filename did not contain series name (and --name not specified), skipping: %s"
                    % cfile)
            else:
                episodes_found.append(episode)

    if len(episodes_found) == 0:
        raise NoValidFilesFoundError()

    p("# Found %d episode" % len(episodes_found) + ("s" *
                                                    (len(episodes_found) > 1)))

    # Sort episodes by series name, season and episode number
    episodes_found.sort(key=lambda x: x.sortable_info())

    tvdb_instance = Tvdb(interactive=not Config['select_first'],
                         search_all_languages=Config['search_all_languages'],
                         language=Config['language'])

    for episode in episodes_found:
        processFile(tvdb_instance, episode)
        p('')

    p("#" * 20)
    p("# Done")


def main():
    """Parses command line arguments, displays errors from tvnamer in terminal
    """
    opter = cliarg_parser.getCommandlineParser(defaults)