From 131bcff1ea9a9311e1a83efe5356dbc25473ab99 Mon Sep 17 00:00:00 2001 From: kaa Date: Sun, 20 Apr 2025 08:16:27 -0700 Subject: webm > mp3. --- composed.c | 7 +- files.json | 1088 ++++++++++++++++++++++++++++++++++--- header/composed.txt | 4 +- lyrics/allozipper.txt | 1 + lyrics/e.txt | 1 + lyrics/falling.txt | 4 + lyrics/gentle.txt | 3 + lyrics/hickory.txt | 1 + lyrics/lumber-over.txt | 62 +++ lyrics/lumber.txt | 3 + lyrics/rapid.txt | 2 + lyrics/roll-and-stop-and-roll.txt | 1 + lyrics/sink.txt | 3 + lyrics/softening.txt | 4 + lyrics/sonny-daisy.txt | 2 + lyrics/sustained-equilibrium.txt | 3 + photo | 322 +++++++++++ photographed/monthly.c | 231 -------- photographed/old/monthly | Bin 0 -> 780904 bytes photographed/old/monthly.c | 231 ++++++++ update.sh | 90 ++- 21 files changed, 1733 insertions(+), 330 deletions(-) create mode 100644 lyrics/allozipper.txt create mode 100644 lyrics/e.txt create mode 100644 lyrics/falling.txt create mode 100644 lyrics/gentle.txt create mode 100644 lyrics/hickory.txt create mode 100644 lyrics/lumber-over.txt create mode 100644 lyrics/rapid.txt create mode 100644 lyrics/roll-and-stop-and-roll.txt create mode 100644 lyrics/sink.txt create mode 100644 lyrics/softening.txt create mode 100644 lyrics/sonny-daisy.txt create mode 100644 lyrics/sustained-equilibrium.txt create mode 100644 photo delete mode 100755 photographed/monthly.c create mode 100755 photographed/old/monthly create mode 100755 photographed/old/monthly.c diff --git a/composed.c b/composed.c index ef1d5c7..31116ce 100755 --- a/composed.c +++ b/composed.c @@ -11,6 +11,7 @@ pad(char *site, char *p) char lyrfn[64] = "lyrics/"; /* char url[64] = "https://files.catbox.moe/"; */ char url[64] = "https://mesacsclub.com/kaa/"; + char webmurl[64] = ""; int year, month, day, i; FILE *lyrics; char *humonth[] = { @@ -54,7 +55,9 @@ pad(char *site, char *p) name[i-1] = '\0'; strcat(url, name); + strcat(webmurl, url); strcat(url, ".mp3"); + strcat(webmurl, ".webm"); printf("\t\t\t%s\n", "

"); printf( "\t\t\t\t%d ", year); @@ -62,8 +65,10 @@ pad(char *site, char *p) printf("\t\t\t%s\n", "

"); printf("\t\t\t%s\n", "
"); - printf("\t\t\t\t%s%s", ""); printf("\t\t\t\t%s%s%s", " -#include -#include - -#define MAX 200 -#define MIN 8 - -int -readbot(FILE *in, char *line) -{ - int ch, cnt; - - if ( fseek(in, -2, SEEK_CUR) != -1 ) { - ch = fgetc(in); - for ( cnt = 0; ch != '\n' && ftell(in) > 1; ++cnt ) { - fseek(in, -2, SEEK_CUR); - line[cnt] = ch; - ch = fgetc(in); - } - } - else - return -1; - - line[cnt] = ch; - - return cnt; -} - -void -revline(char *line, char *buffer, int cnt) -{ - int len; - - for (len = cnt; cnt >= 0; --cnt) - buffer[len - cnt] = line[cnt]; - - buffer[len] = '\0'; -} - -void -stripdate(char *out, char *in) -{ - int i; - - for ( i = 6; i < 16; ++i ) - out[i-6] = in[i]; - out[10] = '\0'; -} - -char * -findyear(char *date) -{ - static char year[16]; - int i; - - for ( i = 0; i < 4; ++i ) - year[i] = date[i]; - year[i] = '\0'; - - return year; -} - -char * -findmonth(char *date) -{ - static char month[8]; - int i; - - for ( i = 5; i < 7; ++i ) - month[i-5] = date[i]; - month[i-5] = '\0'; - - return month; -} - -char * -findday(char *date) -{ - static char day[8]; - int i; - - for ( i = 8; i < 10; ++i ) - day[i-8] = date[i]; - day[i-8] = '\0'; - - return day; -} - -void -outall(FILE *out, FILE *in) -{ - char line[MAX]; - - if ( out == 0 ) - return; - - while (fgets(line, MAX, in) != NULL) - fprintf(out, "%s", line); -} - -void -padh(char *year, char *month, char *day, FILE *out) -{ - char *humonth[] = { - "mystery", - "january", - "february", - "march", - "april", - "may", - "june", - "july", - "august", - "september", - "october", - "november", - "december" - }; - - - fprintf(out, "\t\t\t%s%s", "

", year); - fprintf(out, "%s%s ", "
", humonth[atoi(month)]); - fprintf(out, "%d%s\n", atoi(day), "

"); -} - -void -padimg(FILE *out, char *p) -{ - char site[32] = "https://kaa.neocities.org/"; - - fprintf(out, "\t\t\t%s%s%s", "
"); - fprintf(out, "\t\t\t\t%s%s%s", ""); - fprintf(out, "\t\t\t\n"); - fprintf(out, "\t\t\t
\n"); -} - -void -outnav(FILE *out, char *direction, char *linkfn) -{ - if ( out == 0 ) - return; - - if ( strcmp(linkfn, "") == 0 ) { - fprintf(out, "\t\t\t%s", "
"); - fprintf(out, "%s", "

"); - fprintf(out, "%s%s\n", direction, "

"); -} - -int -main() -{ - FILE* header = fopen("header/photographed.txt", "r"); - FILE* in = fopen("files.json", "r"); - FILE* footer = fopen("footer/photographed.txt", "r"); - FILE *out = 0; - char line[MAX], buffer[MAX]; - int cnt, nm; - char *p; - char pattern[32] = "Photo/20"; - char date[16] = "0000-00-00"; - char pyear[16] = "0000", pmonth[8] = "00", pday[8] = "00"; - char outfn[32] = "", poutfn[32]; - char *year, *month, *day; - - if ( header == NULL || in == NULL || footer == NULL ) { - puts("Ow!"); - return 1; - } - - fseek(in, 0, SEEK_END); - while ( (cnt = readbot(in, line)) != -1 ) { - if (cnt < MIN) - continue; - revline(line, buffer, cnt); - if ( ( p = strstr(buffer, pattern) ) == NULL ) - continue; - p[strlen(p) - 1] = '\0'; - - if (nm == 1) { - padh(pyear, pmonth, pday, out); - nm = 0; - } - - stripdate(date, p); - year = findyear(date); - month = findmonth(date); - day = findday(date); - if ( strcmp(pyear, year) != 0 || - strcmp(pmonth, month) != 0 ) { - outnav(out, "next", poutfn); - strcpy(poutfn, outfn); - strcpy(outfn, "photographed/"); - strcat(outfn, year); - strcat(outfn, "-"); - strcat(outfn, month); - strcat(outfn, ".html"); - outnav(out, "previous", outfn); - outall(out, footer); - fseek(footer, 0, SEEK_SET); - out = fopen(outfn, "w"); - outall(out, header); - fseek(header, 0, SEEK_SET); - } - - if ( strcmp(pday, day) != 0 ) - nm = 1; - - padimg(out, p); - - strcpy(pyear, year); - strcpy(pmonth, month); - strcpy(pday, day); - } - outnav(out, "next", poutfn); - outall(out, footer); - - fclose(header); - fclose(in); - fclose(footer); - - return 0; -} diff --git a/photographed/old/monthly b/photographed/old/monthly new file mode 100755 index 0000000..1ae6ee7 Binary files /dev/null and b/photographed/old/monthly differ diff --git a/photographed/old/monthly.c b/photographed/old/monthly.c new file mode 100755 index 0000000..b85ae92 --- /dev/null +++ b/photographed/old/monthly.c @@ -0,0 +1,231 @@ +#include +#include +#include + +#define MAX 200 +#define MIN 8 + +int +readbot(FILE *in, char *line) +{ + int ch, cnt; + + if ( fseek(in, -2, SEEK_CUR) != -1 ) { + ch = fgetc(in); + for ( cnt = 0; ch != '\n' && ftell(in) > 1; ++cnt ) { + fseek(in, -2, SEEK_CUR); + line[cnt] = ch; + ch = fgetc(in); + } + } + else + return -1; + + line[cnt] = ch; + + return cnt; +} + +void +revline(char *line, char *buffer, int cnt) +{ + int len; + + for (len = cnt; cnt >= 0; --cnt) + buffer[len - cnt] = line[cnt]; + + buffer[len] = '\0'; +} + +void +stripdate(char *out, char *in) +{ + int i; + + for ( i = 6; i < 16; ++i ) + out[i-6] = in[i]; + out[10] = '\0'; +} + +char * +findyear(char *date) +{ + static char year[16]; + int i; + + for ( i = 0; i < 4; ++i ) + year[i] = date[i]; + year[i] = '\0'; + + return year; +} + +char * +findmonth(char *date) +{ + static char month[8]; + int i; + + for ( i = 5; i < 7; ++i ) + month[i-5] = date[i]; + month[i-5] = '\0'; + + return month; +} + +char * +findday(char *date) +{ + static char day[8]; + int i; + + for ( i = 8; i < 10; ++i ) + day[i-8] = date[i]; + day[i-8] = '\0'; + + return day; +} + +void +outall(FILE *out, FILE *in) +{ + char line[MAX]; + + if ( out == 0 ) + return; + + while (fgets(line, MAX, in) != NULL) + fprintf(out, "%s", line); +} + +void +padh(char *year, char *month, char *day, FILE *out) +{ + char *humonth[] = { + "mystery", + "january", + "february", + "march", + "april", + "may", + "june", + "july", + "august", + "september", + "october", + "november", + "december" + }; + + + fprintf(out, "\t\t\t%s%s", "

", year); + fprintf(out, "%s%s ", "
", humonth[atoi(month)]); + fprintf(out, "%d%s\n", atoi(day), "

"); +} + +void +padimg(FILE *out, char *p) +{ + char site[32] = "https://kaa.neocities.org/"; + + fprintf(out, "\t\t\t%s%s%s", ""); + fprintf(out, "\t\t\t\t%s%s%s", ""); + fprintf(out, "\t\t\t\n"); + fprintf(out, "\t\t\t
\n"); +} + +void +outnav(FILE *out, char *direction, char *linkfn) +{ + if ( out == 0 ) + return; + + if ( strcmp(linkfn, "") == 0 ) { + fprintf(out, "\t\t\t%s", "
"); + fprintf(out, "%s", "

"); + fprintf(out, "%s%s\n", direction, "

"); +} + +int +main() +{ + FILE* header = fopen("header/photographed.txt", "r"); + FILE* in = fopen("files.json", "r"); + FILE* footer = fopen("footer/photographed.txt", "r"); + FILE *out = 0; + char line[MAX], buffer[MAX]; + int cnt, nm; + char *p; + char pattern[32] = "Photo/20"; + char date[16] = "0000-00-00"; + char pyear[16] = "0000", pmonth[8] = "00", pday[8] = "00"; + char outfn[32] = "", poutfn[32]; + char *year, *month, *day; + + if ( header == NULL || in == NULL || footer == NULL ) { + puts("Ow!"); + return 1; + } + + fseek(in, 0, SEEK_END); + while ( (cnt = readbot(in, line)) != -1 ) { + if (cnt < MIN) + continue; + revline(line, buffer, cnt); + if ( ( p = strstr(buffer, pattern) ) == NULL ) + continue; + p[strlen(p) - 1] = '\0'; + + if (nm == 1) { + padh(pyear, pmonth, pday, out); + nm = 0; + } + + stripdate(date, p); + year = findyear(date); + month = findmonth(date); + day = findday(date); + if ( strcmp(pyear, year) != 0 || + strcmp(pmonth, month) != 0 ) { + outnav(out, "next", poutfn); + strcpy(poutfn, outfn); + strcpy(outfn, "photographed/"); + strcat(outfn, year); + strcat(outfn, "-"); + strcat(outfn, month); + strcat(outfn, ".html"); + outnav(out, "previous", outfn); + outall(out, footer); + fseek(footer, 0, SEEK_SET); + out = fopen(outfn, "w"); + outall(out, header); + fseek(header, 0, SEEK_SET); + } + + if ( strcmp(pday, day) != 0 ) + nm = 1; + + padimg(out, p); + + strcpy(pyear, year); + strcpy(pmonth, month); + strcpy(pday, day); + } + outnav(out, "next", poutfn); + outall(out, footer); + + fclose(header); + fclose(in); + fclose(footer); + + return 0; +} diff --git a/update.sh b/update.sh index 1be9d45..490e52d 100755 --- a/update.sh +++ b/update.sh @@ -6,17 +6,95 @@ then fi api="neocities.org/api" -files=0 -drawn=0 -composed=0 -photographed=0 +#files=0 +#drawn=0 +#composed=0 +#photographed=0 +#up=0 up=0 + +up() { + up=1 + curl "https://$combo@$api/list" > files.json + ssh kaa@mesacsclub.com "ls /var/www/htdocs/kaa/Photo" | sort -r > photo +} +files() { + ./files > files.html + if [ $up -eq 1 ] + then + curl -F "files.html=@files.html" "https://$combo@$api/upload" + fi +} +drawn() { + for i in drawn/*.html + do + cp $i $i.bup + done + + ./drawn/monthly + + for i in drawn/20*.html + do + i=$i + done + cp $i drawn/index.html + + if [ $up -eq 1 ] + then + for i in drawn/*.html + do + diff $i $i.bup >/dev/null 2>&1 + if [ $? != 0 ] + then + curl -F "$i=@$i" "https://$combo@$api/upload" + fi + done + fi +} +composed() { + ./composed > composed.html + if [ $up -eq 1 ] + then + curl -F "composed.html=@composed.html" "https://$combo@$api/upload" + fi +} +photographed() { + for i in photographed/*.html + do + cp $i $i.bup + done + + ./photographed/monthly.sh + + for i in photographed/20*.html + do + i=$i + done + cp $i photographed/index.html + + if [ $up -eq 1 ] + then + for i in photographed/*.html + do + diff $i $i.bup > /dev/null 2>&1 + if [ $? != 0 ] + then + curl -F "$i=@$i" "https://$combo@$api/upload" + fi + done + fi +} + for i in $@ do - eval "$i=1" + #eval "$i=1" + $i done +# This can be done better. +return + if [ $up -eq 1 ] then curl "https://$combo@$api/list" > files.json @@ -39,7 +117,7 @@ then cp $i $i.bup done - ./drawn/monthly.sh + ./drawn/monthly for i in drawn/20*.html do -- cgit v1.2.3