Uses 616K of libraries. Click here for Pure Java version (4421L/31K).
sS quickVisualize_nsfw_progID = #1007145; static Lock quickVisualize_nsfw_lock = lock(); static bool quickVisualize_nsfw_hasCached(S query) { ret quickVisualize_nsfw_imageFile(query).length() != 0; } static BufferedImage quickVisualize_nsfw_fromCache(S query) { File f = quickVisualize_nsfw_imageFile(query); if (f.length() != 0) pcall { ret loadPNG(f); } null; } static S quickVisualize_nsfw_preprocess(S query) { ret toUpper(shorten(trim(query), 200)); } static BufferedImage quickVisualize_nsfw(S query) { query = quickVisualize_nsfw_preprocess(query); if (empty(query)) null; BufferedImage img = quickVisualize_nsfw_fromCache(query); if (img != null) ret img; File f = quickVisualize_nsfw_imageFile(query); /*L<S> urls = googleImageSearch_multi(query); saveTextFile(quickVisualize_nsfw_urlsFile(query), joinLines(urls)); if (empty(urls)) null; img = loadBufferedImage(first(urls));*/ lock quickVisualize_nsfw_lock; temp tempSetTL(googleImageSearch_new_nsfw, true); img = googleImageSearch_new(query); if (img == null) null; savePNG(f, img); ret img; } static S quickVisualize_nsfw_imagePath(S query) { query = quickVisualize_nsfw_preprocess(query); ret fsI(quickVisualize_nsfw_progID) + "/nsfw/" + urlencode(query) + ".png"; } static File quickVisualize_nsfw_imageFile(S query) { query = quickVisualize_nsfw_preprocess(query); ret prepareProgramFile(quickVisualize_nsfw_progID, "nsfw/" + urlencode(query) + ".png"); } static File quickVisualize_nsfw_urlsFile(S query) { query = quickVisualize_nsfw_preprocess(query); ret prepareProgramFile(quickVisualize_nsfw_progID, "urls-" + urlencode(query) + ".txt"); }
Began life as a copy of #1007145
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025357 |
Snippet name: | quickVisualize_nsfw |
Eternal ID of this version: | #1025357/3 |
Text MD5: | 21179850e4b53a3236770e824cfb172d |
Transpilation MD5: | 1934c26acc0d0b5a8929a1688c9c0176 |
Author: | stefan |
Category: | javax / imaging / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-26 00:09:37 |
Source code size: | 1718 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 223 / 312 |
Version history: | 2 change(s) |
Referenced in: | [show references] |