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 _loadData(self, data): self.addedAt = utils.toDatetime(data.attrib.get('addedAt', NA)) self.key = data.attrib.get('key', NA) self.lastViewedAt = utils.toDatetime(data.attrib.get('lastViewedAt', NA)) self.librarySectionID = data.attrib.get('librarySectionID', NA) self.ratingKey = data.attrib.get('ratingKey', NA) self.summary = data.attrib.get('summary', NA) self.thumb = data.attrib.get('thumb', NA) self.title = data.attrib.get('title', NA) self.titleSort = data.attrib.get('titleSort', self.title) self.type = data.attrib.get('type', NA) self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt', NA)) self.viewCount = utils.cast(int, data.attrib.get('viewCount', 0))
def _loadData(self, data): self.addedAt = utils.toDatetime(data.attrib.get("addedAt", NA)) self.key = data.attrib.get("key", NA) self.lastViewedAt = utils.toDatetime(data.attrib.get("lastViewedAt", NA)) self.librarySectionID = data.attrib.get("librarySectionID", NA) self.ratingKey = data.attrib.get("ratingKey", NA) self.summary = data.attrib.get("summary", NA) self.thumb = data.attrib.get("thumb", NA) self.title = data.attrib.get("title", NA) self.titleSort = data.attrib.get("titleSort", self.title) self.type = data.attrib.get("type", NA) self.updatedAt = utils.toDatetime(data.attrib.get("updatedAt", NA)) self.viewCount = utils.cast(int, data.attrib.get("viewCount", 0))
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.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.listType = 'photo' self.addedAt = utils.toDatetime(data.attrib.get('addedAt', NA)) self.art = data.attrib.get('art', NA) self.composite = data.attrib.get('composite', NA) self.guid = data.attrib.get('guid', NA) self.index = utils.cast(int, data.attrib.get('index', NA)) self.key = data.attrib.get('key', NA) self.librarySectionID = data.attrib.get('librarySectionID', NA) self.ratingKey = data.attrib.get('ratingKey', NA) self.summary = data.attrib.get('summary', NA) self.thumb = data.attrib.get('thumb', NA) self.title = data.attrib.get('title', NA) self.type = data.attrib.get('type', NA) self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt', NA))
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self.listType = 'photo' self.addedAt = utils.toDatetime(data.attrib.get('addedAt')) self.art = data.attrib.get('art') self.composite = data.attrib.get('composite') self.guid = data.attrib.get('guid') self.index = utils.cast(int, data.attrib.get('index')) self.key = data.attrib.get('key') self.librarySectionID = data.attrib.get('librarySectionID') self.ratingKey = data.attrib.get('ratingKey') self.summary = data.attrib.get('summary') self.thumb = data.attrib.get('thumb') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt'))
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): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) Playable._loadData(self, data) self._details_key = self.key + self._include self._seasonNumber = None # cached season number self.art = data.attrib.get('art') self.chapterSource = data.attrib.get('chapterSource') self.contentRating = data.attrib.get('contentRating') self.duration = utils.cast(int, data.attrib.get('duration')) self.grandparentArt = data.attrib.get('grandparentArt') 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.guid = data.attrib.get('guid') self.index = utils.cast(int, data.attrib.get('index')) self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.parentIndex = 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.title = data.attrib.get('title') self.rating = utils.cast(float, data.attrib.get('rating')) self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0)) self.year = utils.cast(int, data.attrib.get('year')) self.directors = self.findItems(data, media.Director) self.media = self.findItems(data, media.Media) self.writers = self.findItems(data, media.Writer) self.labels = self.findItems(data, media.Label) self.collections = self.findItems(data, media.Collection) self.chapters = self.findItems(data, media.Chapter)
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.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 _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.art = data.attrib.get('art') self.banner = data.attrib.get('banner') self.childCount = utils.cast(int, data.attrib.get('childCount')) self.contentRating = data.attrib.get('contentRating') self.duration = utils.cast(int, data.attrib.get('duration')) self.guid = data.attrib.get('guid') self.index = data.attrib.get('index') self.leafCount = utils.cast(int, data.attrib.get('leafCount')) self.locations = self.listAttrs(data, 'path', etag='Location') self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.rating = utils.cast(float, data.attrib.get('rating')) self.studio = data.attrib.get('studio') self.theme = data.attrib.get('theme') self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount')) self.year = utils.cast(int, data.attrib.get('year')) self.genres = self.findItems(data, media.Genre) self.roles = self.findItems(data, media.Role) self.labels = self.findItems(data, media.Label) self.similar = self.findItems(data, media.Similar)
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): """ Load attribute values from Plex XML response. """ self._data = data self.listType = 'video' self.addedAt = utils.toDatetime(data.attrib.get('addedAt')) self.key = data.attrib.get('key', '') self.lastViewedAt = utils.toDatetime(data.attrib.get('lastViewedAt')) self.librarySectionID = data.attrib.get('librarySectionID') self.ratingKey = utils.cast(int, data.attrib.get('ratingKey')) self.summary = data.attrib.get('summary') self.thumb = data.attrib.get('thumb') 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.viewCount = utils.cast(int, data.attrib.get('viewCount', 0))
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.listType = 'photo' self.addedAt = utils.toDatetime(data.attrib.get('addedAt', NA)) self.index = utils.cast(int, data.attrib.get('index', NA)) self.key = data.attrib.get('key', NA) self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d') self.parentKey = data.attrib.get('parentKey', NA) self.parentRatingKey = data.attrib.get('parentRatingKey', NA) self.ratingKey = data.attrib.get('ratingKey', NA) self.summary = data.attrib.get('summary', NA) self.thumb = data.attrib.get('thumb', NA) self.title = data.attrib.get('title', NA) self.type = data.attrib.get('type', NA) self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt', NA)) self.year = utils.cast(int, data.attrib.get('year', NA)) if self.isFullObject(): self.media = [media.Media(self.server, e, self.initpath, self) for e in data if e.tag == media.Media.TYPE]
def _loadData(self, data): Playable._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) if self.key: self.key = self.key.replace('/items', '') # FIX_BUG_50 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 __init__(self, data): self.accessToken = data.attrib.get('accessToken') self.name = data.attrib.get('name') self.address = data.attrib.get('address') self.port = cast(int, data.attrib.get('port')) self.version = data.attrib.get('version') self.scheme = data.attrib.get('scheme') self.host = data.attrib.get('host') self.localAddresses = data.attrib.get('localAddresses', '').split(',') self.machineIdentifier = data.attrib.get('machineIdentifier') self.createdAt = toDatetime(data.attrib.get('createdAt')) self.updatedAt = toDatetime(data.attrib.get('updatedAt')) self.owned = cast(bool, data.attrib.get('owned')) self.synced = cast(bool, data.attrib.get('synced')) self.sourceTitle = data.attrib.get('sourceTitle', '') self.ownerId = cast(int, data.attrib.get('ownerId')) self.home = data.attrib.get('home')
def __init__(self, data): self.name = data.attrib.get('name') self.accessToken = data.attrib.get('accessToken') self.product = data.attrib.get('product') self.productVersion = data.attrib.get('productVersion') self.platform = data.attrib.get('platform') self.platformVersion = data.attrib.get('platformVersion') self.device = data.attrib.get('device') self.clientIdentifier = data.attrib.get('clientIdentifier') self.createdAt = utils.toDatetime(data.attrib.get('createdAt')) self.lastSeenAt = utils.toDatetime(data.attrib.get('lastSeenAt')) self.provides = data.attrib.get('provides') self.owned = utils.cast(bool, data.attrib.get('owned')) self.home = utils.cast(bool, data.attrib.get('home')) self.synced = utils.cast(bool, data.attrib.get('synced')) self.presence = utils.cast(bool, data.attrib.get('presence')) self.connections = [ResourceConnection(elem) for elem in data if elem.tag == 'Connection']
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self.listType = 'photo' self.addedAt = utils.toDatetime(data.attrib.get('addedAt')) self.index = utils.cast(int, data.attrib.get('index')) self.key = data.attrib.get('key') self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.parentKey = data.attrib.get('parentKey') self.parentRatingKey = data.attrib.get('parentRatingKey') self.ratingKey = data.attrib.get('ratingKey') self.summary = data.attrib.get('summary') self.thumb = data.attrib.get('thumb') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.year = utils.cast(int, data.attrib.get('year')) self.media = self.findItems(data, media.Media)
def _loadData(self, data): self._data = data self.agent = data.attrib.get('agent') self.allowSync = utils.cast(bool, data.attrib.get('allowSync')) self.art = data.attrib.get('art') self.composite = data.attrib.get('composite') self.createdAt = utils.toDatetime(data.attrib.get('createdAt')) self.filters = data.attrib.get('filters') self.key = data.attrib.get('key') # invalid key from plex self.language = data.attrib.get('language') self.locations = self.listAttrs(data, 'path', etag='Location') self.refreshing = utils.cast(bool, data.attrib.get('refreshing')) self.scanner = data.attrib.get('scanner') self.thumb = data.attrib.get('thumb') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.uuid = data.attrib.get('uuid')
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Playable._loadData(self, data) self.addedAt = toDatetime(data.attrib.get('addedAt')) self.composite = data.attrib.get('composite') # url to thumbnail self.duration = cast(int, data.attrib.get('duration')) self.durationInSeconds = cast(int, data.attrib.get('durationInSeconds')) self.guid = data.attrib.get('guid') self.key = data.attrib.get('key') self.key = self.key.replace('/items', '') if self.key else self.key # FIX_BUG_50 self.leafCount = cast(int, data.attrib.get('leafCount')) self.playlistType = data.attrib.get('playlistType') self.ratingKey = cast(int, data.attrib.get('ratingKey')) self.smart = cast(bool, data.attrib.get('smart')) self.summary = data.attrib.get('summary') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.updatedAt = toDatetime(data.attrib.get('updatedAt')) self._items = None # cache for self.items
def __init__(self, server, data, initpath): self.server = server self.initpath = initpath self.agent = data.attrib.get('agent') self.allowSync = utils.cast(bool, data.attrib.get('allowSync')) self.art = data.attrib.get('art') self.composite = data.attrib.get('composite') self.createdAt = utils.toDatetime(data.attrib.get('createdAt')) self.filters = data.attrib.get('filters') self.key = data.attrib.get('key') self.language = data.attrib.get('language') self.language = data.attrib.get('language') self.locations = utils.findLocations(data) self.refreshing = utils.cast(bool, data.attrib.get('refreshing')) self.scanner = data.attrib.get('scanner') self.thumb = data.attrib.get('thumb') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.uuid = data.attrib.get('uuid')
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._data = data self.id = utils.cast(int, data.attrib.get('id')) self.serverId = utils.cast(int, data.attrib.get('serverId')) self.machineIdentifier = data.attrib.get('machineIdentifier') self.name = data.attrib.get('name') self.lastSeenAt = utils.toDatetime(data.attrib.get('lastSeenAt')) self.numLibraries = utils.cast(int, data.attrib.get('numLibraries')) self.allLibraries = utils.cast(bool, data.attrib.get('allLibraries')) self.owned = utils.cast(bool, data.attrib.get('owned')) self.pending = utils.cast(bool, data.attrib.get('pending'))
def _loadData(self, data): self._data = data self.name = data.attrib.get('name') self.publicAddress = data.attrib.get('publicAddress') self.product = data.attrib.get('product') self.productVersion = data.attrib.get('productVersion') self.platform = data.attrib.get('platform') self.platformVersion = data.attrib.get('platformVersion') self.device = data.attrib.get('device') self.model = data.attrib.get('model') self.vendor = data.attrib.get('vendor') self.provides = data.attrib.get('provides') self.clientIdentifier = data.attrib.get('clientIdentifier') self.version = data.attrib.get('version') self.id = data.attrib.get('id') self.token = logfilter.add_secret(data.attrib.get('token')) self.screenResolution = data.attrib.get('screenResolution') self.screenDensity = data.attrib.get('screenDensity') self.createdAt = utils.toDatetime(data.attrib.get('createdAt')) self.lastSeenAt = utils.toDatetime(data.attrib.get('lastSeenAt')) self.connections = [connection.attrib.get('uri') for connection in data.iter('Connection')]
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): 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): Audio._loadData(self, data) self.art = data.attrib.get('art', NA) self.key = self.key.replace('/children', '') # FIX_BUG_50 self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d') 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.studio = data.attrib.get('studio', 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]
def _loadData(self, data): self._data = data self.name = data.attrib.get('name') self.accessToken = logfilter.add_secret(data.attrib.get('accessToken')) self.product = data.attrib.get('product') self.productVersion = data.attrib.get('productVersion') self.platform = data.attrib.get('platform') self.platformVersion = data.attrib.get('platformVersion') self.device = data.attrib.get('device') self.clientIdentifier = data.attrib.get('clientIdentifier') self.createdAt = utils.toDatetime(data.attrib.get('createdAt')) self.lastSeenAt = utils.toDatetime(data.attrib.get('lastSeenAt')) self.provides = data.attrib.get('provides') self.owned = utils.cast(bool, data.attrib.get('owned')) self.home = utils.cast(bool, data.attrib.get('home')) self.synced = utils.cast(bool, data.attrib.get('synced')) self.presence = utils.cast(bool, data.attrib.get('presence')) self.connections = self.findItems(data, ResourceConnection) self.publicAddressMatches = utils.cast(bool, data.attrib.get('publicAddressMatches')) # This seems to only be available if its not your device (say are shared server) self.httpsRequired = utils.cast(bool, data.attrib.get('httpsRequired')) self.ownerid = utils.cast(int, data.attrib.get('ownerId', 0)) self.sourceTitle = data.attrib.get('sourceTitle') # owners plex username.
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Audio._loadData(self, data) self.art = data.attrib.get('art') self.key = self.key.replace('/children', '') # fixes bug #50 self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') 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.studio = data.attrib.get('studio') self.year = utils.cast(int, data.attrib.get('year')) self.genres = self.findItems(data, media.Genre) self.collections = self.findItems(data, media.Collection) self.labels = self.findItems(data, media.Label)
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): """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
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Audio._loadData(self, data) self.art = data.attrib.get('art', NA) self.key = self.key.replace('/children', '') # fixes bug #50 self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d') 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.studio = data.attrib.get('studio', 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 ]
def _loadData(self, data): """ Load attribute values from Plex XML response. """ self._data = data self.allowCameraUpload = cast(bool, data.attrib.get('allowCameraUpload')) self.allowChannelAccess = cast(bool, data.attrib.get('allowChannelAccess')) self.allowMediaDeletion = cast(bool, data.attrib.get('allowMediaDeletion')) self.allowSharing = cast(bool, data.attrib.get('allowSharing')) self.allowSync = cast(bool, data.attrib.get('allowSync')) self.backgroundProcessing = cast(bool, data.attrib.get('backgroundProcessing')) self.certificate = cast(bool, data.attrib.get('certificate')) self.companionProxy = cast(bool, data.attrib.get('companionProxy')) self.diagnostics = utils.toList(data.attrib.get('diagnostics')) self.eventStream = cast(bool, data.attrib.get('eventStream')) self.friendlyName = data.attrib.get('friendlyName') self.hubSearch = cast(bool, data.attrib.get('hubSearch')) self.machineIdentifier = data.attrib.get('machineIdentifier') self.multiuser = cast(bool, data.attrib.get('multiuser')) self.myPlex = cast(bool, data.attrib.get('myPlex')) self.myPlexMappingState = data.attrib.get('myPlexMappingState') self.myPlexSigninState = data.attrib.get('myPlexSigninState') self.myPlexSubscription = cast(bool, data.attrib.get('myPlexSubscription')) self.myPlexUsername = data.attrib.get('myPlexUsername') self.ownerFeatures = utils.toList(data.attrib.get('ownerFeatures')) self.photoAutoTag = cast(bool, data.attrib.get('photoAutoTag')) self.platform = data.attrib.get('platform') self.platformVersion = data.attrib.get('platformVersion') self.pluginHost = cast(bool, data.attrib.get('pluginHost')) self.readOnlyLibraries = cast(int, data.attrib.get('readOnlyLibraries')) self.requestParametersInCookie = cast(bool, data.attrib.get('requestParametersInCookie')) self.streamingBrainVersion = data.attrib.get('streamingBrainVersion') self.sync = cast(bool, data.attrib.get('sync')) self.transcoderActiveVideoSessions = int(data.attrib.get('transcoderActiveVideoSessions', 0)) self.transcoderAudio = cast(bool, data.attrib.get('transcoderAudio')) self.transcoderLyrics = cast(bool, data.attrib.get('transcoderLyrics')) self.transcoderPhoto = cast(bool, data.attrib.get('transcoderPhoto')) self.transcoderSubtitles = cast(bool, data.attrib.get('transcoderSubtitles')) self.transcoderVideo = cast(bool, data.attrib.get('transcoderVideo')) self.transcoderVideoBitrates = utils.toList(data.attrib.get('transcoderVideoBitrates')) self.transcoderVideoQualities = utils.toList(data.attrib.get('transcoderVideoQualities')) self.transcoderVideoResolutions = utils.toList(data.attrib.get('transcoderVideoResolutions')) self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.updater = cast(bool, data.attrib.get('updater')) self.version = data.attrib.get('version') self.voiceSearch = cast(bool, data.attrib.get('voiceSearch'))
def _loadData(self, data): super(Episode, self)._loadData(data) self.librarySectionID = data.attrib.get('librarySectionID', NA) self.librarySectionTitle = data.attrib.get('librarySectionTitle', NA) self.grandparentKey = data.attrib.get('grandparentKey', NA) self.grandparentTitle = data.attrib.get('grandparentTitle', NA) self.grandparentThumb = data.attrib.get('grandparentThumb', NA) self.parentKey = data.attrib.get('parentKey', NA) self.parentIndex = data.attrib.get('parentIndex', NA) self.parentThumb = data.attrib.get('parentThumb', NA) self.contentRating = data.attrib.get('contentRating', NA) self.index = data.attrib.get('index', 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.duration = cast(int, data.attrib.get('duration', NA)) self.originallyAvailableAt = toDatetime( data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d')
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) Playable._loadData(self, data) self._details_key = self.key + self._include self._seasonNumber = None # cached season number art = data.attrib.get('art') self.art = art if art and str(self.ratingKey) in art else None self.chapterSource = data.attrib.get('chapterSource') self.contentRating = data.attrib.get('contentRating') 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.guid = data.attrib.get('guid') self.index = utils.cast(int, data.attrib.get('index')) self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.parentGuid = data.attrib.get('parentGuid') self.parentIndex = 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.title = data.attrib.get('title') self.rating = utils.cast(float, data.attrib.get('rating')) self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0)) self.year = utils.cast(int, data.attrib.get('year')) self.directors = self.findItems(data, media.Director) self.fields = self.findItems(data, media.Field) self.media = self.findItems(data, media.Media) self.writers = self.findItems(data, media.Writer) self.labels = self.findItems(data, media.Label) self.collections = self.findItems(data, media.Collection) self.chapters = self.findItems(data, media.Chapter) self.markers = self.findItems(data, media.Marker)
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Audio._loadData(self, data) self.collections = self.findItems(data, media.Collection) self.genres = self.findItems(data, media.Genre) self.key = self.key.replace('/children', '') # FIX_BUG_50 self.labels = self.findItems(data, media.Label) self.leafCount = utils.cast(int, data.attrib.get('leafCount')) self.loudnessAnalysisVersion = utils.cast(int, data.attrib.get('loudnessAnalysisVersion')) self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.parentGuid = data.attrib.get('parentGuid') 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.rating = utils.cast(float, data.attrib.get('rating')) self.studio = data.attrib.get('studio') self.styles = self.findItems(data, media.Style) self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount')) self.year = utils.cast(int, data.attrib.get('year'))
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]
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) Playable._loadData(self, data) self._data = data self.addedAt = data.attrib.get('addedAt') self.duration = utils.cast(int, data.attrib.get('duration')) self.guid = data.attrib.get('guid') self.key = data.attrib.get('key') self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.ratingKey = data.attrib.get('ratingKey') self.skipDetails = utils.cast(int, data.attrib.get('skipDetails')) self.subtype = data.attrib.get('subtype') self.thumb = data.attrib.get('thumb') self.thumbAspectRatio = data.attrib.get('thumbAspectRatio') self.title = data.attrib.get('title') self.type = data.attrib.get('type') self.year = utils.cast(int, data.attrib.get('year')) self.media = self.findItems(data, media.Media)
def _loadData(self, data): """ Load attribute values from Plex XML response. """ Video._loadData(self, data) 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.genres = self.findItems(data, media.Genre) 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.leafCount = utils.cast(int, data.attrib.get('leafCount')) self.locations = self.listAttrs(data, 'path', etag='Location') self.originallyAvailableAt = utils.toDatetime(data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.rating = utils.cast(float, data.attrib.get('rating')) self.roles = self.findItems(data, media.Role) self.similar = self.findItems(data, media.Similar) self.studio = data.attrib.get('studio') self.theme = data.attrib.get('theme') 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._details_key = self.key + self._include self.art = data.attrib.get('art') self.audienceRating = utils.cast(float, data.attrib.get('audienceRating')) self.audienceRatingImage = data.attrib.get('audienceRatingImage') self.chapterSource = data.attrib.get('chapterSource') self.contentRating = data.attrib.get('contentRating') self.duration = utils.cast(int, data.attrib.get('duration')) self.guid = data.attrib.get('guid') self.originalTitle = data.attrib.get('originalTitle') self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt'), '%Y-%m-%d') self.primaryExtraKey = data.attrib.get('primaryExtraKey') self.rating = utils.cast(float, data.attrib.get('rating')) self.ratingImage = data.attrib.get('ratingImage') self.studio = data.attrib.get('studio') self.tagline = data.attrib.get('tagline') self.userRating = utils.cast(float, data.attrib.get('userRating')) self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0)) self.year = utils.cast(int, data.attrib.get('year')) self.collections = self.findItems(data, media.Collection) self.countries = self.findItems(data, media.Country) self.directors = self.findItems(data, media.Director) self.fields = self.findItems(data, media.Field) self.genres = self.findItems(data, media.Genre) self.guids = self.findItems(data, media.Guid) self.media = self.findItems(data, media.Media) self.producers = self.findItems(data, media.Producer) self.roles = self.findItems(data, media.Role) self.writers = self.findItems(data, media.Writer) self.labels = self.findItems(data, media.Label) self.chapters = self.findItems(data, media.Chapter) self.similar = self.findItems(data, media.Similar)
def _loadData(self, data): """Used to set the attributes. Args: data (Element): XML reponse from PMS as Element normally built from server.query """ Audio._loadData(self, data) self.art = data.attrib.get('art', NA) self.key = self.key.replace('/children', '') # FIX_BUG_50 self.originallyAvailableAt = utils.toDatetime( data.attrib.get('originallyAvailableAt', NA), '%Y-%m-%d') 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.studio = data.attrib.get('studio', 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 ]
def test_utils_toDatetime(): assert ( str(utils.toDatetime("2006-03-03", format="%Y-%m-%d")) == "2006-03-03 00:00:00" )
def test_utils_toDatetime(): assert str(utils.toDatetime('2006-03-03', format='%Y-%m-%d')) == '2006-03-03 00:00:00' assert str(utils.toDatetime('0'))[:-9] in ['1970-01-01', '1969-12-31']
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.fields = [ media.Field(e) for e in data if e.tag == media.Field.TYPE ] self.videoStreams = utils.findStreams(self.media, 'videostream') self.audioStreams = utils.findStreams(self.media, 'audiostream') self.subtitleStreams = utils.findStreams(self.media, 'subtitlestream')
def test_utils_toDatetime(): assert str(utils.toDatetime('2006-03-03', format='%Y-%m-%d')) == '2006-03-03 00:00:00'