From: b Date: Tue, 9 May 2023 20:02:06 +0000 (+0000) Subject: Remove stuff unrelated to post engine. X-Git-Tag: v1.0.0~15 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=e58c3d9b41b49ab1dc73c3bd19b36f78f29c05f7;p=ott%2Fpost Remove stuff unrelated to post engine. --- diff --git a/notice2.awk b/notice2.awk deleted file mode 100755 index 7024872..0000000 --- a/notice2.awk +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/mawk -f - -#notice2.awk -#28.03.2015 -#find SilentBot's "Did you notice..." posts -#replaced by the aftertime system, notice4.awk - -BEGIN{ - mawk="/usr/bin/mawk" - wget="/usr/bin/wget" - tempfile="/eizm/tmp/t1i/notice" - postlist="\"http://forums.xkcd.com/search.php?st=0&sk=t&sd=d&sr=posts&author_id=560926\"" - useragent="\"t1i - did you notice...(http://1190.bicyclesonthemoon.info/bluet1i/viewer)\"" - noticeawk="/eizm/pro/t1i/notice3.awk" - - system(wget" -q -O "tempfile" -U "useragent" "postlist) - system(mawk" -f "noticeawk" "tempfile) -} \ No newline at end of file diff --git a/notice3.awk b/notice3.awk deleted file mode 100644 index f0daea6..0000000 --- a/notice3.awk +++ /dev/null @@ -1,17 +0,0 @@ -#notice3.awk -#28.03.2015 -#used by notice2,awk - -{ - if($0 ~ /

