AutoStepper system
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 {}
|
||||
@@ -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)
|
||||
})))))
|
||||
Reference in New Issue
Block a user