From f9ca781f1222c95272b7f380460cf093821b5bee Mon Sep 17 00:00:00 2001 From: kdx Date: Thu, 12 Jan 2023 19:06:56 +0100 Subject: ignore french movies --- .gitignore | 1 + cite.c | 8 +++++--- scrap.sh | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 85b937c..b15486f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ seances.xml cite cite.html +citenofr.html diff --git a/cite.c b/cite.c index 9817345..8feb067 100644 --- a/cite.c +++ b/cite.c @@ -33,8 +33,10 @@ static void print_times(Movie *movie) printf("\n"); } -static void print_movie(Movie *movie) +static void print_movie(Movie *movie, int hide_fr) { + if (hide_fr && strcmp(movie->nationality, "France") == 0) + return; if (movie->og_title[0] != '\0') printf("

%s

\n", movie->og_title); else @@ -155,7 +157,7 @@ static int append_movie_times(Movie *movie, const xmlNode *node) int main(int argc, char **argv) { - if (argc != 2) + if (argc != 3) return 1; xmlDoc *const document = xmlReadFile(argv[1], NULL, 0); if (document == NULL) { @@ -184,7 +186,7 @@ int main(int argc, char **argv) print_style(); printf("

cinéma de la cité

\n"); for (Movie *movie = movies; movie->id != 0; movie++) - print_movie(movie); + print_movie(movie, atoi(argv[2])); xmlFreeDoc(document); xmlCleanupParser(); return 0; diff --git a/scrap.sh b/scrap.sh index 47ad12f..bb4862a 100755 --- a/scrap.sh +++ b/scrap.sh @@ -1,5 +1,7 @@ #!/bin/sh ./build.sh || exit 1 curl -o seances.xml 'http://www.citebd.org/IMG/xml/allocineseances-4.xml' || exit 1 -./cite seances.xml >cite.html || exit 1 +./cite seances.xml 0 >cite.html || exit 1 scp cite.html root@kdx.re:/var/www/html +./cite seances.xml 1 >citenofr.html || exit 1 +scp citenofr.html root@kdx.re:/var/www/html -- cgit v1.2.3