TimeAfterTime Revisited/) - { - post=substr($0, index($0,"#p")+2) - post=substr(post, 1, index(post, "\"")-1) - - frame=substr($0, index($0, "t1i-")+4, 4) - - file="/eizm/mem/t1i/notice/"frame - printf("%s",post) > file - close(file) - } -} diff --git a/notice4.awk b/notice4.awk deleted file mode 100755 index 01d420d..0000000 --- a/notice4.awk +++ /dev/null @@ -1,107 +0,0 @@ -#! /usr/bin/mawk -f - -#// notice4.awk -#// Add SilentBot's posts' ID to the viewer -#// 31.03.2015 -#// -#// Copyright (C) 2015 Balthasar Szczepański -#// -#// This program is free software: you can redistribute it and/or modify -#// it under the terms of the GNU Affero General Public License as -#// published by the Free Software Foundation, either version 3 of the -#// License, or (at your option) any later version. -#// -#// This program is distributed in the hope that it will be useful, -#// but WITHOUT ANY WARRANTY; without even the implied warranty of -#// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#// GNU Affero General Public License for more details. -#// -#// You should have received a copy of the GNU Affero General Public License -#// along with this program. If not, see . - -BEGIN{ - lasttime="/eizm/mem/t1i/notice/lasttime" - list="/eizm/mem/t1i/mpost/sent/" - list2="/eizm/mem/aftertime/mpost/" - - listcmd="/bin/ls -1 --color=never "list - - - getline lastpost < lasttime - close(lasttime) - - if(lastpost=="") - lastpost="0000000000" - - while ((listcmd | getline postid)>0) - { - if (postid !~ /^[0-9A-F]+_53696C656E7454696D6572/) - continue - - number=substr(postid,1,index(postid,"_")-1) - - if (number<=lasttime) - continue - - postfile=list postid - - split("", argtab, ":") - while((getline line < postfile)>0) - { - f=1 - gsub(/[\r\n]/,"",line) - eq=index(line,"=") - argtab[substr(line,1,eq-1)]=substr(line,eq+1) - } - close (postfile) - if(argtab["ID"]=="") - continue - - if(argtab["subject_h"]!~/t1i-[0-9][0-9][0-9][0-9]$/) - continue - - ottid=argtab["ID"] - - frame=substr(argtab["subject_h"], length(argtab["subject_h"])-3) - - y=substr(number,1,4) - m=substr(number,5,2) - d=substr(number,7,2) - h=substr(number,9,2) - - - for(i=1;i<100;++i) - { - postfile=list2 "t1i-"frame"-"sprintf("%02u",i) - - split("", argtab, ":") - while((getline line < postfile)>0) - { - f=1 - gsub(/[\r\n]/,"",line) - eq=index(line,"=") - argtab[substr(line,1,eq-1)]=substr(line,eq+1) - } - close (postfile) - - if(argtab["timenumber"]=="") - break; - - if(argtab["y"]!=y || argtab["m"]!=m || argtab["d"]!=d || argtab["h"]!=h) - continue - - if(argtab["ID"]!="") - break; - - print "ID="ottid >> postfile - close(postfile) - - #print argtab["timenumber"] - - print number > lasttime - close(lasttime) - - } - } - close(listcmd) -} \ No newline at end of file diff --git a/viewer.c b/viewer.c deleted file mode 100644 index 2bed7e5..0000000 --- a/viewer.c +++ /dev/null @@ -1,246 +0,0 @@ -// viewer.c (1190.bicyclesonthemoon.info/bluet1i/viewer) -// The viewer -// 08.04.2015 -// -// Copyright (C) 2015 Balthasar Szczepań -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#define MAX 1414 -#define NOTICE_PATH "/eizm/mem/aftertime/mpost/" -#define OLD_NOTICE_PATH "/eizm/mem/t1i/notice/" -#define AWK_NOTICE "/eizm/pro/t1i/notice.awk" -#define MAWK_PATH "/usr/bin/mawk" -#define REDIRECT "/aftertime/viewer?story=t1i" - -#include -#include -#include -#include -#include -#include - -s_cgi *cgi; - -int main (int argc, char *argv[]) -{ - s_cgi *cgi; - pid_t sub; - int r; - - char *value; - char *bb; - char *spoiler; - char *blue; - char *nn; - - unsigned char round; - unsigned short cgiFrame; - unsigned char bl; - char alttext[256]; - char notice[256]; - char arg1[256]; - char arg2[256]; - char redirect[256]; - - FILE *file; - unsigned char i; - - cgi=cgiInit(); - - value=cgiGetValue(cgi,"f"); - if(value!=NULL) - sscanf(value,"%hu",&cgiFrame); - else - cgiFrame=0; - - nn=cgiGetValue(cgi,"n"); - if(nn!=NULL) - sscanf(nn,"%hhu",&round); - else - round=0; - - blue=cgiGetValue(cgi,"blue"); - if(blue!=NULL) - sscanf(blue,"%hhu",&bl); - else - bl=1; - - bb=cgiGetValue(cgi,"b"); - spoiler=cgiGetValue(cgi,"s"); - -#if defined REDIRECT - strcpy(redirect,REDIRECT); - if(value!=NULL) - sprintf(redirect+strlen(redirect),"&f=%s",value); - if(nn!=NULL) - sprintf(redirect+strlen(redirect),"&n=%s",nn); - if(blue!=NULL) - sprintf(redirect+strlen(redirect),"&e=%s",blue); - if(bb!=NULL) - sprintf(redirect+strlen(redirect),"&b=%s",bb); - cgiRedirect(redirect); - return 0; -#endif - - if(cgiFrame<0) - cgiFrame=0; - else if(cgiFrame>MAX) - cgiFrame=MAX; - - if(cgiFrame>=1400) - strcpy(alttext,"The end."); - else if(cgiFrame>=1381) - strcpy(alttext,"..."); - else if(cgiFrame>=1196) - strcpy(alttext,"Wait for it."); - else if(cgiFrame>=1192) - strcpy(alttext,"..."); - else if(cgiFrame>=1185) - strcpy(alttext,"Wait for it."); - else if(cgiFrame>=1174) - strcpy(alttext,"..."); - else if(cgiFrame>=1172) - strcpy(alttext,"LOOK OUT!"); - else if(cgiFrame>=1158) - strcpy(alttext,"..."); - else if(cgiFrame>=1046) - strcpy(alttext,"LOOK OUT!"); - else if(cgiFrame>=1039) - strcpy(alttext,"..."); - else if(cgiFrame>=1007) - strcpy(alttext,"Wait for it."); - else if(cgiFrame>=1002) - strcpy(alttext,"..."); - else if(cgiFrame>=972) - strcpy(alttext,"LOOK OUT!"); - else if(cgiFrame>=961) - strcpy(alttext,"..."); - else if(cgiFrame>=715) - strcpy(alttext,"Wait for it."); - else if(cgiFrame>=687) - strcpy(alttext,"..."); - else if(cgiFrame>=653) - strcpy(alttext,"LOOK OUT!"); - else if(cgiFrame>=633) - strcpy(alttext,"..."); - else - strcpy(alttext,"Wait for it."); - - printf("Content-type: text/html\n\n"); - - puts("\n"); - puts("\n"); - printf("%04hu • bluet1i viewer • Bicycles on the Moon\n", cgiFrame); - puts("\n"); - puts("\n"); - puts("\n"); - puts("
\n"); - puts("\"1190.bicyclesonthemoon.info\"
\n"); - printf("

