File metadata extraction.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-10-14 13:01:27 -05:00
parent cea7ce5e6c
commit bb7bab403e

View File

@ -23,6 +23,30 @@ FileLocator class >> atAlias: aString put: aFolderOrFile [
^ updatedAliases ^ updatedAliases
] ]
{ #category : #'*MiniDocs' }
FileLocator >> extractMetadata [
"I package the functionality from [[How to extract meta information using ExifTool]],
from the GToolkit Book.
I depend on the external tool ExifTool."
| process variablesList |
process := GtSubprocessWithInMemoryOutput new
command: 'exiftool';
arguments: { self fullName}.
process errorBlock: [ :proc | ^ self error: 'Failed to run exiftool' ].
process runAndWait.
variablesList := process stdout lines collect: [ :currentLine |
| separatorIndex name value |
separatorIndex := currentLine indexOf: $:.
name := (currentLine copyFrom: 1 to: separatorIndex - 1) trimBoth.
value := (currentLine
copyFrom: separatorIndex + 1
to: currentLine size) trimBoth.
name -> value
].
^ variablesList asOrderedDictionary
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
FileLocator class >> fileAliases [ FileLocator class >> fileAliases [
^ MiniDocs appFolder / 'fileAliases.ston' ^ MiniDocs appFolder / 'fileAliases.ston'