summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2012-07-13 19:11:46 +0100
committerNick White <git@njw.me.uk>2012-07-13 19:11:46 +0100
commit2778403ae4a7fca968fb8f09cabcab2bbc83b998 (patch)
treefb80c0d142a6fa9446a7065e86571cad5d9d5966
parent995154b47f4965e8036d90a4a918dd9ba4921503 (diff)
Fix detection of available pages in getbnbook, and remove newly unneeded flash detection
-rw-r--r--getbnbook.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/getbnbook.c b/getbnbook.c
index a9ae88d..a10d98e 100644
--- a/getbnbook.c
+++ b/getbnbook.c
@@ -33,7 +33,6 @@ int getpagelist()
char *s, *l;
int i, num;
char avail[STRMAX];
- char dummy1[STRMAX], dummy2[STRMAX];
numpages = 0;
@@ -57,7 +56,10 @@ int getpagelist()
for(i=0, s=buf;*s && i<MAXPAGES; s++) {
if((s = strstr(s, "<page ")) == NULL)
break;
- sscanf(s, "<page sequence=\"%d\" type=\"bitmap\" toc=\"%[^\"]\" folio=\"%[^\"]\" freevendstatus=\"%[^\"]\" />", &num, dummy1, dummy2, avail);
+ sscanf(s, "<page sequence=\"%d\"", &num);
+ if((s = strstr(s, "freevendstatus")) == NULL)
+ break;
+ sscanf(s, "freevendstatus=\"%[^\"]\"", avail);
if(strncmp(avail, "true", STRMAX) == 0)
pages[i++] = num;
@@ -69,21 +71,6 @@ int getpagelist()
return 0;
}
-int isflash(char *path)
-{
- FILE *f;
- int ret;
-
- if((f = fopen(path, "rb")) == NULL)
- return 1;
-
- ret = fgetc(f) == 'F' ? 1 : 0;
-
- fclose(f);
-
- return ret;
-}
-
int getpage(int pagenum)
{
char path[STRMAX], pageurl[STRMAX];
@@ -98,11 +85,6 @@ int getpage(int pagenum)
fprintf(stderr, "%d failed\n", pagenum);
return 1;
}
- if(isflash(path)) {
- fprintf(stderr, "%d not found\n", pagenum);
- remove(path);
- return 1;
- }
renameifjpg(path);
printf("%d downloaded\n", pagenum);