%st1i-%04hu

\n",bl?((bl>1)?((bl>2)?"no fading ":"very blue "):"blue "):"",cgiFrame); - puts("\n",bl); - if(cgiFrame>0) - printf("\n"); - if(cgiFrame%hu >\n",cgiFrame+1,bl,cgiFrame+1); - else - puts("\n"); - printf("\n",MAX,bl,MAX); - - puts("\n"); - - for(i=0;i<=round;++i) - { - sprintf(notice,"%st1i-%04hu-%02hhu",NOTICE_PATH,cgiFrame,i+1); - sprintf(arg1,"url=/bluet1i/viewer?f=%hu&blue=%hhu&n=%hhu",cgiFrame,bl,i+1); - sprintf(arg2,"round=%hhu",round); - - fflush(stdout); - sub=fork(); - if(sub==0) - { - // setvbuf(stdout, NULL, _IONBF, 0); - // dup2(fileno(stdout),fileno(stderr)); - r=execl(MAWK_PATH,MAWK_PATH,"-f",AWK_NOTICE,"-v",arg1,"-v",arg2,notice,(char *)0); - exit(r); - } - waitpid(sub,&r,0); - if(r) - { - if(!i) - { - sprintf(notice,"%s%04hu",OLD_NOTICE_PATH,cgiFrame); - file=fopen(notice,"rt"); - if(file!=NULL) - { - fgets(notice,255,file); - fclose(file); - printf("\n",notice,notice); - } - } - break; - } - - } - - if(bb!=NULL) - { - printf("\n"); - if(spoiler==NULL) - printf("\n",cgiFrame,bl); - } - else - printf("\n",cgiFrame,bl); - - printf("\n",cgiFrame); - - printf("\n",bl); - - puts("
\n"); - - printf("\"the
\n",bl?((bl>1)?((bl>2)?"nofading":"hyperblue"):"bluet1i"):"t1i",cgiFrame,alttext); - - printf("
| < 0< %hu\n",cgiFrame-1,bl,cgiFrame-1); - else - puts("%hu >|
[ "); - if(bl!=0) - printf("original",cgiFrame); - else - puts("original"); - puts(" | "); - if(bl!=1) - printf("blue",cgiFrame); - else - puts("blue"); - puts(" | "); - if(bl!=2) - printf("very blue",cgiFrame); - else - puts("very blue"); - puts(" | "); - if(bl!=3) - printf("no fading",cgiFrame); - else - puts("no fading"); - puts(" ]
Did you notice . . . .
[url=http://1190.bicyclesonthemoon.info/bluet1i/viewer?f=%hu&blue=%hhu][img]http://1190.bicyclesonthemoon.info/bluet1i/%s-%04hu.png[/img][/url]",cgiFrame,bl,bl?((bl>1)?((bl>2)?"nofading":"hyperblue"):"bluet1i"):"t1i",cgiFrame); - if(spoiler!=NULL) - printf("[spoiler]%s[/spoiler]",alttext); - printf("
[spoiler]
[bbcode]
[this frame in mscha's viewer]
go to frame:

\n"); - puts("1190.bicyclesonthemoon.info\n"); - puts("\n"); - puts("
\n"); - - return 0; -} \ No newline at end of file