def _loadData(self, data): Audio._loadData(self, data) Playable._loadData(self, data) self.art = data.attrib.get('art', NA) self.chapterSource = data.attrib.get('chapterSource', 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 = data.attrib.get('grandparentRatingKey', NA) self.grandparentThumb = data.attrib.get('grandparentThumb', NA) self.grandparentTitle = data.attrib.get('grandparentTitle', NA) self.guid = data.attrib.get('guid', NA) self.originalTitle = data.attrib.get('originalTitle', NA) self.parentIndex = data.attrib.get('parentIndex', NA) self.parentKey = data.attrib.get('parentKey', NA) self.parentRatingKey = data.attrib.get('parentRatingKey', NA) self.parentThumb = data.attrib.get('parentThumb', NA) self.parentTitle = data.attrib.get('parentTitle', NA) self.primaryExtraKey = data.attrib.get('primaryExtraKey', NA) self.ratingCount = utils.cast(int, data.attrib.get('ratingCount', 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.moods = [media.Mood(self.server, e) for e in data if e.tag == media.Mood.TYPE] self.media = [media.Media(self.server, e, self.initpath, self) for e in data if e.tag == media.Media.TYPE] # 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)
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Audio._loadData(self, data) Playable._loadData(self, data) self.art = data.attrib.get('art') self.chapterSource = data.attrib.get('chapterSource') self.duration = utils.cast(int, data.attrib.get('duration')) self.grandparentArt = data.attrib.get('grandparentArt') self.grandparentKey = data.attrib.get('grandparentKey') self.grandparentRatingKey = data.attrib.get('grandparentRatingKey') self.grandparentThumb = data.attrib.get('grandparentThumb') self.grandparentTitle = data.attrib.get('grandparentTitle') self.guid = data.attrib.get('guid') self.originalTitle = data.attrib.get('originalTitle') self.parentIndex = data.attrib.get('parentIndex') self.parentKey = data.attrib.get('parentKey') self.parentRatingKey = data.attrib.get('parentRatingKey') self.parentThumb = data.attrib.get('parentThumb') self.parentTitle = data.attrib.get('parentTitle') self.primaryExtraKey = data.attrib.get('primaryExtraKey') self.ratingCount = utils.cast(int, data.attrib.get('ratingCount')) self.userRating = utils.cast(float, data.attrib.get('userRating', 0)) self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0)) self.year = utils.cast(int, data.attrib.get('year')) self.media = self.findItems(data, media.Media) self.moods = self.findItems(data, media.Mood)
def _loadData(self, data): 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 = 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.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 = 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)) if self.isFullObject(): 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)
def __init__(self, data): self.protocol = data.attrib.get('protocol') self.address = data.attrib.get('address') self.port = utils.cast(int, data.attrib.get('port')) self.uri = data.attrib.get('uri') self.local = utils.cast(bool, data.attrib.get('local')) self.httpuri = 'http://%s:%s' % (self.address, self.port)
def _loadData(self, data): super(Episode, self)._loadData(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 = 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.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 = 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)) if self.isFullObject(): 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 = self._findStreams('videostream') self.audioStreams = self._findStreams('audiostream') self.subtitleStreams = self._findStreams('subtitlestream') # data for active sessions self.sessionKey = utils.cast(int, data.attrib.get('sessionKey', NA)) self.user = self._findUser(data) self.player = self._findPlayer(data) self.transcodeSession = self._findTranscodeSession(data)
def _loadData(self, data): Video._loadData(self, data) self.leafCount = utils.cast(int, data.attrib.get('leafCount', NA)) self.index = data.attrib.get('index', NA) self.parentKey = data.attrib.get('parentKey', NA) self.parentRatingKey = data.attrib.get('parentRatingKey', NA) self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount', NA))
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')
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")
def _loadData(self, data): self.sessionKey = utils.cast(int, data.attrib.get('sessionKey')) # session self.usernames = self.listAttrs(data, 'title', etag='User') # session self.players = self.findItems(data, etag='Player') # session self.transcodeSessions = self.findItems(data, etag='TranscodeSession') # session self.session = self.findItems(data, etag='Session') # session self.viewedAt = utils.toDatetime(data.attrib.get('viewedAt')) # history self.playlistItemID = utils.cast(int, data.attrib.get('playlistItemID')) # playlist
def _loadData(self, data): self._data = data self.id = cast(int, data.attrib.get('id', 0)) self.filter = data.attrib.get('filter') # I couldn't filter on it anyways self.tag = data.attrib.get('tag') self.title = self.tag self.index = cast(int, data.attrib.get('index')) self.start = cast(int, data.attrib.get('startTimeOffset')) self.end = cast(int, data.attrib.get('endTimeOffset'))
def _loadData(self, data): self._data = data self.protocol = data.attrib.get('protocol') self.address = data.attrib.get('address') self.port = utils.cast(int, data.attrib.get('port')) self.uri = data.attrib.get('uri') self.local = utils.cast(bool, data.attrib.get('local')) self.httpuri = 'http://%s:%s' % (self.address, self.port) self.relay = utils.cast(bool, data.attrib.get('relay'))
def __init__(self, server, data, initpath, part): self.server = server self.initpath = initpath self.part = part self.id = cast(int, data.attrib.get('id')) self.type = cast(int, data.attrib.get('streamType')) self.codec = data.attrib.get('codec') self.selected = cast(bool, data.attrib.get('selected', '0')) self.index = cast(int, data.attrib.get('index', '-1'))
def __init__(self, server, data, initpath, part): self.server = server self.initpath = initpath self.part = part self.id = cast(int, data.attrib.get("id")) self.type = cast(int, data.attrib.get("streamType")) self.codec = data.attrib.get("codec") self.selected = cast(bool, data.attrib.get("selected", "0")) self.index = cast(int, data.attrib.get("index", "-1"))
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) # fix key if loaded from search self.key = self.key.replace('/children', '') self.leafCount = utils.cast(int, data.attrib.get('leafCount')) self.index = utils.cast(int, data.attrib.get('index')) self.parentKey = data.attrib.get('parentKey') self.parentRatingKey = utils.cast(int, data.attrib.get('parentRatingKey')) self.parentTitle = data.attrib.get('parentTitle') self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount'))
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._data = data self.container = data.attrib.get('container') self.duration = cast(int, data.attrib.get('duration')) self.file = data.attrib.get('file') self.id = cast(int, data.attrib.get('id')) self.indexes = data.attrib.get('indexes') self.key = data.attrib.get('key') self.size = cast(int, data.attrib.get('size')) self.streams = self._buildStreams(data)
def __init__(self, server, data, initpath, media): self.server = server self.initpath = initpath self.media = media self.id = cast(int, data.attrib.get('id')) self.key = data.attrib.get('key') self.duration = cast(int, data.attrib.get('duration')) self.file = data.attrib.get('file') self.size = cast(int, data.attrib.get('size')) self.container = data.attrib.get('container') self.streams = [MediaPartStream.parse(self.server, e, self.initpath, self) for e in data if e.tag == 'Stream']
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._data = data self.codec = data.attrib.get('codec') self.codecID = data.attrib.get('codecID') self.id = cast(int, data.attrib.get('id')) self.index = cast(int, data.attrib.get('index', '-1')) self.language = data.attrib.get('language') self.languageCode = data.attrib.get('languageCode') self.selected = cast(bool, data.attrib.get('selected', '0')) self.streamType = cast(int, data.attrib.get('streamType')) self.type = cast(int, data.attrib.get('streamType'))
def _loadData(self, data): self._data = data self.id = utils.cast(int, data.attrib.get('id')) self.version = utils.cast(int, data.attrib.get('version')) self.rootTitle = data.attrib.get('rootTitle') self.title = data.attrib.get('title') self.metadataType = data.attrib.get('metadataType') self.machineIdentifier = data.find('Server').get('machineIdentifier') self.status = data.find('Status').attrib.copy() self.MediaSettings = data.find('MediaSettings').attrib.copy() self.policy = data.find('Policy').attrib.copy() self.location = data.find('Location').attrib.copy()
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._data = data self.id = cast(int, data.attrib.get('id')) self.role = data.attrib.get('role') self.tag = data.attrib.get('tag') # additional attributes only from hub search self.key = data.attrib.get('key') self.librarySectionID = cast(int, data.attrib.get('librarySectionID')) self.librarySectionTitle = data.attrib.get('librarySectionTitle') self.librarySectionType = data.attrib.get('librarySectionType') self.tagType = cast(int, data.attrib.get('tagType')) self.thumb = data.attrib.get('thumb')
def __init__(self, device, data, servers=None): self.device = device self.servers = servers self.id = cast(int, data.attrib.get('id')) self.version = cast(int, data.attrib.get('version')) self.rootTitle = data.attrib.get('rootTitle') self.title = data.attrib.get('title') self.metadataType = data.attrib.get('metadataType') self.machineIdentifier = data.find('Server').get('machineIdentifier') self.status = data.find('Status').attrib.copy() self.MediaSettings = data.find('MediaSettings').attrib.copy() self.policy = data.find('Policy').attrib.copy() self.location = data.find('Location').attrib.copy()
def _loadData(self, data): super(Show, self)._loadData(data) self.studio = data.attrib.get('studio', NA) self.contentRating = data.attrib.get('contentRating', NA) self.rating = data.attrib.get('rating', NA) self.year = cast(int, data.attrib.get('year', NA)) self.banner = data.attrib.get('banner', NA) self.theme = data.attrib.get('theme', NA) self.duration = cast(int, data.attrib.get('duration', NA)) self.originallyAvailableAt = toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d') self.leafCount = cast(int, data.attrib.get('leafCount', NA)) self.viewedLeafCount = cast(int, data.attrib.get('viewedLeafCount', NA)) self.childCount = cast(int, data.attrib.get('childCount', NA))
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._setValue = None self.id = data.attrib.get('id') self.label = data.attrib.get('label') self.summary = data.attrib.get('summary') self.type = data.attrib.get('type') self.default = self._cast(data.attrib.get('default')) self.value = self._cast(data.attrib.get('value')) self.hidden = utils.cast(bool, data.attrib.get('hidden')) self.advanced = utils.cast(bool, data.attrib.get('advanced')) self.group = data.attrib.get('group') self.enumValues = self._getEnumValues(data)
def _loadData(self, data): super(Movie, self)._loadData(data) self.studio = data.attrib.get('studio', NA) self.contentRating = data.attrib.get('contentRating', NA) self.rating = data.attrib.get('rating', NA) self.viewCount = cast(int, data.attrib.get('viewCount', 0)) self.viewOffset = cast(int, data.attrib.get('viewOffset', 0)) self.year = cast(int, data.attrib.get('year', NA)) self.summary = data.attrib.get('summary', NA) self.tagline = data.attrib.get('tagline', NA) self.duration = cast(int, data.attrib.get('duration', NA)) self.originallyAvailableAt = toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d') self.primaryExtraKey = data.attrib.get('primaryExtraKey', NA)
def _loadData(self, data): super(Season, self)._loadData(data) self.librarySectionID = data.attrib.get('librarySectionID', NA) self.librarySectionTitle = data.attrib.get('librarySectionTitle', NA) self.parentRatingKey = data.attrib.get('parentRatingKey', NA) self.parentKey = data.attrib.get('parentKey', NA) self.parentTitle = data.attrib.get('parentTitle', NA) self.parentSummary = data.attrib.get('parentSummary', NA) self.index = data.attrib.get('index', NA) self.parentIndex = data.attrib.get('parentIndex', NA) self.parentThumb = data.attrib.get('parentThumb', NA) self.parentTheme = data.attrib.get('parentTheme', NA) self.leafCount = cast(int, data.attrib.get('leafCount', NA)) self.viewedLeafCount = cast(int, data.attrib.get('viewedLeafCount', NA))
def _loadData(self, data): self.ratingKey = utils.cast(int, data.attrib.get('ratingKey')) self.key = data.attrib.get('key') self.type = data.attrib.get('type') self.title = data.attrib.get('title') self.subtype = data.attrib.get('subtype') self.summary = data.attrib.get('summary') self.index = utils.cast(int, data.attrib.get('index')) self.thumb = data.attrib.get('thumb') self.addedAt = utils.toDatetime(data.attrib.get('addedAt')) self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.childCount = utils.cast(int, data.attrib.get('childCount')) self.minYear = utils.cast(int, data.attrib.get('minYear')) self.maxYear = utils.cast(int, data.attrib.get('maxYear'))
def _loadData(self, data): self._data = data self.identifier = data.attrib.get('identifier') self.mediaTagPrefix = data.attrib.get('mediaTagPrefix') self.mediaTagVersion = data.attrib.get('mediaTagVersion') self.playQueueID = data.attrib.get('playQueueID') self.playQueueSelectedItemID = data.attrib.get('playQueueSelectedItemID') self.playQueueSelectedItemOffset = data.attrib.get('playQueueSelectedItemOffset') self.playQueueSelectedMetadataItemID = data.attrib.get('playQueueSelectedMetadataItemID') self.playQueueShuffled = utils.cast(bool, data.attrib.get('playQueueShuffled', 0)) self.playQueueSourceURI = data.attrib.get('playQueueSourceURI') self.playQueueTotalCount = data.attrib.get('playQueueTotalCount') self.playQueueVersion = data.attrib.get('playQueueVersion') self.size = utils.cast(int, data.attrib.get('size', 0)) self.items = self.findItems(data)
def __init__(self, server, data, initpath, media): self.server = server self.initpath = initpath self.media = media self.id = cast(int, data.attrib.get("id")) self.key = data.attrib.get("key") self.duration = cast(int, data.attrib.get("duration")) self.file = data.attrib.get("file") self.size = cast(int, data.attrib.get("size")) self.container = data.attrib.get("container") self.streams = [ MediaPartStream.parse(self.server, elem, self.initpath, self) for elem in data if elem.tag == MediaPartStream.TYPE ]
def _loadData(self, data): self.addedAt = toDatetime(data.attrib.get('addedAt', NA)) self.composite = data.attrib.get('composite', NA) # url to thumbnail self.duration = cast(int, data.attrib.get('duration', NA)) self.durationInSeconds = cast(int, data.attrib.get('durationInSeconds', NA)) self.guid = data.attrib.get('guid', NA) self.key = data.attrib.get('key', NA).replace('/items', '') # plex bug? http://bit.ly/1Sc2J3V self.leafCount = cast(int, data.attrib.get('leafCount', NA)) self.playlistType = data.attrib.get('playlistType', NA) self.ratingKey = data.attrib.get('ratingKey', NA) self.smart = cast(bool, data.attrib.get('smart', NA)) self.summary = data.attrib.get('summary', NA) self.title = data.attrib.get('title', NA) self.type = data.attrib.get('type', NA) self.updatedAt = toDatetime(data.attrib.get('updatedAt', NA))
def _loadData(self, data): self.type = data.attrib.get('type', NA) self.key = data.attrib.get('key', NA) self.librarySectionID = data.attrib.get('librarySectionID', NA) self.ratingKey = data.attrib.get('ratingKey', NA) self.title = data.attrib.get('title', NA) self.summary = data.attrib.get('summary', NA) self.art = data.attrib.get('art', NA) self.thumb = data.attrib.get('thumb', NA) self.addedAt = toDatetime(data.attrib.get('addedAt', NA)) self.updatedAt = toDatetime(data.attrib.get('updatedAt', NA)) self.lastViewedAt = toDatetime(data.attrib.get('lastViewedAt', NA)) self.sessionKey = cast(int, data.attrib.get('sessionKey', NA)) self.user = self._find_user(data) # for active sessions self.player = self._find_player(data) # for active sessions self.transcodeSession = self._find_transcodeSession(data) if self.isFullObject(): # These are auto-populated when requested self.media = [Media(self.server, elem, self.initpath, self) for elem in data if elem.tag == Media.TYPE] self.countries = [Country(self.server, elem) for elem in data if elem.tag == Country.TYPE] self.directors = [Director(self.server, elem) for elem in data if elem.tag == Director.TYPE] self.genres = [Genre(self.server, elem) for elem in data if elem.tag == Genre.TYPE] self.producers = [Producer(self.server, elem) for elem in data if elem.tag == Producer.TYPE] self.actors = [Actor(self.server, elem) for elem in data if elem.tag == Actor.TYPE] self.writers = [Writer(self.server, elem) for elem in data if elem.tag == Writer.TYPE]
def parse(server, data, initpath, part): STREAMCLS = {StreamVideo.TYPE: StreamVideo, StreamAudio.TYPE: StreamAudio, StreamSubtitle.TYPE: StreamSubtitle} stype = cast(int, data.attrib.get("streamType")) cls = STREAMCLS.get(stype, MediaPartStream) # return generic MediaPartStream if type is unknown return cls(server, data, initpath, part)
def _loadData(self, data): self.id = data.attrib.get('id') self.bandwidth = utils.cast(int, data.attrib.get('bandwidth')) self.location = data.attrib.get('location')
def _loadData(self, data): self._data = data self.name = data.attrib.get('name') self.locked = cast(bool, data.attrib.get('locked'))
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) self.audienceRating = utils.cast(float, data.attrib.get('audienceRating')) self.audienceRatingImage = data.attrib.get('audienceRatingImage') self.autoDeletionItemPolicyUnwatchedLibrary = utils.cast( int, data.attrib.get('autoDeletionItemPolicyUnwatchedLibrary', '0')) self.autoDeletionItemPolicyWatchedLibrary = utils.cast( int, data.attrib.get('autoDeletionItemPolicyWatchedLibrary', '0')) self.banner = data.attrib.get('banner') self.childCount = utils.cast(int, data.attrib.get('childCount')) self.collections = self.findItems(data, media.Collection) self.contentRating = data.attrib.get('contentRating') self.duration = utils.cast(int, data.attrib.get('duration')) self.episodeSort = utils.cast(int, data.attrib.get('episodeSort', '-1')) self.flattenSeasons = utils.cast( int, data.attrib.get('flattenSeasons', '-1')) self.genres = self.findItems(data, media.Genre) self.guids = self.findItems(data, media.Guid) self.index = utils.cast(int, data.attrib.get('index')) self.key = self.key.replace('/children', '') # FIX_BUG_50 self.labels = self.findItems(data, media.Label) self.languageOverride = data.attrib.get('languageOverride') self.leafCount = utils.cast(int, data.attrib.get('leafCount')) self.locations = self.listAttrs(data, 'path', etag='Location') self.network = data.attrib.get('network') self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.originalTitle = data.attrib.get('originalTitle') self.rating = utils.cast(float, data.attrib.get('rating')) self.roles = self.findItems(data, media.Role) self.showOrdering = data.attrib.get('showOrdering') self.similar = self.findItems(data, media.Similar) self.studio = data.attrib.get('studio') self.tagline = data.attrib.get('tagline') self.theme = data.attrib.get('theme') self.useOriginalTitle = utils.cast( int, data.attrib.get('useOriginalTitle', '-1')) self.userRating = utils.cast(float, data.attrib.get('userRating')) self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount')) self.year = utils.cast(int, data.attrib.get('year'))
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) Playable._loadData(self, data) self._seasonNumber = None # cached season number self.audienceRating = utils.cast(float, data.attrib.get('audienceRating')) self.audienceRatingImage = data.attrib.get('audienceRatingImage') self.chapters = self.findItems(data, media.Chapter) self.chapterSource = data.attrib.get('chapterSource') self.collections = self.findItems(data, media.Collection) self.contentRating = data.attrib.get('contentRating') self.directors = self.findItems(data, media.Director) self.duration = utils.cast(int, data.attrib.get('duration')) self.grandparentArt = data.attrib.get('grandparentArt') self.grandparentGuid = data.attrib.get('grandparentGuid') self.grandparentKey = data.attrib.get('grandparentKey') self.grandparentRatingKey = utils.cast( int, data.attrib.get('grandparentRatingKey')) self.grandparentTheme = data.attrib.get('grandparentTheme') self.grandparentThumb = data.attrib.get('grandparentThumb') self.grandparentTitle = data.attrib.get('grandparentTitle') self.guids = self.findItems(data, media.Guid) self.index = utils.cast(int, data.attrib.get('index')) self.markers = self.findItems(data, media.Marker) self.media = self.findItems(data, media.Media) self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.parentGuid = data.attrib.get('parentGuid') self.parentIndex = utils.cast(int, data.attrib.get('parentIndex')) self.parentKey = data.attrib.get('parentKey') self.parentRatingKey = utils.cast(int, data.attrib.get('parentRatingKey')) self.parentThumb = data.attrib.get('parentThumb') self.parentTitle = data.attrib.get('parentTitle') self.parentYear = utils.cast(int, data.attrib.get('parentYear')) self.rating = utils.cast(float, data.attrib.get('rating')) self.skipParent = utils.cast(bool, data.attrib.get('skipParent', '0')) self.userRating = utils.cast(float, data.attrib.get('userRating')) self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0)) self.writers = self.findItems(data, media.Writer) self.year = utils.cast(int, data.attrib.get('year')) # If seasons are hidden, parentKey and parentRatingKey are missing from the XML response. # https://forums.plex.tv/t/parentratingkey-not-in-episode-xml-when-seasons-are-hidden/300553 if self.skipParent and not self.parentRatingKey: # Parse the parentRatingKey from the parentThumb if self.parentThumb and self.parentThumb.startswith( '/library/metadata/'): self.parentRatingKey = utils.cast( int, self.parentThumb.split('/')[3]) # Get the parentRatingKey from the season's ratingKey if not self.parentRatingKey and self.grandparentRatingKey: self.parentRatingKey = self.show().season( season=self.parentIndex).ratingKey if self.parentRatingKey: self.parentKey = '/library/metadata/%s' % self.parentRatingKey
def seasonNumber(self): """ Returns this episodes season number. """ if self._seasonNumber is None: self._seasonNumber = self.parentIndex if self.parentIndex else self.season( ).seasonNumber return utils.cast(int, self._seasonNumber)
def _loadData(self, data): self._data = data self.addedAt = utils.toDatetime(data.attrib.get('addedAt')) self.art = data.attrib.get('art') self.artBlurHash = data.attrib.get('artBlurHash') self.childCount = utils.cast(int, data.attrib.get('childCount')) self.collectionMode = utils.cast( int, data.attrib.get('collectionMode', '-1')) self.collectionPublished = utils.cast( bool, data.attrib.get('collectionPublished', '0')) self.collectionSort = utils.cast( int, data.attrib.get('collectionSort', '0')) self.content = data.attrib.get('content') self.contentRating = data.attrib.get('contentRating') self.fields = self.findItems(data, media.Field) self.guid = data.attrib.get('guid') self.index = utils.cast(int, data.attrib.get('index')) self.key = data.attrib.get('key', '').replace('/children', '') # FIX_BUG_50 self.labels = self.findItems(data, media.Label) self.lastRatedAt = utils.toDatetime(data.attrib.get('lastRatedAt')) self.librarySectionID = utils.cast(int, data.attrib.get('librarySectionID')) self.librarySectionKey = data.attrib.get('librarySectionKey') self.librarySectionTitle = data.attrib.get('librarySectionTitle') self.maxYear = utils.cast(int, data.attrib.get('maxYear')) self.minYear = utils.cast(int, data.attrib.get('minYear')) self.ratingCount = utils.cast(int, data.attrib.get('ratingCount')) self.ratingKey = utils.cast(int, data.attrib.get('ratingKey')) self.smart = utils.cast(bool, data.attrib.get('smart', '0')) self.subtype = data.attrib.get('subtype') self.summary = data.attrib.get('summary') self.thumb = data.attrib.get('thumb') self.thumbBlurHash = data.attrib.get('thumbBlurHash') self.title = data.attrib.get('title') self.titleSort = data.attrib.get('titleSort', self.title) self.type = data.attrib.get('type') self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.userRating = utils.cast(float, data.attrib.get('userRating')) self._items = None # cache for self.items self._section = None # cache for self.section self._filters = None # cache for self.filters