detached #2
@ -193,18 +193,56 @@ Tiddler >> deleteUid [
|
|||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
Tiddler >> downloadAndRelinkExternalMedia [
|
Tiddler >> downloadAndRelinkExternalMedia [
|
||||||
self customFieldsWithMediaLinks
|
| mediaExtensions|
|
||||||
keysAndValuesDo: [:k :v |
|
mediaExtensions := Dictionary new
|
||||||
(v endsWithAnyOf: #('mp4'))
|
at: 'audio' put: #('wav');
|
||||||
ifTrue: [ | fileName filePath |
|
at: 'video' put: #('mp4');
|
||||||
fileName := v asUrl segments last.
|
at: 'image' put: #('jpg' 'jpeg' 'png');
|
||||||
filePath := (FileLocator temp / fileName) fullName.
|
yourself.
|
||||||
GtSubprocessWithInMemoryOutput new
|
self customFieldsWithMediaLinks
|
||||||
shellCommand: 'curl -# ', v, ' -o ', filePath;
|
keysAndValuesDo: [ :k :v |
|
||||||
runAndWait;
|
mediaExtensions keysAndValuesDo: [:kind :extensions |
|
||||||
stdout
|
(v asLowercase endsWithAnyOf: extensions)
|
||||||
]
|
ifTrue: [ | localFile|
|
||||||
]
|
self downloadLink: v for: k into: 'external/', kind , '/'.
|
||||||
|
localFile := (self wiki substitutions at: self title at: k) second.
|
||||||
|
self customFields at: k put: localFile.
|
||||||
|
]
|
||||||
|
]
|
||||||
|
].
|
||||||
|
^ self wiki substitutions
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
Tiddler >> downloadLink: v for: k [
|
||||||
|
| filePath fileName semiFilePath |
|
||||||
|
fileName := v asUrl segments last.
|
||||||
|
semiFilePath := 'external/video/' , fileName.
|
||||||
|
filePath := (self wiki folder / semiFilePath) fullName.
|
||||||
|
GtSubprocessWithInMemoryOutput new
|
||||||
|
shellCommand: 'curl -L -# ' , v , ' -o ' , filePath;
|
||||||
|
runAndWait;
|
||||||
|
stdout.
|
||||||
|
^ Dictionary new
|
||||||
|
at: k
|
||||||
|
put: {v.
|
||||||
|
semiFilePath};
|
||||||
|
yourself
|
||||||
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
Tiddler >> downloadLink: v for: k into: subfolder [
|
||||||
|
| filePath fileName semiFilePath |
|
||||||
|
fileName := v asUrl segments last.
|
||||||
|
semiFilePath := subfolder , fileName.
|
||||||
|
filePath := (self wiki folder / semiFilePath) fullName.
|
||||||
|
GtSubprocessWithInMemoryOutput new
|
||||||
|
shellCommand: 'curl -L -# ' , v , ' -o ' , filePath;
|
||||||
|
runAndWait;
|
||||||
|
stdout.
|
||||||
|
^ self wiki substitutions
|
||||||
|
at: self title at: k put: {v. semiFilePath};
|
||||||
|
yourself
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
|
@ -516,8 +516,8 @@ TiddlyWiki >> importJSONLink [
|
|||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> importSTONFilesFrom: aFolder [
|
TiddlyWiki >> importSTONFilesFrom: aFolder [
|
||||||
| tiddlerFiles |
|
| tiddlerFiles |
|
||||||
self folder: aFolder parent.
|
self folder: aFolder.
|
||||||
tiddlerFiles := aFolder children
|
tiddlerFiles := (aFolder / 'tiddlers') children
|
||||||
select: [ :localFile | localFile basename endsWith: '.ston' ].
|
select: [ :localFile | localFile basename endsWith: '.ston' ].
|
||||||
self tiddlers: (tiddlerFiles collect: [ :each | | tempTiddler|
|
self tiddlers: (tiddlerFiles collect: [ :each | | tempTiddler|
|
||||||
tempTiddler := STON fromString: each contents.
|
tempTiddler := STON fromString: each contents.
|
||||||
@ -912,6 +912,11 @@ TiddlyWiki >> shadow [
|
|||||||
^ self tiddlers select: [:tiddler | tiddler title beginsWith: '$:/']
|
^ self tiddlers select: [:tiddler | tiddler title beginsWith: '$:/']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #'as yet unclassified' }
|
||||||
|
TiddlyWiki >> substitutions [
|
||||||
|
^ self config at: 'substitutions' ifAbsentPut: [ Dictionary new].
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
TiddlyWiki >> syncRemoteLocalDestructive [
|
TiddlyWiki >> syncRemoteLocalDestructive [
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user