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

34
LINES

< > BotCompany Repo | #1028784 - Zip + LineComp all JavaX Text snippets (from local snippets DB) [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 11335K of libraries. Click here for Pure Java version (14297L/103K).

!7

sclass ZipTextSnippets > DynSingleFunctionWithPrintLog {
  switchable bool withPrivate;
  
  void doIt ctex {
    bool withPrivate = ZipTextSnippets.this.withPrivate;
    L snippets = cast call(dm_getModule(dm_snippetsDB()), 'allSnippets);
    print("Got " + n2(snippets, "snippet"));
    
    File zipFile = javaxBackupDir("botcompany-texts-" + ymdWithMinuses() + (withPrivate ? "-with-private" : "") + ".zip");
    print("Zipping to " + zipFile + "...");
    new TreeMap<Long, S> titles;
    {
      temp ZipOutputStream zipOut = zipOutputStream(zipFile);
      new Var<Long> size;
      for (O sn : snippets) {
        if (!withPrivate && !isTrue(get isPublic(sn))) continue;
        if (eq(rcall textLength(sn), 0)) continue;
        long id = getLong(sn, 'snippetID);
        S title = getString title(sn);
        titles.put(id, title);
        addFileToZip(zipOut, (File) call(sn, 'file), id + ".text");
        if (setVar_trueIfChanged(size, fileSizeInMegabytes_floor(zipFile)))
          print(size + " MB");
      }
      zip_addTextFile(zipOut, "titles.text", mapToLines(titles,
        (id, title) -> id + ": " + firstLine(title));
    }
    printFileInfo(zipFile);
    zipToLineComp(zipFile);
    //uploadFileToFileServer(zipFile, zipFile.getName());
  }
}

Author comment

Began life as a copy of #1018036

download  show line numbers  debug dex   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028784
Snippet name: Zip + LineComp all JavaX Text snippets (from local snippets DB) [Dyn Module]
Eternal ID of this version: #1028784/11
Text MD5: a851b6a7d613725e8bcaeca976913b43
Transpilation MD5: 3b3237feb5c81ef006e8634b2627d553
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-16 15:28:30
Source code size: 1306 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 80 / 767
Version history: 10 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1028784 & http://1028784.tinybrain.de