
    gf                         d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
mZmZ d dlmZmZ d dlmZmZmZmZmZmZmZmZ d dlmZ ej6                   G d	 d
eeeeeeeee             Zy)    )Path)
quote_plus)mediautils)PlexPartialObject)
BadRequestNotFoundUnsupported)LibrarySection
ManagedHub)AdvancedSettingsMixinSmartFilterMixin	HubsMixinRatingMixinArtMixinPosterMixin
ThemeMixinCollectionEditMixins)
deprecatedc                       e Zd ZdZdZdZd Zd Zd Zd Z	d Z
ed	        Zed
        Zed        Zed        Zed        Ze edd      d               Zd Z fdZd Zd Zd Zd Zd'dZd'dZd'dZd Zd Zd'dZd(dZ ed      d(d        Z  fd!Z!e"d"        Z#e"d(d#       Z$e"	 	 d)d$       Z%	 	 d*d%Z&ed&        Z' xZ(S )+
Collectiona   Represents a single Collection.

        Attributes:
            TAG (str): 'Directory'
            TYPE (str): 'collection'
            addedAt (datetime): Datetime the collection was added to the library.
            art (str): URL to artwork image (/library/metadata/<ratingKey>/art/<artid>).
            artBlurHash (str): BlurHash string for artwork image.
            audienceRating (float): Audience rating.
            childCount (int): Number of items in the collection.
            collectionFilterBasedOnUser (int): Which user's activity is used for the collection filtering.
            collectionMode (int): How the items in the collection are displayed.
            collectionPublished (bool): True if the collection is published to the Plex homepage.
            collectionSort (int): How to sort the items in the collection.
            content (str): The filter URI string for smart collections.
            contentRating (str) Content rating (PG-13; NR; TV-G).
            fields (List<:class:`~plexapi.media.Field`>): List of field objects.
            guid (str): Plex GUID for the collection (collection://XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX).
            images (List<:class:`~plexapi.media.Image`>): List of image objects.
            index (int): Plex index number for the collection.
            key (str): API URL (/library/metadata/<ratingkey>).
            labels (List<:class:`~plexapi.media.Label`>): List of label objects.
            lastRatedAt (datetime): Datetime the collection was last rated.
            librarySectionID (int): :class:`~plexapi.library.LibrarySection` ID.
            librarySectionKey (str): :class:`~plexapi.library.LibrarySection` key.
            librarySectionTitle (str): :class:`~plexapi.library.LibrarySection` title.
            maxYear (int): Maximum year for the items in the collection.
            minYear (int): Minimum year for the items in the collection.
            rating (float): Collection rating (7.9; 9.8; 8.1).
            ratingCount (int): The number of ratings.
            ratingKey (int): Unique key identifying the collection.
            smart (bool): True if the collection is a smart collection.
            subtype (str): Media type of the items in the collection (movie, show, artist, or album).
            summary (str): Summary of the collection.
            theme (str): URL to theme resource (/library/metadata/<ratingkey>/theme/<themeid>).
            thumb (str): URL to thumbnail image (/library/metadata/<ratingKey>/thumb/<thumbid>).
            thumbBlurHash (str): BlurHash string for thumbnail image.
            title (str): Name of the collection.
            titleSort (str): Title to use when sorting (defaults to title).
            type (str): 'collection'
            ultraBlurColors (:class:`~plexapi.media.UltraBlurColors`): Ultra blur color object.
            updatedAt (datetime): Datetime the collection was updated.
            userRating (float): Rating of the collection (0.0 - 10.0) equaling (0 stars - 5 stars).
    	Directory
collectionc                 h   || _         t        j                  |j                  j	                  d            | _        |j                  j	                  d      | _        |j                  j	                  d      | _        t        j                  t        |j                  j	                  d            | _
        t        j                  t        |j                  j	                  d            | _        t        j                  t        |j                  j	                  dd            | _        t        j                  t        |j                  j	                  dd	            | _        t        j                  t        |j                  j	                  d
d            | _        t        j                  t        |j                  j	                  dd            | _        |j                  j	                  d      | _        |j                  j	                  d      | _        | j)                  |t*        j,                        | _        |j                  j	                  d      | _        | j)                  |t*        j2                        | _        t        j                  t        |j                  j	                  d            | _        |j                  j	                  dd      j9                  dd      | _        | j)                  |t*        j<                        | _        t        j                  |j                  j	                  d            | _         t        j                  t        |j                  j	                  d            | _!        |j                  j	                  d      | _"        |j                  j	                  d      | _#        t        j                  t        |j                  j	                  d            | _$        t        j                  t        |j                  j	                  d            | _%        t        j                  t        |j                  j	                  d            | _&        t        j                  t        |j                  j	                  d            | _'        t        j                  t        |j                  j	                  d            | _(        t        j                  t        |j                  j	                  dd            | _)        |j                  j	                  d      | _*        |j                  j	                  d      | _+        |j                  j	                  d      | _,        |j                  j	                  d       | _-        |j                  j	                  d!      | _.        |j                  j	                  d"      | _/        |j                  j	                  d#| j^                        | _0        |j                  j	                  d$      | _1        | je                  |t*        jf                        | _4        t        j                  |j                  j	                  d%            | _5        t        j                  t        |j                  j	                  d&            | _6        d | _7        d | _8        d | _9        y )'NaddedAtartartBlurHashaudienceRating
childCountcollectionFilterBasedOnUser0collectionModez-1collectionPublishedcollectionSortcontentcontentRatingguidindexkey 	/childrenlastRatedAtlibrarySectionIDlibrarySectionKeylibrarySectionTitlemaxYearminYearratingratingCount	ratingKeysmartsubtypesummarythemethumbthumbBlurHashtitle	titleSorttype	updatedAt
userRating):_datar   
toDatetimeattribgetr   r   r   castfloatr   intr   r    r"   boolr#   r$   r%   r&   	findItemsr   Fieldfieldsr'   Imageimagesr(   replacer)   Labellabelsr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   findItemUltraBlurColorsultraBlurColorsr>   r?   _items_section_filters)selfdatas     '/opt/Tautulli/lib/plexapi/collection.py	_loadDatazCollection._loadDataG   s   
''	(BC;;??5);;??=9#jj@P0QR**S$++//,*GH+0::c4;;??Khjm;n+o(#jjdkkoo>NPT.UV#(::dDKKOODY[^4_#` #jjdkkoo>NPS.TU{{y1![[___=nnT5;;7KKOOF+	nnT5;;7ZZT[[__W%=>
;;??5"-55k2FnnT5;;7 ++DKKOOM,JK %

