コード例 #1
0
ファイル: video.py プロジェクト: dgoren/python-plexapi
    def _loadData(self, data):
        """Used to set the attributes

        Args:
            data (Element): Usually built from server.query
        """
        Video._loadData(self, data)
        # Incase this was loaded from search etc
        self.key = self.key.replace('/children', '')
        self.art = data.attrib.get('art', NA)
        self.banner = data.attrib.get('banner', NA)
        self.childCount = utils.cast(int, data.attrib.get('childCount', 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.index = data.attrib.get('index', NA)
        self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA))
        self.location = utils.findLocations(data, single=True) or NA
        self.originallyAvailableAt = utils.toDatetime(
            data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
        self.rating = utils.cast(float, data.attrib.get('rating', NA))
        self.studio = data.attrib.get('studio', NA)
        self.theme = data.attrib.get('theme', NA)
        self.viewedLeafCount = utils.cast(
            int, data.attrib.get('viewedLeafCount', NA))
        self.year = utils.cast(int, data.attrib.get('year', NA))
        if self.isFullObject():  # will be fixed with docs.
            self.genres = [
                media.Genre(self.server, e) for e in data
                if e.tag == media.Genre.TYPE
            ]
            self.roles = [
                media.Role(self.server, e) for e in data
                if e.tag == media.Role.TYPE
            ]
コード例 #2
0
ファイル: video.py プロジェクト: suavp/python-plexapi
 def _loadData(self, data):
     Video._loadData(self, data)
     self.art = data.attrib.get('art', NA)
     self.banner = data.attrib.get('banner', NA)
     self.childCount = utils.cast(int, data.attrib.get('childCount', 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.index = data.attrib.get('index', NA)
     self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA))
     self.location = utils.findLocations(data, single=True)
     self.originallyAvailableAt = utils.toDatetime(
         data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
     self.rating = utils.cast(float, data.attrib.get('rating', NA))
     self.studio = data.attrib.get('studio', NA)
     self.theme = data.attrib.get('theme', NA)
     self.viewedLeafCount = utils.cast(
         int, data.attrib.get('viewedLeafCount', NA))
     self.year = utils.cast(int, data.attrib.get('year', NA))
     if self.isFullObject():
         self.genres = [
             media.Genre(self.server, e) for e in data
             if e.tag == media.Genre.TYPE
         ]
         self.roles = [
             media.Role(self.server, e) for e in data
             if e.tag == media.Role.TYPE
         ]
コード例 #3
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')