def from_photostation(cls, album, psphoto): info = psphoto['info'] created = int( time.mktime(time.strptime(info['takendate'], '%Y-%m-%d %H:%M:%S'))) * 1000 modified = int( time.mktime(time.strptime(info['createdate'], '%Y-%m-%d %H:%M:%S'))) * 1000 filesize = int(info['size']) if info.get('gps') is not None: latitude = info['gps']['lat'] longitude = info['gps']['lng'] else: latitude = longitude = None photoid = psphoto.get('id') thumbnail_sig = '' thumbnail_size = {} try: thumbnail_status = psphoto.get('thumbnail_status') thumbnail_status = thumbnail_status.split(',') thumb_size = psphoto.get('additional').get('thumb_size') thumbnail_sig = thumb_size.get('sig') for x in thumbnail_status: thumbnail_size[x] = thumb_size.get(x) except: pass return cls(album=album, photoid=photoid, filename=PhotoStationUtils.photo_name(psphoto['id']), filetype=psphoto['type'], created=created, modified=modified, filesize=filesize, title=info['title'].encode('utf-8'), description=info['description'].encode('utf-8'), rating=info['rating'], latitude=latitude, longitude=longitude, thumbnail_sig=thumbnail_sig, thumbnail_sizes=thumbnail_size)
def from_photostation(cls, album, psphoto): info = psphoto['info'] created = int(time.mktime(time.strptime(info['takendate'], '%Y-%m-%d %H:%M:%S'))) * 1000 modified = int(time.mktime(time.strptime(info['createdate'], '%Y-%m-%d %H:%M:%S'))) * 1000 filesize = int(info['size']) if info.get('gps') is not None: latitude = info['gps']['lat'] longitude = info['gps']['lng'] else: latitude = longitude = None return cls(album, filename = PhotoStationUtils.photo_name(psphoto['id']), filetype = psphoto['type'], created = created, modified = modified, filesize = filesize, title = info['title'].encode('utf-8'), description = info['description'].encode('utf-8'), rating = info['rating'], latitude = latitude, longitude = longitude)