Download Jar. Libraryless. Click here for Pure Java version (9284L/63K).
!7 concept FileMeta { int fileID; S md5; long checked; } svoid init { dbIndexing(FileMeta, 'fileID); } p { init(); typicalDownload(); } svoid fullDownload { download(diagramServer_IDsAndMD5s()); } svoid typicalDownload { SS map = diagramServer_typicalSet(); download(map); saveTextFile(getProgramFile("typical.structure"), struct(map)); } svoid downloadLatestFileNamed(S name) { L l = (L) safeUnstructure(loadPage("http://ai1.lol/1010474/raw/latest-file-named/" + urlencode(name))); if (l == null) ret with print("Can't file named " + name + " on diagram server"); S md5; download(litmap(str(first(l)), md5 = second(l))); // ID + MD5 saveTextFile(getProgramFile(urlencode(name) + ".file"), md5); } // map: ID -> MD5 svoid download(SS map) { loading "Downloading diagrams..." { pnl(map); for (S id : keys(map)) { S md5 = map.get(id); FileMeta m = uniq(FileMeta, fileID := parseInt(id)); cset(m, +md5, checked := now()); File f = getFile(m); if (!f.exists()) { S url = diagramServer_idToURL(id); saveBinaryFile(f, loadBinaryPage(url)); print("Saved " + f); } } print("Done."); }} static File getFile(FileMeta m) { ret getProgramFile(m.md5); }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010484 |
Snippet name: | Diagrams Downloader |
Eternal ID of this version: | #1010484/15 |
Text MD5: | 0b62130399dba5702bed94ff61e319de |
Transpilation MD5: | 1751701720a3dbb4bb43554ea409bdfe |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-16 22:48:47 |
Source code size: | 1288 bytes / 56 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 603 / 3260 |
Version history: | 14 change(s) |
Referenced in: | [show references] |