3@R0S T!%1D!E#';;??3H#I zz#t{{y'ABzz#t{{y'ABjj(AB ::c4;;??=+IJC)EFZZdkkoogs&CD
{{y1{{y1[[__W-
[[__W-
![[___=[[__W-
djjAKKOOF+	#}}T53H3HI))$++//+*FG**UDKKOOL,IJ    c                 4    t        | j                               S N)lenitemsrV   s    rX   __len__zCollection.__len__s   s    4::<  rZ   c              #   >   K   | j                         D ]  }|  y wr\   r^   )rV   items     rX   __iter__zCollection.__iter__v   s      JJL 	DJ	s   c                 H    t        fd| j                         D              S )Nc              3   P   K   | ]  }|j                   j                   k(    y wr\   )r)   ).0iothers     rX   	<genexpr>z*Collection.__contains__.<locals>.<genexpr>{   s     <!155EII%<s   #&)anyr^   )rV   ri   s    `rX   __contains__zCollection.__contains__z   s    <tzz|<<<rZ   c                 (    | j                         |   S r\   rb   )rV   r)   s     rX   __getitem__zCollection.__getitem__}   s    zz|C  rZ   c                 f    | j                   ry| j                  ry| j                  ryt        d      )z* Returns the listType for the collection. videoaudiophotozUnexpected collection type)isVideoisAudioisPhotor
   r_   s    rX   listTypezCollection.listType   s.     <<\\\\:;;rZ   c                     | j                   S )z1 Returns the type of metadata in the collection. r6   r_   s    rX   metadataTypezCollection.metadataType   s     ||rZ   c                     | j                   dv S )z- Returns True if this is a video collection. >   showmovieseasonepisoderx   r_   s    rX   rs   zCollection.isVideo   s     ||EEErZ   c                     | j                   dv S )z. Returns True if this is an audio collection. >   albumtrackartistrx   r_   s    rX   rt   zCollection.isAudio   s     ||;;;rZ   c                     | j                   dv S )z- Returns True if this is a photo collection. >   rr   
photoalbumrx   r_   s    rX   ru   zCollection.isPhoto   s     ||666rZ   zuse "items" instead   )
stacklevelc                 "    | j                         S r\   rb   r_   s    rX   childrenzCollection.children   s     zz|rZ   c                     | j                   r,| j                   | j                  | j                        | _        | j                  S )z Returns the search filter dict for smart collection.
            The filter dict be passed back into :func:`~plexapi.library.LibrarySection.search`
            to get the list of items.
        )r5   rU   _parseFiltersr%   r_   s    rX   filterszCollection.filters   s4    
 ::$--/ ..t||<DM}}rZ   c                 b    | j                   t        t        |          | _         | j                   S )zZ Returns the :class:`~plexapi.library.LibrarySection` this collection belongs to.
        )rT   superr   sectionrV   	__class__s    rX   r   zCollection.section   s*     == !*d;=DM}}rZ   c                     | j                         D ]1  }|j                  j                         |j                         k(  s/|c S  t        d| d      )a   Returns the item in the collection that matches the specified title.

            Parameters:
                title (str): Title of the item to return.

            Raises:
                :class:`plexapi.exceptions.NotFound`: When the item is not found in the collection.
        zItem with title "z" not found in the collection)r^   r;   lowerr	   )rV   r;   rc   s      rX   rc   zCollection.item   sQ     JJL 	Dzz!U[[]2	 *5'1NOPPrZ   c                     | j                   '| j                   d}| j                  |      }|| _         | j                   S )z0 Returns a list of all items in the collection. r+   )rS   r)   
