예제 #1
0
파일: show.py 프로젝트: dglava/showsho
    def __init__(self, title, season, premiere, end, episodes):
        self.title = title
        self.season = season
        self.premiere = utils.date_from_string(premiere, Show.delay)
        self.end = utils.date_from_string(end, Show.delay)
        self.episodes = self.episodes_to_date(episodes)

        self.info = None
        self.last_episode = None
        self.get_status()
        self.get_last_episode()
예제 #2
0
    def __init__(self, title, season, premiere, end, episodes):
        self.title = title
        self.season = season
        self.premiere = utils.date_from_string(premiere, Show.delay)
        self.end = utils.date_from_string(end, Show.delay)
        self.episodes = self.episodes_to_date(episodes)

        self.info = None
        self.last_episode = None
        self.get_status()
        self.get_last_episode()
예제 #3
0
파일: show.py 프로젝트: dglava/showsho
    def get_premiere(self):
        """Get the season's premiere date.

        Inside the "_embedded" data is information about the seasons.
        We want the value of the "premiereDate" key of the current
        season. Since seasons are indexed by 0 in the list, we have
        to subtract 1 from our actual season number while accessing
        the key's value.
        """
        premiere = self.info["_embedded"]["seasons"][self.season - 1]["premiereDate"]
        self.premiere = utils.date_from_string(premiere, Show.delay)
예제 #4
0
    def get_end(self):
        """Get the current season's end date.

        Inside the "_embedded" data is information about the seasons.
        We want the value of the "endDate" key of the current season.
        Since seasons are indexed by 0 in the list, we have to subtract
        1 from our actual season number while accessing the key's
        value.
        """
        end = self.info["_embedded"]["seasons"][self.season - 1]["endDate"]
        self.end = utils.date_from_string(end, Show.delay)
예제 #5
0
파일: show.py 프로젝트: dglava/showsho
    def episodes_to_date(self, dictionary):
        """Returns a dictionary with proper dateobjects.

        Takes a dictionary as an argument (the episodes dictionary
        which contains episode number and airing date pairs). Goes
        through each date (which is a string in the initial dict) and
        creates a dateobject from it. It appends each key,value pair
        to a new dictionary and returns it.
        """
        new_dictionary = {}
        for number, date in dictionary.items():
            new_dictionary[number] = utils.date_from_string(date, Show.delay)
        return new_dictionary
예제 #6
0
    def episodes_to_date(self, dictionary):
        """Returns a dictionary with proper dateobjects.

        Takes a dictionary as an argument (the episodes dictionary
        which contains episode number and airing date pairs). Goes
        through each date (which is a string in the initial dict) and
        creates a dateobject from it. It appends each key,value pair
        to a new dictionary and returns it.
        """
        new_dictionary = {}
        for number, date in dictionary.items():
            new_dictionary[number] = utils.date_from_string(date, Show.delay)
        return new_dictionary