debuggable names for NAT systems

This commit is contained in:
2023-04-12 07:24:10 -06:00
parent f422dac88f
commit 65927f862c
14 changed files with 24 additions and 6 deletions

View File

@@ -320,7 +320,7 @@
(localFunction addColorTagSystems [:Map<String,nat.components.ColorI> info] (localFunction addColorTagSystems [:Map<String,nat.components.ColorI> info]
(let [colors (collect (info.iterator))] (let [colors (collect (info.iterator))]
(doFor =>tagExp color info (doFor =>tagExp color info
(archive.addSystem (new TagSystem tagExp ->[archive e &opt ui] (archive.addSystem (new TagSystem "ColorTagSystem{${tagExp}}" tagExp ->[archive e &opt ui]
(when (or !(hasComponent e ColorI) (colorsContain colors (readComponent e ColorI))) (when (or !(hasComponent e ColorI) (colorsContain colors (readComponent e ColorI)))
(AddColorIRGBA [e] color.r color.g color.b color.a))))))) (AddColorIRGBA [e] color.r color.g color.b color.a)))))))
(addColorTagSystems [ (addColorTagSystems [

View File

@@ -2,9 +2,11 @@
(method :Void process [:Archive archive &opt :ArchiveUI ui] (method :Void process [:Archive archive &opt :ArchiveUI ui]
(doFor e (entries.iterator) (doFor e (entries.iterator)
(print "${name} processing ${e.id}")
(processEntry archive e ui))) (processEntry archive e ui)))
(defNew [&prop :EntryChecker canProcessEntry (defNew [&prop :String name
&prop :EntryChecker canProcessEntry
&prop :EntryProcessor processEntry] &prop :EntryProcessor processEntry]
[]) [])

View File

@@ -1,10 +1,12 @@
(load "../Lib.kiss") (load "../Lib.kiss")
(defNew [:Array<String> _extensions (defNew [:String name
:Array<String> _extensions
:AttachmentProcessor processor] :AttachmentProcessor processor]
[:Array<String> extensions (for extension _extensions (extension.toLowerCase))] [:Array<String> extensions (for extension _extensions (extension.toLowerCase))]
(super (super
name
->[archive e] ->[archive e]
{ {
(doFor file e.files (doFor file e.files

View File

@@ -3,6 +3,7 @@
(defNew [] (defNew []
[:String jarPath (joinPath (libPath "nat-archive-tool") "apps/autostepper/AutoStepper.jar")] [:String jarPath (joinPath (libPath "nat-archive-tool") "apps/autostepper/AutoStepper.jar")]
(super (super
"AutoStepperSystem"
["mp3"] ["mp3"]
->[archive e mp3Files &opt ui] ->[archive e mp3Files &opt ui]
(unless (tagsMatch e "stepperProcessed") (unless (tagsMatch e "stepperProcessed")

View File

@@ -6,6 +6,7 @@
(tryProcess "youtube-dl" [] ->error (when (contains error "You must provide at least one URL") (set hasYTDL true))) (tryProcess "youtube-dl" [] ->error (when (contains error "You must provide at least one URL") (set hasYTDL true)))
(super (super
"DLSystem"
->[archive e] ->[archive e]
(and hasYTDL (catsMatch e "(unless dlProcessed DLURL)")) (and hasYTDL (catsMatch e "(unless dlProcessed DLURL)"))
->[archive e &opt ui] ->[archive e &opt ui]

View File

@@ -2,6 +2,7 @@
(defNew [] (defNew []
(super (super
"ImageAttachmentSystem"
["jpg" "jpeg" "png" "svg"] ["jpg" "jpeg" "png" "svg"]
->[archive e imageFiles &opt ui] ->[archive e imageFiles &opt ui]
(unless (upgradeToVersion2 archive e) (unless (upgradeToVersion2 archive e)

View File

@@ -5,6 +5,7 @@
(defNew [&prop :ArchiveController controller] (defNew [&prop :ArchiveController controller]
[&mut :Bool setup false] [&mut :Bool setup false]
(super (super
"KeyShortcutSystem"
->[archive e] ->[archive e]
(hasComponent e KeyShortcut) (hasComponent e KeyShortcut)
->[archive e &opt ui] ->[archive e &opt ui]

View File

@@ -1,11 +1,13 @@
(load "../Lib.kiss") (load "../Lib.kiss")
(defNew [&prop :String mediaWikiUrl (defNew [:String name
&prop :String mediaWikiUrl
// TODO make a &super annotation that passes an argument to the super constructor // TODO make a &super annotation that passes an argument to the super constructor
:EntryChecker canProcess :EntryChecker canProcess
:EntryProcessor processor :EntryProcessor processor
&prop :Null<Float> maxLag] &prop :Null<Float> maxLag]
(super (super
name
canProcess canProcess
processor)) processor))

View File

@@ -5,6 +5,7 @@
// Stores a case-insensitive map of named entries, for instant lookup by name // Stores a case-insensitive map of named entries, for instant lookup by name
(defNew [] (defNew []
(super (super
"NameSystem"
->[archive e] (hasComponent e Name) ->[archive e] (hasComponent e Name)
->[archive e &opt ui] (let [name (readComponent e Name)] ->[archive e &opt ui] (let [name (readComponent e Name)]
(if (entriesByName.exists (name.toLowerCase)) (if (entriesByName.exists (name.toLowerCase))

View File

@@ -11,7 +11,8 @@
(prop :Map<String,ColorF> playgroundBGColors (new Map)) (prop :Map<String,ColorF> playgroundBGColors (new Map))
(prop :Map<String,EntryRep> entryReps (new Map)) (prop :Map<String,EntryRep> entryReps (new Map))
(defNew [&prop :ArchiveUI ui (defNew [:String name
&prop :ArchiveUI ui
:EntryChecker canProcess :EntryChecker canProcess
&prop :PlaygroundEntryProcessor createEntryRep &prop :PlaygroundEntryProcessor createEntryRep
&prop :PlaygroundConnectionProcessor connectionProcessor &prop :PlaygroundConnectionProcessor connectionProcessor
@@ -24,6 +25,7 @@
(dictSet entryReps e.id eRep)))] (dictSet entryReps e.id eRep)))]
(super (super
name
->[archive e] ->[archive e]
(or (tagsMatch e "playground") (or (tagsMatch e "playground")
(and (tagsMatch e "!(or done hidden)") (canProcess archive e))) (and (tagsMatch e "!(or done hidden)") (canProcess archive e)))

View File

@@ -2,6 +2,7 @@
(defNew [] (defNew []
(super (super
"RemarkableAPISystem"
->[archive e] false ->[archive e] false
->[archive e &opt ui] null) ->[archive e &opt ui] null)

View File

@@ -1,9 +1,11 @@
(load "../Lib.kiss") (load "../Lib.kiss")
(defNew [&prop :String tagFilterString // This doesn't need to be a &prop because it will be captured by the lambda, but maybe it will be useful to query from the system later (defNew [:String name
&prop :String tagFilterString // This doesn't need to be a &prop because it will be captured by the lambda, but maybe it will be useful to query from the system later
// TODO make a &super annotation that passes an argument to the super constructor // TODO make a &super annotation that passes an argument to the super constructor
:EntryProcessor processor] :EntryProcessor processor]
[] []
(super (super
name
(lambda [:Archive archive :Entry e] (tagsMatch e tagFilterString)) (lambda [:Archive archive :Entry e] (tagsMatch e tagFilterString))
processor)) processor))

View File

@@ -2,6 +2,7 @@
(defNew [] (defNew []
(super (super
"WikipediaImageSystem"
"https://en.wikipedia.org/w/api.php" "https://en.wikipedia.org/w/api.php"
->[archive e] (tagsMatch e "(and media !wikipediaProcessed)") ->[archive e] (tagsMatch e "(and media !wikipediaProcessed)")
scrapeForImages scrapeForImages

View File

@@ -3,6 +3,7 @@
(defNew [&prop :PlayState playState (defNew [&prop :PlayState playState
:ArchiveController controller] :ArchiveController controller]
(super (super
"EntrySpriteSystem"
playState playState
->[archive e] ->[archive e]
?(or (hasComponent e Name) (hasComponent e Circle) (hasComponent e Rectangle)) ?(or (hasComponent e Name) (hasComponent e Circle) (hasComponent e Rectangle))