Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

30
LINES

< > BotCompany Repo | #1007523 // Fix imageMD5 of all AI concepts [dev.]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (7496L/50K/165K).

!7

p {
  RemoteDB db = new RemoteDB(#1006463, true); // auto start AI Concepts
  L<RC> l = db.xlist("AIConcept");
  print("Found " + n(l, "concepts"));
  for (RC rc : l) {
    S id = rc.getString("globalID");
    S md5 = rc.getString("imageMD5");
    if (empty(md5)) {
      RC pngFile = cast rc.get("pngFile");
      //print("pngFile: " + pngFile);
      if (pngFile != null) {
        S pngPath = pngFile.getString("pngPath");
        print("  PNG path: " + pngPath);
        File png = prepareFile(new File(javaxDataDir(), pngPath));
        pcall {
          BufferedImage img = loadImage2(png);
          if (img != null) {
            md5 = md5OfBufferedImage(img);
            rc.set(imageMD5 := md5);
            print("  Updated MD5 to " + md5);
          }
        }
      }
    }
  }
  db.close();
  print("Done!");
}

Author comment

Began life as a copy of #1007478

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1007523
Snippet name: Fix imageMD5 of all AI concepts [dev.]
Eternal ID of this version: #1007523/9
Text MD5: 4d1d936ec637c9f403b27f4c790cd00f
Transpilation MD5: 9e00a56b9da1ba494a7484b427f42fe8
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-25 23:19:51
Source code size: 858 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 505 / 588
Version history: 8 change(s)
Referenced in: