detached #2
@ -180,7 +180,7 @@ Tiddler >> customFieldsWithMediaLinks [
|
|||||||
| response |
|
| response |
|
||||||
response := OrderedDictionary new.
|
response := OrderedDictionary new.
|
||||||
self customFields keysAndValuesDo: [:k :v |
|
self customFields keysAndValuesDo: [:k :v |
|
||||||
(v endsWithAnyOf: #('mp4' 'jpg' 'jpeg' 'png'))
|
(v endsWithAnyOf: #('mp4' 'wav' 'jpg' 'jpeg' 'png'))
|
||||||
ifTrue: [response at: k put: v ]
|
ifTrue: [response at: k put: v ]
|
||||||
].
|
].
|
||||||
^ response
|
^ response
|
||||||
@ -192,8 +192,19 @@ Tiddler >> deleteUid [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
Tiddler >> downloadAndIndexMediaLinksInto: aFolder [
|
Tiddler >> downloadAndRelinkExternalMedia [
|
||||||
^ self customFieldsWithMediaLinks
|
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 }
|
{ #category : #accessing }
|
||||||
|
@ -256,6 +256,7 @@ TiddlyWiki >> exportContentType: aMimeType [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> exportJSONFile [
|
TiddlyWiki >> exportJSONFile [
|
||||||
| docTree rawJsonTiddlers |
|
| docTree rawJsonTiddlers |
|
||||||
|
self tiddlers isNotEmpty ifTrue: [^ self exportJSONFileFromTiddlers ].
|
||||||
self htmlFileExists.
|
self htmlFileExists.
|
||||||
docTree := XMLHTMLParser parse: self file contents.
|
docTree := XMLHTMLParser parse: self file contents.
|
||||||
rawJsonTiddlers := (docTree xpath: '//script[@class="tiddlywiki-tiddler-store"]') stringValue.
|
rawJsonTiddlers := (docTree xpath: '//script[@class="tiddlywiki-tiddler-store"]') stringValue.
|
||||||
@ -264,6 +265,21 @@ TiddlyWiki >> exportJSONFile [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> exportJSONFileFromTiddlers [
|
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 }
|
{ #category : #accessing }
|
||||||
|
Loading…
Reference in New Issue
Block a user