detached #2
@ -180,7 +180,7 @@ Tiddler >> customFieldsWithMediaLinks [
|
||||
| response |
|
||||
response := OrderedDictionary new.
|
||||
self customFields keysAndValuesDo: [:k :v |
|
||||
(v endsWithAnyOf: #('mp4' 'jpg' 'jpeg' 'png'))
|
||||
(v endsWithAnyOf: #('mp4' 'wav' 'jpg' 'jpeg' 'png'))
|
||||
ifTrue: [response at: k put: v ]
|
||||
].
|
||||
^ response
|
||||
@ -192,8 +192,19 @@ Tiddler >> deleteUid [
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
Tiddler >> downloadAndIndexMediaLinksInto: aFolder [
|
||||
^ self customFieldsWithMediaLinks
|
||||
Tiddler >> downloadAndRelinkExternalMedia [
|
||||
self customFieldsWithMediaLinks
|
||||
keysAndValuesDo: [:k :v |
|
||||
(v endsWithAnyOf: #('mp4'))
|
||||
ifTrue: [ | fileName filePath |
|
||||
fileName := v asUrl segments last.
|
||||
filePath := (FileLocator temp / fileName) fullName.
|
||||
GtSubprocessWithInMemoryOutput new
|
||||
shellCommand: 'curl -# ', v, ' -o ', filePath;
|
||||
runAndWait;
|
||||
stdout
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
@ -256,6 +256,7 @@ TiddlyWiki >> exportContentType: aMimeType [
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> exportJSONFile [
|
||||
| docTree rawJsonTiddlers |
|
||||
self tiddlers isNotEmpty ifTrue: [^ self exportJSONFileFromTiddlers ].
|
||||
self htmlFileExists.
|
||||
docTree := XMLHTMLParser parse: self file contents.
|
||||
rawJsonTiddlers := (docTree xpath: '//script[@class="tiddlywiki-tiddler-store"]') stringValue.
|
||||
@ -264,6 +265,21 @@ TiddlyWiki >> exportJSONFile [
|
||||
|
||||
{ #category : #accessing }
|
||||
TiddlyWiki >> exportJSONFileFromTiddlers [
|
||||
| response |
|
||||
response := '' writeStream.
|
||||
response
|
||||
nextPutAll: '['; cr.
|
||||
self tiddlers allButLastDo: [:tiddler |
|
||||
response
|
||||
nextPutAll: tiddler asJsonString;
|
||||
nextPutAll: ','; cr
|
||||
].
|
||||
response
|
||||
nextPutAll: self tiddlers last asJsonString; cr;
|
||||
nextPutAll: ']'; cr.
|
||||
^ MarkupFile
|
||||
exportAsFileOn: self folder / 'tiddlers.json'
|
||||
containing: response contents
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
|
Loading…
Reference in New Issue
Block a user