AutoStepper system

This commit is contained in:
2022-09-18 22:42:57 +00:00
parent 07aecdd9ed
commit 953255a165
11 changed files with 56 additions and 0 deletions

View File

@@ -205,6 +205,7 @@
(archive.addSystem (new ImageAttachmentSystem))
(archive.addSystem (new KeyShortcutSystem this))
(archive.addSystem (new DLSystem))
(archive.addSystem (new AutoStepperSystem))
(whenLet [ps (ui.playgroundSystem)]
(set playgroundSystem ps)
(archive.addSystem ps)

View File

@@ -0,0 +1,18 @@
package nat.systems;
import kiss.Prelude;
import kiss.List;
import nat.System;
import haxe.Json;
#if target.threaded
import sys.thread.Thread;
#end
using haxe.io.Path;
/**
* Base System that processes Entries based on whether they have file attachments
* which match a given set of extensions
*/
@:build(kiss.Kiss.build())
class AutoStepperSystem extends AttachmentSystem {}

View File

@@ -0,0 +1,28 @@
(load "../Lib.kiss")
(defNew []
[:String jarPath (joinPath (libPath "nat-archive-tool") "apps/autostepper/AutoStepper.jar")]
(super
["mp3"]
->[archive e mp3Files &opt ui]
(unless (tagsMatch e "stepperProcessed")
(doFor file mp3Files
(localFunction runAutoStepper []
(try
{
(ui.displayMessage "autoStepping $file")
```
java -jar "${jarPath}" input="$(archive.filePath file)" duration=130 hard=true
```
(ui.displayMessage "done autostepping $file")
// TODO attach the simfile and tag this as processed after ALL mp3 threads finish
**(addTags archive e ["stepperProcessed"])
}
(catch [e] (ui.displayMessage "failed autostepping $file"))))
(#if target.threaded
(Thread.create runAutoStepper)
{
(ui.displayMessage "threading unavailable -- the program will freeze while autostepping")
(runAutoStepper)
})))))