fetchItems)rV   r)   r^   s      rX   r^   zCollection.items   s;    ;;XXJi(COOC(EDK{{rZ   c                 H   d| j                    d| j                   }| j                  j                  |      }| j	                  |t
              }|Qt        | j                  ||       }d| j                    d| j                   |_        | j                  |_        d|_        |S )zG Returns the :class:`~plexapi.library.ManagedHub` for this collection. z/hubs/sections/z/manage?metadataItemId=)cls)parentzcustom.collection..F)	r-   r4   _serverqueryrP   r   
identifierr;   	_promoted)rV   r)   rW   hubs       rX   
visibilityzCollection.visibility   s     5 566MdnnM]^||!!#&mmDjm1;T\\4=C1$2G2G1H$..IYZCN

CI!CM
rZ   c                 $    | j                  |      S )z4 Alias to :func:`~plexapi.library.Collection.item`. )rc   )rV   r;   s     rX   rC   zCollection.get   s    yyrZ   c                     | j                   st        d      ddd}|j                  |      }|t        d| dt        |             | j	                  |      S )a   Update the collection filtering user advanced setting.

            Parameters:
                user (str): One of the following values:
                    "admin" (Always the server admin user),
                    "user" (User currently viewing the content)

            Example:

                .. code-block:: python

                    collection.updateMode(user="user")

        zCCannot change collection filtering user for a non-smart collection.r      )adminuserz#Unknown collection filtering user: 
. Options )r    r5   r   rC   listeditAdvanced)rV   r   	user_dictr)   s       rX   filterUserUpdatezCollection.filterUserUpdate   sp     zzbcc 
	 mmD!;B4&
SWXaSbRcdee  S AArZ   c                     ddddd}|j                  |      }|t        d| dt        |             | j                  |      S )	a   Update the collection mode advanced setting.

            Parameters:
                mode (str): One of the following values:
                    "default" (Library default),
                    "hide" (Hide Collection),
                    "hideItems" (Hide Items in this Collection),
                    "showItems" (Show this Collection and its Items)

            Example:

                .. code-block:: python

                    collection.updateMode(mode="hide")

        r   r      )defaulthide	hideItems	showItemszUnknown collection mode: r   )r"   )rC   r   r   r   )rV   mode	mode_dictr)   s       rX   
modeUpdatezCollection.modeUpdate   s^    $ 	
	 mmD!;8jiHYZ[[   44rZ   c                     | j                   rt        d      dddd}|j                  |      }|t        d| dt        |             | j	                  |      S )	a   Update the collection order advanced setting.

            Parameters:
                sort (str): One of the following values:
                    "release" (Order Collection by release dates),
                    "alpha" (Order Collection alphabetically),
                    "custom" (Custom collection order)

            Example:

                .. code-block:: python

                    collection.sortUpdate(sort="alpha")

        z6Cannot change collection order for a smart collection.r   r   r   )releasealphacustomzUnknown sort dir: z. Options: )r$   r   )rV   sort	sort_dictr)   s       rX   
