don't add duplicates to sources.tsv
This commit is contained in:
@@ -3,11 +3,15 @@
|
|||||||
(defMacroFunction appendToSources [query resultNumber apiName author apiQuery]
|
(defMacroFunction appendToSources [query resultNumber apiName author apiQuery]
|
||||||
(unless (FileSystem.exists ASSET_SOURCES_FILE)
|
(unless (FileSystem.exists ASSET_SOURCES_FILE)
|
||||||
(File.saveContent ASSET_SOURCES_FILE ""))
|
(File.saveContent ASSET_SOURCES_FILE ""))
|
||||||
(File.saveContent
|
(let [newLine "${query}\t${resultNumber}\t${apiName}\t${author}\t${apiQuery}\n"
|
||||||
ASSET_SOURCES_FILE
|
existingSources (File.getContent ASSET_SOURCES_FILE)]
|
||||||
(+
|
(unless !(= -1 (existingSources.indexOf newLine))
|
||||||
(File.getContent ASSET_SOURCES_FILE)
|
(File.saveContent
|
||||||
"${query}\t${resultNumber}\t${apiName}\t${author}\t${apiQuery}\n")))
|
ASSET_SOURCES_FILE
|
||||||
|
(+
|
||||||
|
existingSources
|
||||||
|
(if (StringTools.endsWith existingSources "\n") "" "\n")
|
||||||
|
newLine)))))
|
||||||
|
|
||||||
(defMacroFunction downloadToImages [query resultNumber apiName url]
|
(defMacroFunction downloadToImages [query resultNumber apiName url]
|
||||||
(let [ext
|
(let [ext
|
||||||
|
Reference in New Issue
Block a user