summaryrefslogtreecommitdiff
path: root/scripts/toy.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/toy.groovy')
-rw-r--r--scripts/toy.groovy55
1 files changed, 27 insertions, 28 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 1f0547c..fdcc10f 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -48,30 +48,30 @@ final IMAGEDATA = {
return new File("$DATAFOLDER/images/toy")
.listFiles()
.findAll { d -> d.isDirectory(); }
- .collectEntries { d ->
- [
- d.getName(), [
- sets: d.listFiles()
- .findAll { s -> s.isDirectory(); }
- .collect { s -> [ sub: s, f: new File(s.getPath() + "/tags")] }
- .findAll { s -> s.f.canRead() }
- .collect { s ->
- [
- set: s.sub.getName(),
- images: s.f
- .readLines()
- .collect { l ->
- def fields = l.split(":");
- return [
- image: fields[0],
- tags: fields[1]
- .split(",")
- .findAll { t -> !t.isEmpty() }
- ];
- }
- ]
- }
- ]
+ .collectEntries { d -> [
+ d.getName(), [
+ domme: d.getName(),
+ sets: d.listFiles()
+ .findAll { s -> s.isDirectory(); }
+ .collect { s -> [ sub: s, f: new File(s.getPath() + "/tags")] }
+ .findAll { s -> s.f.canRead() }
+ .collectEntries { s -> [
+ s.sub.getName(), [
+ set: s.sub.getName(),
+ images: s.f
+ .readLines()
+ .collect { l ->
+ def fields = l.split(":");
+ return [
+ image: fields[0],
+ tags: fields[1]
+ .split(",")
+ .findAll { t -> !t.isEmpty() }
+ ];
+ }
+ ]
+ ]}
+ ]
]
};
}();
@@ -83,8 +83,7 @@ def selectImage = { domme, set, spec ->
};
def matches = IMAGEDATA[domme];
if (!matches) return null;
- matches = matches
- .sets.find({ s -> s.set == set });
+ matches = matches.sets[set];
if (!matches) return null;
matches = matches
.images.findAll({ i -> meets(i) });
@@ -109,7 +108,7 @@ def showLounge = {
def selectImageSet = { domme, specs ->
def matches = IMAGEDATA[domme];
if (!matches) return null;
- matches = matches.sets.findAll({ s -> specs.every({ spec -> selectImage(domme, s.set, spec)})});
+ matches = matches.sets.values().findAll({ s -> specs.every({ spec -> selectImage(domme, s.set, spec)})});
return matches[getRandom(matches.size())];
};
def dress = { specs ->
@@ -118,7 +117,7 @@ def dress = { specs ->
if (outfitTime > getTime() - 7200) { // Recent, check
def prev = IMAGEDATA[OWNER];
if (prev) {
- prev = prev.sets.find({ s -> s.set == outfit });
+ prev = prev.sets[outfit];
if (prev && specs.every({ spec -> selectImage(OWNER, prev.set, spec)})) {
return outfit;
}