# Path: resources/lib/PhoneBooks/pyicloud/exceptions.py
# class PyiCloudAPIResponseError(PyiCloudException):
#     def __init__(self, reason, code):
#         self.reason = reason
#         self.code = code
#         message = reason
#         if code:
#             message += " (%s)" % code
# 
#         super(PyiCloudAPIResponseError, self).__init__(message)
# 
# class PyiCloudBinaryFeedParseError(Exception):
#     pass
# 
# class PyiCloudPhotoLibraryNotActivatedErrror(Exception):
#     pass


import sys
import json
import urllib
from datetime import datetime
from base64 import b64decode
from bitstring import ConstBitStream
from ..exceptions import (
    PyiCloudAPIResponseError,
    PyiCloudBinaryFeedParseError,
    PyiCloudPhotoLibraryNotActivatedErrror
)
        BUILTIN_ALBUMS = {
            'recently-added': "Recently Added",
            'time-lapse': "Time-lapse",
            'videos': "Videos",
            'slo-mo': 'Slo-mo',
            'all-photos': "All Photos",
            'selfies': "Selfies",
            'bursts': "Bursts",
            'favorites': "Favourites",
            'panoramas': "Panoramas",
            'deleted-photos': "Recently Deleted",
            'hidden': "Hidden",
            'screenshots': "Screenshots"
        }
        if self.data.get('isServerGenerated'):
            return BUILTIN_ALBUMS[self.data.get('serverId')]
        else:
            return self.data.get('title')

    def __iter__(self):
        return iter(self.photos)

    def __getitem__(self, index):
        return self.photos[index]

    @property
    def photos(self):
        if not self._photo_assets:
            child_assets = self.data.get('childAssetsBinaryFeed')
            if not child_assets:

# Path: resources/lib/PhoneBooks/pyicloud/exceptions.py
# class PyiCloudAPIResponseError(PyiCloudException):
#     def __init__(self, reason, code):
#         self.reason = reason
#         self.code = code
#         message = reason
#         if code:
#             message += " (%s)" % code
# 
#         super(PyiCloudAPIResponseError, self).__init__(message)
# 
# class PyiCloudBinaryFeedParseError(Exception):
#     pass
# 
# class PyiCloudPhotoLibraryNotActivatedErrror(Exception):
#     pass


# Path: resources/lib/PhoneBooks/pyicloud/services/photos.py
import sys
import json
import urllib
from datetime import datetime
from base64 import b64decode
from bitstring import ConstBitStream
from ..exceptions import (
    PyiCloudAPIResponseError,
    PyiCloudBinaryFeedParseError,
    PyiCloudPhotoLibraryNotActivatedErrror
)

        BUILTIN_ALBUMS = {
            'recently-added': "Recently Added",
            'time-lapse': "Time-lapse",
            'videos': "Videos",
            'slo-mo': 'Slo-mo',
            'all-photos': "All Photos",
            'selfies': "Selfies",
            'bursts': "Bursts",
            'favorites': "Favourites",
            'panoramas': "Panoramas",
            'deleted-photos': "Recently Deleted",
            'hidden': "Hidden",
            'screenshots': "Screenshots"
        }
        if self.data.get('isServerGenerated'):
            return BUILTIN_ALBUMS[self.data.get('serverId')]
        else:
            return self.data.get('title')

    def __iter__(self):
        return iter(self.photos)

    def __getitem__(self, index):
        return self.photos[index]

    @property
    def photos(self):
        if not self._photo_assets:
            child_assets = self.data.get('childAssetsBinaryFeed')
            if not child_assets:

                raise PyiCloudBinaryFeedParseError(