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

28
LINES

< > BotCompany Repo | #1001012 - getSnippetTitle

JavaX fragment (include)

1  
static String getSnippetTitle(String id) ctex {
2  
  if (id == null) null;
3  
  if (!isSnippetID(id)) ret "?";
4  
  
5  
  ifndef NoResourceLoader
6  
  IResourceLoader rl = vm_getResourceLoader();
7  
  if (rl != null)
8  
    ret rl.getSnippetTitle(id);
9  
  endifndef
10  
11  
  if (isLocalSnippetID(id)) ret localSnippetTitle(id);
12  
  long parsedID = parseSnippetID(id);
13  
  S url;
14  
  if (isImageServerSnippet(parsedID))
15  
    url = imageServerURL() + "title/" + parsedID + muricaCredentialsQuery();
16  
  else if (isGeneralFileServerSnippet(parsedID))
17  
    url = "http://butter.botcompany.de:8080/files/name/" + parsedID;
18  
  else
19  
    url = tb_mainServer() + "/tb-int/getfield.php?id=" + parsedID + "&field=title" + standardCredentials_noCookies();
20  
  S title = trim(loadPageSilently(url));
21  
  if (title != null)
22  
    pcall-short { saveTextFileIfChanged(snippetTitle_cacheFile(id), title); }
23  
  return or(title, "?");
24  
}
25  
26  
static String getSnippetTitle(long id) {
27  
  ret getSnippetTitle(fsI(id));
28  
}

download  show line numbers  debug dex   

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

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: 550 / 3237
Version history: 18 change(s)
Referenced in: [show references]

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