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

32
LINES

< > BotCompany Repo | #1001012 // getSnippetTitle

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4944L/33K).

sS getSnippetTitle(S id) {
  if (id == null) null;
  if (!isSnippetID(id)) ret "?";
  
  ifndef NoResourceLoader
  IResourceLoader rl = vm_getResourceLoader();
  if (rl != null)
    ret rl.getSnippetTitle(id);
  endifndef
  
  ret getSnippetTitle_noResourceLoader(id);
}
  
sS getSnippetTitle_noResourceLoader(S id) ctex {
  if (isLocalSnippetID(id)) ret localSnippetTitle(id);
  long parsedID = parseSnippetID(id);
  S url;
  if (isImageServerSnippet(parsedID))
    url = imageServerURL() + "title/" + parsedID + muricaCredentialsQuery();
  else if (isGeneralFileServerSnippet(parsedID))
    url = "http://butter.botcompany.de:8080/files/name/" + parsedID;
  else
    url = tb_mainServer() + "/tb-int/getfield.php?id=" + parsedID + "&field=title" + standardCredentials_noCookies();
  S title = trim(loadPageSilently(url));
  if (title != null)
    pcall-short { saveTextFileIfChanged(snippetTitle_cacheFile(id), title); }
  return or(title, "?");
}

static String getSnippetTitle(long id) {
  ret getSnippetTitle(fsI(id));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 25 computer(s): aoiabmzegqzx, ayivmpnvhhik, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, elmgxqgtpvxh, gjtlkbvenryc, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, lqnftawlhpir, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001012
Snippet name: getSnippetTitle
Eternal ID of this version: #1001012/20
Text MD5: 5c8e80a816deef8c3af6529d0aa08f14
Transpilation MD5: d49974b2b6fdb3a9ad772569308bfba2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-14 14:30:43
Source code size: 1058 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 791 / 5450
Version history: 19 change(s)
Referenced in: [show references]