1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 200
void
pad(char *site, char *p)
{
char date[11], lyrline[MAX], name[32];
char lyrfn[64] = "lyrics/";
/* char url[64] = "https://files.catbox.moe/"; */
char url[64] = "https://mesacsclub.com/kaa/";
int year, month, day, i;
FILE *lyrics;
char *humonth[] = {
"mystery",
"january",
"february",
"march",
"april",
"may",
"june",
"july",
"august",
"september",
"october",
"november",
"december"
};
for ( i = 0; i < 10; ++i )
date[i] = p[i];
date[10] = '\0';
year = (date[0] - 0x30) * 1000;
year += (date[1] - 0x30) * 100;
year += (date[2] - 0x30) * 10;
year += date[3] - 0x30;
month = (date[5] - 0x30) * 10;
month += date[6] - 0x30;
day = (date[8] - 0x30) * 10;
day += date[9] - 0x30;
p = strstr(p, "--") + 2;
i = 1;
while (p[i] != '.') {
name[i-1] = p[i-1];
++i;
}
name[i-1] = '\0';
strcat(url, name);
strcat(url, ".mp3");
printf("\t\t\t%s\n", "<h2>");
printf( "\t\t\t\t%d ", year);
printf("%s %d\n", humonth[month], day);
printf("\t\t\t%s\n", "</h2>");
printf("\t\t\t%s\n", "<div>");
printf("\t\t\t\t%s%s", "<audio src=\"", url);
printf("%s\n", "\" controls=\"controls\">");
printf("\t\t\t\t\t%s %s\n", "playable from", url);
printf("\t\t\t\t%s\n", "</audio>");
printf("\t\t\t\t%s%s%s", "<a href=\"", site, "Image/");
printf("%s%s\n", name, ".png\" target=\"_blank\">");
printf("\t\t\t\t\t%s%s%s", "<img src=\"", site, "Image/");
printf("%s%s %s ", name, ".png\"", "loading=\"lazy\"");
printf("%s\n\t\t\t\t%s\n", "class=\"cover\">", "</a>");
printf("\t\t\t\t%s\n", "<p>");
strcat(lyrfn, name);
strcat(lyrfn, ".txt");
lyrics = fopen(lyrfn, "r");
if (lyrics == NULL)
puts("RAW!");
else
while (fgets(lyrline, MAX, lyrics) != NULL) {
printf("\t\t\t\t\t%s", lyrline);
printf("\t\t\t\t\t%s\n", "<br>");
}
fclose(lyrics);
printf("\t\t\t\t%s\n", "</p>");
printf("\t\t\t</div>\n");
}
int main()
{
FILE* in = fopen("files.json", "r");
FILE* header = fopen("header/composed.txt", "r");
FILE* footer = fopen("footer/composed.txt", "r");
char line[MAX], buffer[MAX];
char site[32] = "https://kaa.neocities.org/";
char pattern[32] = "Link/", end[32] = ".txt\",";
int patlen = strlen(pattern);
int endlen = strlen(end);
int ch, cnt, len;
char *p;
if ( (in == NULL) || (header == NULL) || (footer == NULL) ) {
puts("That's pungent!");
return 1;
}
while (fgets(line, MAX, header) != NULL)
printf("%s", line);
fclose(header);
fseek(in, 0, SEEK_END);
while ( 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);
}
line[cnt] = ch;
for (len = cnt; cnt >= 0; --cnt)
buffer[len - cnt] = line[cnt];
buffer[len] = '\0';
if ( ( p = strstr(buffer, pattern) ) != NULL) {
p += patlen;
p[ strlen(p) - endlen + 1 ] = '\0';
pad(site, p);
}
}
fclose(in);
while (fgets(line, MAX, footer) != NULL)
printf("%s", line);
fclose(footer);
return 0;
}
|