Ejemplo n.º 1
0
    def __init__(self, name):
        self.shortname = name
        self.episodes = {}

        # the following properties will be populated dynamically
        self.genres = []
        self.showid = ''
        self.name = ''
        self.link = ''
        self.country = ''
        self.status = ''
        self.classification = ''
        self.started = 0
        self.ended = 0
        self.seasons = 0

        show = feeds.search(self.shortname, node='show', timeout=timeout)
        if not show:
            raise ShowNotFound(name)
        # dynamically mapping the xml tags to properties:
        for elem in show:
            if not elem.tag == 'seasons':  # we'll set this later
                # these properties should be ints
                if elem.tag in ('started', 'ended'):
                    self.__dict__[elem.tag] = int(elem.text)
                # these are fine as strings
                else:
                    self.__dict__[elem.tag] = elem.text
        self.genres = [g.text for g in show.find('genres')]

        # and now grabbing the episodes
        eplist = feeds.episode_list(self.showid, node='Episodelist', timeout=timeout)

        if not eplist:
            eplist = []

        # populating the episode list
        for season in eplist:
            try:
                snum = int(season.attrib['no'])
            except KeyError:
                pass  # TODO: adding handeling for specials and movies
                # bsp: http://www.tvrage.com/feeds/episode_list.php?sid=3519
            else:
                self.episodes[snum] = Season()
                for episode in season:
                    epnum = int(episode.find('seasonnum').text)
                    self.episodes[snum][epnum] = Episode(
                        self.name,
                        snum,
                        episode.find('airdate').text,
                        episode.find('title').text,
                        episode.find('link').text,
                        epnum,
                        episode.find('prodnum').text,
                    )
                if snum > 0:
                    self.seasons = max(snum, self.seasons)
        self.episodes[self.seasons].is_current = True
Ejemplo n.º 2
0
    def __init__(self, showid):
        self.showid = showid
        self.episodes = {}
        
        # the following properties will be populated dynamically
        self.genres = []
        self.showname = ''
        self.showlink = ''
        self.origin_country = ''
        self.status = ''
        self.classification = ''
        self.started = 0
        self.startdate = ''
        self.ended = ''
        self.runtime = 0
        self.seasons = 0
        
        show = feeds.showinfo(self.showid)
        # dynamically mapping the xml tags to properties:
        for elem in show:
            if not elem.tag == 'seasons': # we'll set this later 
                    self.__dict__[elem.tag] = elem.text
        
        try:
            self.genres = [g.text for g in show.find('genres')]
        except TypeError:
            pass
        
        # and now grabbing the episodes
        eplist = feeds.episode_list(self.showid, node='Episodelist')

        # populating the episode list
        if eplist is not None:
            for season in eplist:
                try:
                    snum = int(season.attrib['no'])
                except KeyError:
                    pass # TODO: adding handeling for specials and movies
                    # bsp: http://www.tvrage.com/feeds/episode_list.php?sid=3519
                else:
                    self.episodes[snum] = Season()
                    for episode in season:
                        epnum = int(episode.find('seasonnum').text)
                        self.episodes[snum][epnum] = Episode(
                            self.showname,
                            snum,
                            episode.find('airdate').text,
                            episode.find('title').text,
                            episode.find('link').text,
                            epnum,
                            episode.find('prodnum').text,
                        )
                    if snum > 0:
                        self.seasons += 1
            try:
                self.episodes[self.seasons].is_current = True
            except KeyError:
                pass
Ejemplo n.º 3
0
    def __init__(self, name):
        self.shortname = name
        self.episodes = {}
        
        # the following properties will be populated dynamically
        self.genres = []
        self.showid = ''
        self.name = ''
        self.link = ''
        self.country = ''
        self.status = ''
        self.classification = ''
        self.started = 0
        self.ended = 0
        self.seasons = 0

        show = feeds.search(self.shortname, node='show')
        # dynamically mapping the xml tags to properties:
        for elem in show:
            # Don't set these yet
            if elem.tag in ('seasons', ):
                continue
            # these properties should be ints
            elif elem.tag in ('started', 'ended'):
                self.__dict__[elem.tag] = int(elem.text)
            # these are fine as strings
            else:
                self.__dict__[elem.tag] = elem.text
        self.genres = [g.text for g in show.find('genres')]

        # and now grabbing the episodes
        eplist = feeds.episode_list(self.showid, node='Episodelist')

        # populating the episode list
        for season in eplist:
            try:
                snum = int(season.attrib['no'])
            except KeyError:
                pass # TODO: adding handeling for specials and movies
                # bsp: http://www.tvrage.com/feeds/episode_list.php?sid=3519
            else:
                self.episodes[snum] = Season()
                for episode in season:
                    epnum = int(episode.find('seasonnum').text)
                    self.episodes[snum][epnum] = Episode(
                        self.name,
                        snum,
                        episode.find('airdate').text,
                        episode.find('title').text,
                        episode.find('link').text,
                        epnum,
                        episode.find('prodnum').text,
                    )
                if snum > 0:
                    self.seasons += 1
        
        self.episodes[self.seasons].is_current = True