Skip to content

Instantly share code, notes, and snippets.

@arthurhammer arthurhammer/ Secret
Last active Jan 4, 2019

What would you like to do?
Index iCloud Photo Library (Pythonista)
import json
import photos
import dialogs
# Run this from within Pythonista on iOS.
types = ["image", "video", "audio", "unknown"]
include_hidden = True
def get_assets(type):
assets = reversed(photos.get_assets(media_type=type, include_hidden=include_hidden))
return [{
"date": p.creation_date.isoformat(),
"type": p.media_type,
"subtypes": p.media_subtypes,
"favorite": p.favorite,
"hidden": p.hidden,
"duration": p.duration,
"width": p.pixel_width,
"height": p.pixel_height
} for p in assets]
result = []
for type in types:
result = result + get_assets(type)
result = sorted(result, key=lambda p: p["date"])
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.