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).

1  
!7
2  
3  
p {
4  
  RemoteDB db = new RemoteDB(#1006463, true); // auto start AI Concepts
5  
  L<RC> l = db.xlist("AIConcept");
6  
  print("Found " + n(l, "concepts"));
7  
  for (RC rc : l) {
8  
    S id = rc.getString("globalID");
9  
    S md5 = rc.getString("imageMD5");
10  
    if (empty(md5)) {
11  
      RC pngFile = cast rc.get("pngFile");
12  
      //print("pngFile: " + pngFile);
13  
      if (pngFile != null) {
14  
        S pngPath = pngFile.getString("pngPath");
15  
        print("  PNG path: " + pngPath);
16  
        File png = prepareFile(new File(javaxDataDir(), pngPath));
17  
        pcall {
18  
          BufferedImage img = loadImage2(png);
19  
          if (img != null) {
20  
            md5 = md5OfBufferedImage(img);
21  
            rc.set(imageMD5 := md5);
22  
            print("  Updated MD5 to " + md5);
23  
          }
24  
        }
25  
      }
26  
    }
27  
  }
28  
  db.close();
29  
  print("Done!");
30  
}

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: 506 / 589
Version history: 8 change(s)
Referenced in: [show references]