HTML generation order fix

This commit is contained in:
farfalleflickan 2024-12-27 01:34:16 +01:00
parent f4e1cb4dcb
commit b8902589b2
3 changed files with 4 additions and 7 deletions

View File

@ -362,11 +362,10 @@ void createMoviesHTML(progConfig *conf, fileList *list) {
pthread_create(&threads[i], NULL, movieHTML, (void *) &threadObj[i]); pthread_create(&threads[i], NULL, movieHTML, (void *) &threadObj[i]);
} }
i=0;
fileList *htmlList=newList(); fileList *htmlList=newList();
addData(htmlList, MOVIE_HTML_TOP); addData(htmlList, MOVIE_HTML_TOP);
for (fileList *temp=list; temp!=NULL; temp=temp->next, i++) { for (i--; i>=0; i--) {
pthread_join(threads[i], NULL); pthread_join(threads[i], NULL);
for (size_t j=0; j<threadObj[i].list->dataSize; j++) { for (size_t j=0; j<threadObj[i].list->dataSize; j++) {
addData(htmlList, threadObj[i].list->data[j]); addData(htmlList, threadObj[i].list->data[j]);

View File

@ -599,7 +599,7 @@ void createShowsHTML(progConfig *conf, fileList *list) {
mallocMacro(threads, sizeof(pthread_t)*list->listSize, "createShowsHTML error"); mallocMacro(threads, sizeof(pthread_t)*list->listSize, "createShowsHTML error");
threadStruct *threadObj=NULL; threadStruct *threadObj=NULL;
mallocMacro(threadObj, sizeof(threadStruct)*list->listSize, "createShowsHTML error"); mallocMacro(threadObj, sizeof(threadStruct)*list->listSize, "createShowsHTML error");
size_t i=0; int i=0;
for (fileList *temp=list; temp!=NULL; temp=temp->next) { for (fileList *temp=list; temp!=NULL; temp=temp->next) {
threadObj[i].conf=conf; threadObj[i].conf=conf;
threadObj[i].data=temp->data; threadObj[i].data=temp->data;
@ -611,12 +611,11 @@ void createShowsHTML(progConfig *conf, fileList *list) {
i++; i++;
} }
i=0;
fileList *htmlList=newList(); fileList *htmlList=newList();
addData(htmlList, TV_HTML_TOP); addData(htmlList, TV_HTML_TOP);
char *htmlStr=NULL; char *htmlStr=NULL;
for (fileList *temp=list; temp!=NULL; temp=temp->next) { for (i--; i>=0; i--) {
pthread_join(threads[i], NULL); pthread_join(threads[i], NULL);
char *showFile=NULL; char *showFile=NULL;
char *showPoster=NULL; char *showPoster=NULL;
@ -650,7 +649,6 @@ void createShowsHTML(progConfig *conf, fileList *list) {
freeList(threadObj[i].list); freeList(threadObj[i].list);
tryFree(showFile); tryFree(showFile);
tryFree(showPoster); tryFree(showPoster);
i++;
} }
addData(htmlList, TV_HTML_BOT); addData(htmlList, TV_HTML_BOT);
fileListToFile(htmlList, conf->TVhtml, "", ""); fileListToFile(htmlList, conf->TVhtml, "", "");

View File

@ -4,7 +4,7 @@
#define TV_HTML_TOP "<!DOCTYPE html>\n<html>\n<head>\n<title>cmyflix</title>\n<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\">\n<meta name=\"description\" content=\"Daria Rostirolla\">\n<meta name=\"keywords\" content=\"HTML, CSS\">\n<meta name=\"author\" content=\"Daria Rostirolla\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link href=\"css/tv.css\" rel=\"stylesheet\" type=\"text/css\">\n<link rel=\"icon\" type=\"image/png\" href=\"img/favicon.png\">\n</head>\n<body>\n<script type=\"text/javascript\" src=\"js/mainTVScript.js\"></script>\n<div id=\"wrapper\">\n" #define TV_HTML_TOP "<!DOCTYPE html>\n<html>\n<head>\n<title>cmyflix</title>\n<meta http-equiv=\"Content-type\" content=\"text/html;charset=UTF-8\">\n<meta name=\"description\" content=\"Daria Rostirolla\">\n<meta name=\"keywords\" content=\"HTML, CSS\">\n<meta name=\"author\" content=\"Daria Rostirolla\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link href=\"css/tv.css\" rel=\"stylesheet\" type=\"text/css\">\n<link rel=\"icon\" type=\"image/png\" href=\"img/favicon.png\">\n</head>\n<body>\n<script type=\"text/javascript\" src=\"js/mainTVScript.js\"></script>\n<div id=\"wrapper\">\n"
#define TV_HTML_FRAME "<div class=\"showDiv\">\n<input id=\"A%zu\" class=\"myBtn\" alt=\"%s\" onclick=\"javascript:setFrame(this, \'%s\' )\" type=\"image\" src=\"%s\" onload=\"javascript:setAlt(this, \'%s\')\">\n<div id=\"B%zu\" class=\"modal\">\n<div id=\"frameDiv%zu\" class=\"modal-content\">\n<iframe id=\"IN%zu\" src=\"\" frameborder=\"0\" onload=\"javascript:resizeFrame(this)\" allowfullscreen></iframe>\n</div>\n</div>\n</div>\n" #define TV_HTML_FRAME "<div class=\"showDiv\">\n<input id=\"A%d\" class=\"myBtn\" alt=\"%s\" onclick=\"javascript:setFrame(this, \'%s\' )\" type=\"image\" src=\"%s\" onload=\"javascript:setAlt(this, \'%s\')\">\n<div id=\"B%d\" class=\"modal\">\n<div id=\"frameDiv%d\" class=\"modal-content\">\n<iframe id=\"IN%d\" src=\"\" frameborder=\"0\" onload=\"javascript:resizeFrame(this)\" allowfullscreen></iframe>\n</div>\n</div>\n</div>\n"
#define TV_HTML_BOT "\n<div id=\"paddingDiv\">\n</div>\n</div>\n</body>\n</html>" #define TV_HTML_BOT "\n<div id=\"paddingDiv\">\n</div>\n</div>\n</body>\n</html>"