[View] [Edit] [Lock] [References] [Attachments] [History] [Home] [Changes] [Search] [Help]
test[photos8] 02 Accessing Assets
"Accessing all Assets"
| media extents |
media := PoolDictionary new.
extents := PoolDictionary new.
PHAsset collection do: [:each|
(media
at: each mediaTypeSelector
ifAbsentPut: [#()])
add: each.
(extents
at: each extent printString
ifAbsentPut: [#()])
add: each
].
media associationsDo: [:assoc|
self print: '// ',assoc value size ,' ' ,assoc key ,' assets '
].
extents associationsDo: [:assoc|
self print: '// ',assoc value size ,' assets of extent ' ,assoc key
].
"Accessing Assets of known albums"
#(Buceo 'My Photo Stream' missing ) do: [:title| | album |
"self print: '// Searching album titled ',title."
album := PHAssetCollection album: title.
self print: (album isNil
ifTrue: [ '// Missing Album titled ',title ]
ifFalse: [ '// Album ',title,' has ', album count,' assets' ])
]
"Accesing smart albums"
#( Videos Screenshots 'Recently Deleted' Hidden Bursts
'Time-lapse' 'Slo-mo' 'Recently Added'
Favorites Selfies Panoramas Portrait
'Live Photos' Animated
) do: [:title| | album |
album := PHAssetCollection smartAlbum: title.
album notNil ifTrue: [
self print: '// Found ' ,album assets size ,' assets in ',title
]
].