Exemplo n.º 1
0
 def _loadData(self, data):
     Video._loadData(self, data)
     Playable._loadData(self, data)
     self.art = data.attrib.get('art', NA)
     self.audienceRating = utils.cast(float, data.attrib.get('audienceRating', NA))
     self.audienceRatingImage = data.attrib.get('audienceRatingImage', NA)
     self.chapterSource = data.attrib.get('chapterSource', NA)
     self.contentRating = data.attrib.get('contentRating', NA)
     self.duration = utils.cast(int, data.attrib.get('duration', NA))
     self.guid = data.attrib.get('guid', NA)
     self.originalTitle = data.attrib.get('originalTitle', NA)
     self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
     self.primaryExtraKey = data.attrib.get('primaryExtraKey', NA)
     self.rating = data.attrib.get('rating', NA)
     self.ratingImage = data.attrib.get('ratingImage', NA)
     self.studio = data.attrib.get('studio', NA)
     self.tagline = data.attrib.get('tagline', NA)
     self.userRating = utils.cast(float, data.attrib.get('userRating', NA))
     self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0))
     self.year = utils.cast(int, data.attrib.get('year', NA))
     if self.isFullObject():
         self.collections = [media.Collection(self.server, e) for e in data if e.tag == media.Collection.TYPE]
         self.countries = [media.Country(self.server, e) for e in data if e.tag == media.Country.TYPE]
         self.directors = [media.Director(self.server, e) for e in data if e.tag == media.Director.TYPE]
         self.genres = [media.Genre(self.server, e) for e in data if e.tag == media.Genre.TYPE]
         self.media = [media.Media(self.server, e, self.initpath, self) for e in data if e.tag == media.Media.TYPE]
         self.producers = [media.Producer(self.server, e) for e in data if e.tag == media.Producer.TYPE]
         self.roles = [media.Role(self.server, e) for e in data if e.tag == media.Role.TYPE]
         self.writers = [media.Writer(self.server, e) for e in data if e.tag == media.Writer.TYPE]
         self.videoStreams = utils.findStreams(self.media, 'videostream')
         self.audioStreams = utils.findStreams(self.media, 'audiostream')
         self.subtitleStreams = utils.findStreams(self.media, 'subtitlestream')
Exemplo n.º 2
0
    def _loadData(self, data):
        """Used to set the attributes

            Args:
                data (Element): Usually built from server.query
        """
        Video._loadData(self, data)
        Playable._loadData(self, data)
        self.art = data.attrib.get('art', NA)
        self.chapterSource = data.attrib.get('chapterSource', NA)
        self.contentRating = data.attrib.get('contentRating', NA)
        self.duration = utils.cast(int, data.attrib.get('duration', NA))
        self.grandparentArt = data.attrib.get('grandparentArt', NA)
        self.grandparentKey = data.attrib.get('grandparentKey', NA)
        self.grandparentRatingKey = utils.cast(
            int, data.attrib.get('grandparentRatingKey', NA))
        self.grandparentTheme = data.attrib.get('grandparentTheme', NA)
        self.grandparentThumb = data.attrib.get('grandparentThumb', NA)
        self.grandparentTitle = data.attrib.get('grandparentTitle', NA)
        self.guid = data.attrib.get('guid', NA)
        self.index = utils.cast(int, data.attrib.get('index', NA))
        self.originallyAvailableAt = utils.toDatetime(
            data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
        self.parentIndex = data.attrib.get('parentIndex', NA)
        self.parentKey = data.attrib.get('parentKey', NA)
        self.parentRatingKey = utils.cast(
            int, data.attrib.get('parentRatingKey', NA))
        self.parentThumb = data.attrib.get('parentThumb', NA)
        self.rating = utils.cast(float, data.attrib.get('rating', NA))
        self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0))
        self.year = utils.cast(int, data.attrib.get('year', NA))
        self.directors = [
            media.Director(self.server, e) for e in data
            if e.tag == media.Director.TYPE
        ]
        self.media = [
            media.Media(self.server, e, self.initpath, self) for e in data
            if e.tag == media.Media.TYPE
        ]
        self.writers = [
            media.Writer(self.server, e) for e in data
            if e.tag == media.Writer.TYPE
        ]
        self.videoStreams = utils.findStreams(self.media, 'videostream')
        self.audioStreams = utils.findStreams(self.media, 'audiostream')
        self.subtitleStreams = utils.findStreams(self.media, 'subtitlestream')
        # data for active sessions and history
        self.sessionKey = utils.cast(int, data.attrib.get('sessionKey', NA))
        self.username = utils.findUsername(data)
        self.player = utils.findPlayer(self.server, data)
        self.transcodeSession = utils.findTranscodeSession(self.server, data)
        # Cached season number
        self._seasonNumber = None