InstagramPharo/Instagram/InstagramLocal.class.st

64 lines
1.5 KiB
Smalltalk
Raw Normal View History

Class {
#name : #InstagramLocal,
#superclass : #Object,
#instVars : [
'profiles',
'rootDir',
'posts'
],
#category : #Instagram
}
{ #category : #'as yet unclassified' }
InstagramLocal >> postsProcessed [
| temp shortcodes |
temp := Dictionary new.
shortcodes := OrderedCollection new.
self profiles
keysAndValuesDo: [ :k :v |
| sel col |
sel := v children
select: [ :file | file extension = 'json' and: [ file basename includesSubstring: 'code:' ] ].
col := sel
collect: [ :file | | tempShortcode |
tempShortcode := ('code:' split: file basenameWithoutExtension) second.
shortcodes add: tempShortcode.
(v / ('Post-' , tempShortcode ))
ensureCreateDirectory ].
temp at: k put: col. ].
^ { temp . shortcodes }
]
{ #category : #accessing }
InstagramLocal >> postsTiddlers [
| temp jsons|
temp := OrderedCollection new.
self profiles
valuesDo: [ :v |
temp
add: (v children
select: [ :file | file extension = 'json' and: [ file basename includesSubstring: 'code:' ] ]) ].
jsons := temp flatten collect: [ :post | STONJSON fromString: post contents ].
^ jsons collect: [:json | Tiddler nowLocal ]
]
{ #category : #accessing }
InstagramLocal >> profiles [
^ profiles
]
{ #category : #accessing }
InstagramLocal >> profiles: aCollectionProfiles [
profiles := aCollectionProfiles
]
{ #category : #accessing }
InstagramLocal >> rootDir [
^ rootDir
]
{ #category : #accessing }
InstagramLocal >> rootDir: anObject [
rootDir := anObject
]