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

28
LINES

< > BotCompany Repo | #1001012 - getSnippetTitle

JavaX fragment (include)

static String getSnippetTitle(String id) ctex {
  if (id == null) null;
  if (!isSnippetID(id)) ret "?";
  
  ifndef NoResourceLoader
  IResourceLoader rl = vm_getResourceLoader();
  if (rl != null)
    ret rl.getSnippetTitle(id);
  endifndef

  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   

Travelled to 14 computer(s): aoiabmzegqzx, ayivmpnvhhik, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, ppjhyzlbdabe, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1001012
Snippet name: getSnippetTitle
Eternal ID of this version: #1001012/19
Text MD5: b40f477e63577079df8a61dc6aa24b03
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-25 16:39:59
Source code size: 975 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 521 / 2724
Version history: 18 change(s)
Referenced in: [show references]

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