Add basic logging to PhotosService
This commit is contained in:
parent
3b57397795
commit
1e53077ab9
1 changed files with 9 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
|
@ -13,6 +14,8 @@ from pyicloud.exceptions import (
|
||||||
from future.moves.urllib.parse import unquote
|
from future.moves.urllib.parse import unquote
|
||||||
from future.utils import listvalues, listitems
|
from future.utils import listvalues, listitems
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PhotosService(object):
|
class PhotosService(object):
|
||||||
""" The 'Photos' iCloud service."""
|
""" The 'Photos' iCloud service."""
|
||||||
|
@ -66,6 +69,7 @@ class PhotosService(object):
|
||||||
return self.albums['All Photos']
|
return self.albums['All Photos']
|
||||||
|
|
||||||
def _fetch_asset_data_for(self, client_ids):
|
def _fetch_asset_data_for(self, client_ids):
|
||||||
|
logger.debug("Fetching data for client IDs %s", client_ids)
|
||||||
client_ids = [cid for cid in client_ids
|
client_ids = [cid for cid in client_ids
|
||||||
if cid not in self._photo_assets]
|
if cid not in self._photo_assets]
|
||||||
|
|
||||||
|
@ -131,6 +135,8 @@ class PhotoAlbum(object):
|
||||||
return self._photo_assets
|
return self._photo_assets
|
||||||
|
|
||||||
def _parse_binary_feed(self, feed):
|
def _parse_binary_feed(self, feed):
|
||||||
|
logger.debug("Parsing binary feed %s", feed)
|
||||||
|
|
||||||
binaryfeed = bytearray(b64decode(feed))
|
binaryfeed = bytearray(b64decode(feed))
|
||||||
bitstream = ConstBitStream(binaryfeed)
|
bitstream = ConstBitStream(binaryfeed)
|
||||||
|
|
||||||
|
@ -170,6 +176,9 @@ class PhotoAlbum(object):
|
||||||
range_length = bitstream.read("uint:24")
|
range_length = bitstream.read("uint:24")
|
||||||
range_end = range_start + range_length
|
range_end = range_start + range_length
|
||||||
|
|
||||||
|
logger.debug("Decoding indexes [%s-%s) (length %s)",
|
||||||
|
range_start, range_end, range_length)
|
||||||
|
|
||||||
previous_asset_id = 0
|
previous_asset_id = 0
|
||||||
for index in range(range_start, range_end):
|
for index in range(range_start, range_end):
|
||||||
aspect_ratio = ASPECT_RATIOS[bitstream.read("uint:4")]
|
aspect_ratio = ASPECT_RATIOS[bitstream.read("uint:4")]
|
||||||
|
|
Loading…
Reference in a new issue