[nat] wikipedia image scraper
This commit is contained in:
@@ -49,13 +49,14 @@
|
||||
`(let [,@bindingList
|
||||
,retValSymbol {,@body}]
|
||||
,@saveList
|
||||
(.refreshEntry ,archive ,e) // Check the entry in and out of systems when its components change
|
||||
,retValSymbol)))
|
||||
|
||||
(defMacro withWritableEntry [archive e &body body]
|
||||
(let [retValSymbol
|
||||
(symbol)]
|
||||
`(let [,retValSymbol {,@body}]
|
||||
(archive.refreshEntry ,e)
|
||||
(.refreshEntry ,archive ,e)
|
||||
,retValSymbol)))
|
||||
|
||||
// Create a system that selects Entries according to a single string component (i.e. Name or Author) matching the given value
|
||||
@@ -77,13 +78,14 @@
|
||||
(function componentsMatch [:nat.Entry e componentsBoolExp]
|
||||
(BoolExpInterp.eval componentsBoolExp (for =>cType cId e.components cType)))
|
||||
|
||||
(function addFile [:nat.Archive archive :nat.Entry e :String file &opt leaveOriginalCopy]
|
||||
(function addFiles [:nat.Archive archive :nat.Entry e :Array<String> files &opt leaveOriginalCopy]
|
||||
(withWritableEntry archive e
|
||||
(let [pathWithoutDir (haxe.io.Path.withoutDirectory file)]
|
||||
(unless !(= -1 (e.files.indexOf pathWithoutDir))
|
||||
((if leaveOriginalCopy sys.io.File.copy sys.FileSystem.rename)
|
||||
file (joinPath archive.archiveDir "files" pathWithoutDir))
|
||||
(e.files.push pathWithoutDir)))))
|
||||
(doFor file files
|
||||
(let [pathWithoutDir (haxe.io.Path.withoutDirectory file)]
|
||||
(unless !(= -1 (e.files.indexOf pathWithoutDir))
|
||||
((if leaveOriginalCopy sys.io.File.copy sys.FileSystem.rename)
|
||||
file (joinPath archive.archiveDir "files" pathWithoutDir))
|
||||
(e.files.push pathWithoutDir))))))
|
||||
|
||||
(function addTags [:nat.Archive archive :nat.Entry e :Array<String> tagsToAdd]
|
||||
(if (hasComponent e Tags)
|
||||
|
||||
Reference in New Issue
Block a user