sortUpdatezCollection.sortUpdate  sp      ::UVV 
	
 mmD!;1${4	?BSTUU   44rZ   c                 f   | j                   rt        d      |rt        |t        t        f      s|g}g }|D ]d  }|j
                  | j                  k7  r%t        d| j                   d|j
                         |j                  t        |j                               f dj                  |      }| j                  j                          d| }d|i}| j                   dt        j                  |       }| j                  j!                  || j                  j"                  j$                         | S )	a|   Add items to the collection.

            Parameters:
                items (List): List of :class:`~plexapi.audio.Audio`, :class:`~plexapi.video.Video`,
                    or :class:`~plexapi.photo.Photo` objects to be added to the collection.

            Raises:
                :class:`plexapi.exceptions.BadRequest`: When trying to add items to a smart collection.
        z'Cannot add items to a smart collection.z4Can not mix media types when building a collection: z and ,/library/metadata/uri/itemsmethod)r5   r   
isinstancer   tupler=   r6   appendstrr4   joinr   _uriRootr)   r   joinArgsr   _sessionput)rV   r^   
ratingKeysrc   r   argsr)   s          rX   addItemszCollection.addItems/  s    ::FGGED%=9GE
 	3DyyDLL( #WX\XdXdWeejkoktktju!vwwc$..12	3
 XXj)
&&());J<Hs|
&!5 673t||'<'<'@'@ArZ   c                 $   | j                   rt        d      |rt        |t        t        f      s|g}|D ]X  }| j
                   d|j                   }| j                  j                  || j                  j                  j                         Z | S )a   Remove items from the collection.

            Parameters:
                items (List): List of :class:`~plexapi.audio.Audio`, :class:`~plexapi.video.Video`,
                    or :class:`~plexapi.photo.Photo` objects to be removed from the collection.

            Raises:
                :class:`plexapi.exceptions.BadRequest`: When trying to remove items from a smart collection.
        z,Cannot remove items from a smart collection./items/r   )r5   r   r   r   r   r)   r4   r   r   r   delete)rV   r^   rc   r)   s       rX   removeItemszCollection.removeItemsM  s     ::KLLED%=9GE 	IDXXJgdnn%56CLLs4<<+@+@+G+GH	I rZ   c                 
   | j                   rt        d      | j                   d|j                   d}|r|d|j                   z  }| j                  j                  || j                  j                  j                         | S )aH   Move an item to a new position in the collection.

            Parameters:
                item (obj): :class:`~plexapi.audio.Audio`, :class:`~plexapi.video.Video`,
                    or :class:`~plexapi.photo.Photo` object to be moved in the collection.
                after (obj): :class:`~plexapi.audio.Audio`, :class:`~plexapi.video.Video`,
                    or :class:`~plexapi.photo.Photo` object to move the item after in the collection.

            Raises:
                :class:`plexapi.exceptions.BadRequest`: When trying to move items in a smart collection.
        z(Cannot move items in a smart collection.r   z/movez?after=r   )r5   r   r)   r4   r   r   r   r   )rV   rc   afterr)   s       rX   moveItemzCollection.moveItemb  sw     ::GHH
'$..!17WU__-..C3t||'<'<'@'@ArZ   c                    | j                   st        d      | j                         } |j                  d||||d|}| j                  j                          | }d|i}	| j                   dt        j                  |	       }
| j                  j                  |
| j                  j                  j                         | S )a   Update the filters for a smart collection.

            Parameters:
                libtype (str): The specific type of content to filter
                    (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).
                limit (int): Limit the number of items in the collection.
                sort (str or list, optional): A string of comma separated sort fields
                    or a list of sort fields in the format ``column:dir``.
                    See :func:`~plexapi.library.LibrarySection.search` for more info.
                filters (dict): A dictionary of advanced filters.
                    See :func:`~plexapi.library.LibrarySection.search` for more info.
                **kwargs (dict): Additional custom filters to apply to the search results.
                    See :func:`~plexapi.library.LibrarySection.search` for more info.

            Raises:
                :class:`plexapi.exceptions.BadRequest`: When trying update filters for a regular collection.
        z/Cannot update filters for a regular collection.r   libtypelimitr   r   r   r    )r5   r   r   _buildSearchKeyr   r   r)   r   r   r   r   r   )rV   r   r   r   r   kwargsr   	searchKeyr   r   r)   s              rX   updateFilterszCollection.updateFiltersy  s    $ zzNOO,,.+G++ PweWPHNP	&&())5s|
