# Path: plex/objects/core/base.py
# class Property(object):
#     helpers = Interface.helpers
# 
#     def __init__(self, name=None, type=None, resolver=None):
#         self.name = name
#         self.type = type
#         self.resolver = resolver
# 
#     def value(self, descriptor, client, key, node, keys_used):
#         if self.resolver is not None:
#             return self.value_func(descriptor, client, key, node, keys_used)
# 
#         return self.value_node(descriptor, key, node, keys_used)
# 
#     def value_node(self, descriptor, key, node, keys_used):
#         value = self.helpers.get(node, key)
# 
#         if value is None:
#             return None
# 
#         keys_used.append(key.lower())
# 
#         try:
#             return self.value_convert(value)
#         except Exception as ex:
#             log.warn('[%s] Unable to parse property %r - %%s' % (descriptor.__name__, key), ex, exc_info=True)
#             return None
# 
#     def value_convert(self, value):
#         if not self.type:
#             return value
# 
#         types = self.type if isinstance(self.type, collections.Iterable) else [self.type]
#         result = value
# 
#         for target_type in types:
#             try:
#                 result = target_type(result)
#             except Exception as ex:
#                 six.reraise(ex, None, sys.exc_info()[2])
# 
#         return result
# 
#     def value_func(self, descriptor, client, key, node, keys_used):
#         func = self.resolver()
# 
#         try:
#             keys, value = func(client, node)
# 
#             keys_used.extend([k.lower() for k in keys])
#             return value
#         except Exception as ex:
#             log.warn('[%s] Exception raised in value function for %r - %%s' % (descriptor.__name__, key), ex, exc_info=True)
#             return None
# 
# Path: plex/objects/library/container.py
# class MediaContainer(Container):
#     section = Property(resolver=lambda: MediaContainer.construct_section)
# 
#     title1 = Property
#     title2 = Property
# 
#     identifier = Property
# 
#     art = Property
#     thumb = Property
# 
#     view_group = Property('viewGroup')
#     view_mode = Property('viewMode', int)
# 
#     leaf_count_added = Property('leafCountAdded', int)
#     leaf_count_requested = Property('leafCountRequested', int)
# 
#     media_tag_prefix = Property('mediaTagPrefix')
#     media_tag_version = Property('mediaTagVersion')
# 
#     allow_sync = Property('allowSync', bool)
#     mixed_parents = Property('mixedParents', bool)
#     no_cache = Property('nocache', bool)
#     sort_asc = Property('sortAsc', bool)
# 
#     @staticmethod
#     def construct_section(client, node):
#         attribute_map = {
#             'key': 'librarySectionID',
#             'uuid': 'librarySectionUUID',
#             'title': 'librarySectionTitle'
#         }
# 
#         return Section.construct(client, node, attribute_map, child=True)
# 
#     def __iter__(self):
#         for item in super(MediaContainer, self).__iter__():
#             item.section = self.section
# 
#             yield item


from plex.objects.core.base import Property
from plex.objects.library.container import MediaContainer


class PlaylistItemContainer(MediaContainer):
    rating_key = Property('ratingKey')

    title = Property

    duration = Property(type=int)

# Path: plex/objects/core/base.py
# class Property(object):
#     helpers = Interface.helpers
# 
#     def __init__(self, name=None, type=None, resolver=None):
#         self.name = name
#         self.type = type
#         self.resolver = resolver
# 
#     def value(self, descriptor, client, key, node, keys_used):
#         if self.resolver is not None:
#             return self.value_func(descriptor, client, key, node, keys_used)
# 
#         return self.value_node(descriptor, key, node, keys_used)
# 
#     def value_node(self, descriptor, key, node, keys_used):
#         value = self.helpers.get(node, key)
# 
#         if value is None:
#             return None
# 
#         keys_used.append(key.lower())
# 
#         try:
#             return self.value_convert(value)
#         except Exception as ex:
#             log.warn('[%s] Unable to parse property %r - %%s' % (descriptor.__name__, key), ex, exc_info=True)
#             return None
# 
#     def value_convert(self, value):
#         if not self.type:
#             return value
# 
#         types = self.type if isinstance(self.type, collections.Iterable) else [self.type]
#         result = value
# 
#         for target_type in types:
#             try:
#                 result = target_type(result)
#             except Exception as ex:
#                 six.reraise(ex, None, sys.exc_info()[2])
# 
#         return result
# 
#     def value_func(self, descriptor, client, key, node, keys_used):
#         func = self.resolver()
# 
#         try:
#             keys, value = func(client, node)
# 
#             keys_used.extend([k.lower() for k in keys])
#             return value
#         except Exception as ex:
#             log.warn('[%s] Exception raised in value function for %r - %%s' % (descriptor.__name__, key), ex, exc_info=True)
#             return None
# 
# Path: plex/objects/library/container.py
# class MediaContainer(Container):
#     section = Property(resolver=lambda: MediaContainer.construct_section)
# 
#     title1 = Property
#     title2 = Property
# 
#     identifier = Property
# 
#     art = Property
#     thumb = Property
# 
#     view_group = Property('viewGroup')
#     view_mode = Property('viewMode', int)
# 
#     leaf_count_added = Property('leafCountAdded', int)
#     leaf_count_requested = Property('leafCountRequested', int)
# 
#     media_tag_prefix = Property('mediaTagPrefix')
#     media_tag_version = Property('mediaTagVersion')
# 
#     allow_sync = Property('allowSync', bool)
#     mixed_parents = Property('mixedParents', bool)
#     no_cache = Property('nocache', bool)
#     sort_asc = Property('sortAsc', bool)
# 
#     @staticmethod
#     def construct_section(client, node):
#         attribute_map = {
#             'key': 'librarySectionID',
#             'uuid': 'librarySectionUUID',
#             'title': 'librarySectionTitle'
#         }
# 
#         return Section.construct(client, node, attribute_map, child=True)
# 
#     def __iter__(self):
#         for item in super(MediaContainer, self).__iter__():
#             item.section = self.section
# 
#             yield item


# Path: plex/objects/playlists/container.py
from plex.objects.core.base import Property
from plex.objects.library.container import MediaContainer



class PlaylistItemContainer(MediaContainer):
    rating_key = Property('ratingKey')

    title = Property

    duration = Property(type=int)

    smart = Property(type=(int, bool))