From 363c3d51d2d54bbeadb2c247b54039ce574146c2 Mon Sep 17 00:00:00 2001 From: kdx Date: Fri, 13 Jan 2023 04:29:37 +0100 Subject: boring style & skip download flag --- cite.c | 24 ++++++++++++++++++------ scrap.sh | 6 ++++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/cite.c b/cite.c index 6c9852b..d131f4f 100644 --- a/cite.c +++ b/cite.c @@ -22,13 +22,21 @@ typedef struct { Movie movies[64] = {0}; CURL *curl = NULL; -static void print_style(void) +static void print_style(int boring_css) { puts(""); puts(""); puts(""); puts(""); - puts(""); + if (boring_css) + puts(""); + else + puts(""); + /* doq's style */ puts(""); } @@ -65,12 +73,16 @@ static void print_movie(Movie *movie, int hide_fr) printf("\n"); } -static void download_poster(Movie *movie) +static void download_poster(Movie *movie, int skip) { char out_path[512]; char *last_slash = movie->poster; while (strchr(last_slash, '/') != NULL) last_slash = strchr(last_slash, '/') + 1; + if (skip) { + strcpy(movie->poster, last_slash); + return; + } strcpy(out_path, "cite/"); strcat(out_path, last_slash); FILE *const fp = fopen(out_path, "wb"); @@ -199,7 +211,7 @@ static int append_movie_times(Movie *movie, const xmlNode *node) int main(int argc, char **argv) { - if (argc != 3) + if (argc != 5) return 1; xmlDoc *const document = xmlReadFile(argv[1], NULL, 0); if (document == NULL) { @@ -231,11 +243,11 @@ int main(int argc, char **argv) append_movie_times(movie, mov); } } - print_style(); + print_style(atoi(argv[3])); puts(""); puts("

cinéma de la cité

"); for (Movie *movie = movies; movie->id != 0; movie++) { - download_poster(movie); + download_poster(movie, atoi(argv[4])); print_movie(movie, atoi(argv[2])); } puts(""); diff --git a/scrap.sh b/scrap.sh index 9228443..a3aeffe 100755 --- a/scrap.sh +++ b/scrap.sh @@ -2,6 +2,8 @@ ./build.sh || exit 1 curl -o seances.xml 'http://www.citebd.org/IMG/xml/allocineseances-4.xml' || exit 1 mkdir -p cite -./scrap seances.xml 0 >cite/index.html || exit 1 -./scrap seances.xml 1 >cite/nofr.html || exit 1 +./scrap seances.xml 0 0 0 >cite/index.html || exit 1 +./scrap seances.xml 1 0 1 >cite/nofr.html || exit 1 +./scrap seances.xml 0 1 1 >cite/boring.html || exit 1 +./scrap seances.xml 1 1 1 >cite/boringnofr.html || exit 1 rsync -rvu --delete cite root@kdx.re:/var/www/html -- cgit v1.2.3