&!5 673t||'<'<'@'@ArZ   zHuse editTitle, editSortTitle, editContentRating, and editSummary insteadc                     i }|
||d<   d|d<   |
||d<   d|d<   |
||d<   d|d<   |
||d	<   d|d
<   |j                  |        | j                  di | y)a^   Edit the collection.

            Parameters:
                title (str, optional): The title of the collection.
                titleSort (str, optional): The sort title of the collection.
                contentRating (str, optional): The summary of the collection.
                summary (str, optional): The summary of the collection.
        Nztitle.valuer   ztitle.lockedztitleSort.valueztitleSort.lockedzcontentRating.valuezcontentRating.lockedzsummary.valuezsummary.lockedr   )update_edit)rV   r;   r<   r&   r7   r   r   s          rX   editzCollection.edit  s     "'D#$D  &/D"#'(D#$$*7D&'+,D'($+D!%&D!"F

TrZ   c                 *    t         t        |           y)z Delete the collection. N)r   r   r   r   s    rX   r   zCollection.delete  s    j$&(rZ   c                    |st        d      t        |t              s|j                  j	                  |      }|rt        |t
        t        f      s|g}|d   j                  }g }|D ]@  }|j                  |k7  rt        d      |j                  t        |j                               B dj                  |      }|j                          d| }|t        j                  |      |d|j                  d}	dt        j                   |	       }
|j#                  |
|j$                  j&                        d   } | |||
	      S )
z Create a regular collection. z7Must include items to add when creating new collection.r   z3Can not mix media types when building a collection.r   r   r   r=   r;   r5   	sectionId/library/collectionsr   initpath)r   r   r   libraryr   r   r   r=   r   r   r4   r   r   r   
searchTyper)   r   r   r   post)r   serverr;   r   r^   itemTyper   rc   r   r   r)   rW   s               rX   _createzCollection._create  s*    VWW'>2nn,,W5GED%=9GE8==
 	3DyyH$ !VWWc$..12	3
 XXj)
"##5j\BE$4$4X$>YZipititu$U^^D%9$:;||C(<(<|=a@64#..rZ   c                    t        |t              s|j                  j                  |      }|xs |j                  } |j
                  d||||d|}	|j                          |	 }
|
t        j                  |      |d|j                  d}dt        j                  |       }|j                  ||j                  j                        d   } | |||      S )	z Create a smart collection. r   r   r   r   r   r   r   r   )r   r   r   r   TYPEr   r   r   r   r)   r   r   r   r   )r   r   r;   r   r   r   r   r   r   r   r   r   r)   rW   s                 rX   _createSmartzCollection._createSmart  s     '>2nn,,W5G)W\\+G++ PweWPHNP	"#I;/E$4$4W$=XYhohshst$U^^D%9$:;||C(<(<|=a@64#..rZ   c
           	      z    |r&|rt        d       | j                  |||||||	fi |
S | j                  ||||      S )av   Create a collection.

            Parameters:
                server (:class:`~plexapi.server.PlexServer`): Server to create the collection on.
                title (str): Title of the collection.
                section (:class:`~plexapi.library.LibrarySection`, str): The library section to create the collection in.
                items (List): Regular collections only, list of :class:`~plexapi.audio.Audio`,
                    :class:`~plexapi.video.Video`, or :class:`~plexapi.photo.Photo` objects to be added to the collection.
                smart (bool): True to create a smart collection. Default False.
                limit (int): Smart collections only, limit the number of items in the collection.
                libtype (str): Smart collections only, the specific type of content to filter
                    (movie, show, season, episode, artist, album, track, photoalbum, photo).
                sort (str or list, optional): Smart collections only, a string of comma separated sort fields
                    or a list of sort fields in the format ``column:dir``.
                    See :func:`~plexapi.library.LibrarySection.search` for more info.
                filters (dict): Smart collections only, a dictionary of advanced filters.
                    See :func:`~plexapi.library.LibrarySection.search` for more info.
                **kwargs (dict): Smart collections only, additional custom filters to apply to the
                    search results. See :func:`~plexapi.library.LibrarySection.search` for more info.

            Raises:
                :class:`plexapi.exceptions.BadRequest`: When no items are included to create the collection.
                :class:`plexapi.exceptions.BadRequest`: When mixing media types in the collection.

            Returns:
                :class:`~plexapi.collection.Collection`: A new instance of the created Collection.
        z,Cannot create a smart collection with items.)r   r   r   )r   r   r;   r   r^   r5   r   r   r   r   r   s              rX   createzCollection.create  sQ    <  !OPP#3##FE7E7DRYd]cdd;;vugu==rZ   c	                    | j                         j                  st        d      ddlm}	m}
m} | j                  j                         } |	| j                  d      }|r|n| j                  |_	        | j                  |_
        | j                  |_        | j                  |_        | j                  j                  |_        t        | j                    d      }d| |_        |
j%                  ||      |_        | j(                  r|j+                  |      |_        nQ| j.                  r|j1                  |      |_        n.| j2                  r|j5                  |      |_        nt7        d      |j9                  |||      S )	a!   Add the collection as sync item for the specified device.
            See :func:`~plexapi.myplex.MyPlexAccount.sync` for possible exceptions.

            Parameters:
                videoQuality (int): idx of quality of the video, one of VIDEO_QUALITY_* values defined in
                                    :mod:`~plexapi.sync` module. Used only when collection contains video.
                photoResolution (str): maximum allowed resolution for synchronized photos, see PHOTO_QUALITY_* values in
                                       the module :mod:`~plexapi.sync`. Used only when collection contains photos.
                audioBitrate (int): maximum bitrate for synchronized music, better use one of MUSIC_BITRATE_* values
                                    from the module :mod:`~plexapi.sync`. Used only when collection contains audio.
                client (:class:`~plexapi.myplex.MyPlexDevice`): sync destination, see
                                                               :func:`~plexapi.myplex.MyPlexAccount.sync`.
                clientId (str): sync destination, see :func:`~plexapi.myplex.MyPlexAccount.sync`.
                limit (int): maximum count of items to sync, unlimited if `None`.
                unwatched (bool): if `True` watched videos wouldn't be synced.
                title (str): descriptive title for the new :class:`~plexapi.sync.SyncItem`, if empty the value would be
                             generated from metadata of current photo.

            Raises:
                :exc:`~plexapi.exceptions.BadRequest`: When collection is not allowed to sync.
                :exc:`~plexapi.exceptions.Unsupported`: When collection content is unsupported.

            Returns:
                :class:`~plexapi.sync.SyncItem`: A new instance of the created sync item.
        z%The collection is not allowed to syncr   )SyncItemPolicyMediaSettingsNz/children?excludeAllLeaves=1zlibrary:///directory/zUnsupported collection content)clientclientId)r   	allowSyncr   plexapi.syncr   r   r   r   myPlexAccountr;   	rootTitlerv   contentTypery   machineIdentifierr   r)   locationr   policyrs   createVideomediaSettingsrt   createMusicru   createPhotor
   sync)rV   videoQualityphotoResolutionaudioBitrater   r   r   	unwatchedr;   r   r   r   myplex	sync_itemr)   s                  rX   r  zCollection.sync  s5   6 ||~''DEE@@++-T\\40	#(%djj	"jj	 $	!%!2!2	&*ll&D&D	#DHH:%ABC4SE:	!==	:	<<&3&?&?&MI#\\&3&?&?&MI#\\&3&?&?&PI#>??{{9Vh{GGrZ   c                     t        j                  | j                        }t        t	        d      dz  |d   z  |dd  dz        S )zL Returns the Plex Media Server data directory where the metadata is stored. MetadataCollectionsr   r   Nz.bundle)r   sha1hashr'   r   r   )rV   	guid_hashs     rX   metadataDirectoryzCollection.metadataDirectory?  sI     NN499-	4
#m3ilB	RSRTV]E^^__rZ   r\   )NNNN)NFNNNN)NNNNNNFN))__name__
__module____qualname____doc__TAGr   rY   r`   rd   rl   rn   propertyrv   ry   rs   rt   ru   r   r   r   r   rc   r^   r   rC   r   r   r   r   r   r   r   r   r   classmethodr   r   r   r  r  __classcell__)r   s   @rX   r   r      s   +X CD*X!=! 	< 	<   F F < < 7 7 %!4 5 Q
 B6585:<*.> Z[ \4) / /4 / /  KO04"> ">H rv$(5Hn ` `rZ   r   N)pathlibr   urllib.parser   plexapir   r   plexapi.baser   plexapi.exceptionsr   r	   r
   plexapi.libraryr   r   plexapi.mixinsr   r   r   r   r   r   r   r   plexapi.utilsr   registerPlexObjectr   r   rZ   rX   <module>r$     sj     #   * @ @ 6  
 % q`+Yk:	q` q`rZ   