summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2012-02-25 12:02:09 +0000
committerNick White <git@njw.me.uk>2012-02-25 12:02:09 +0000
commit6924eed5181a43989ca665f91908e50df4e1b4b0 (patch)
tree5c07f0d518c05e58f1595fb28107d29e0bf96262
parent4e6e2adeff8b4869de7c4c4fa0a5a3ab241d3a29 (diff)
Don't re-download jpg images
-rw-r--r--TODO2
-rw-r--r--getabook.c5
-rw-r--r--getbnbook.c5
-rw-r--r--getgbook.c5
4 files changed, 9 insertions, 8 deletions
diff --git a/TODO b/TODO
index cff5be1..e420875 100644
--- a/TODO
+++ b/TODO
@@ -2,8 +2,6 @@ before 1.0: fix http bug, package for osx
# other todos
-the tools look for ...png, meaning that they'll re-download jpgs. should look for png too.
-
bug in get() & post(): if the \r\n\r\n after http headers is cut off between recv buffers
in getgbook, check that downloaded page doesn't match 'page not available' image; if so delete (as may be redownloadable later, perhaps even then with different cookies)
diff --git a/getabook.c b/getabook.c
index 64cb50f..81c1dfc 100644
--- a/getabook.c
+++ b/getabook.c
@@ -145,7 +145,7 @@ int getpage(Page *page)
int main(int argc, char *argv[])
{
- char buf[BUFSIZ], pgpath[STRMAX];
+ char buf[BUFSIZ], pgpath[STRMAX], pgpath2[STRMAX];
char in[16];
int a, i, n;
FILE *f;
@@ -176,7 +176,8 @@ int main(int argc, char *argv[])
if(argc == 2) {
for(i=0; i<numpages; i++) {
snprintf(pgpath, STRMAX, "%s/%04d.png", bookdir, pages[i]->num);
- if((f = fopen(pgpath, "r")) != NULL) {
+ snprintf(pgpath2, STRMAX, "%s/%04d.jpg", bookdir, pages[i]->num);
+ if((f = fopen(pgpath, "r")) != NULL || (f = fopen(pgpath2, "r")) != NULL) {
fclose(f);
continue;
}
diff --git a/getbnbook.c b/getbnbook.c
index 8bec295..3b044d6 100644
--- a/getbnbook.c
+++ b/getbnbook.c
@@ -93,7 +93,7 @@ int getpage(int pagenum)
int main(int argc, char *argv[])
{
char *tmp;
- char buf[BUFSIZ], pgpath[STRMAX];
+ char buf[BUFSIZ], pgpath[STRMAX], pgpath2[STRMAX];
char in[16];
int a, i, n;
FILE *f;
@@ -127,7 +127,8 @@ int main(int argc, char *argv[])
if(argc == 2) {
for(i=0; i<numpages; i++) {
snprintf(pgpath, STRMAX, "%s/%04d.png", bookdir, pages[i]);
- if((f = fopen(pgpath, "r")) != NULL) {
+ snprintf(pgpath2, STRMAX, "%s/%04d.jpg", bookdir, pages[i]);
+ if((f = fopen(pgpath, "r")) != NULL || (f = fopen(pgpath2, "r")) != NULL) {
fclose(f);
continue;
}
diff --git a/getgbook.c b/getgbook.c
index f8b77dc..67bd1ca 100644
--- a/getgbook.c
+++ b/getgbook.c
@@ -168,7 +168,7 @@ int searchpage(Page *page)
int main(int argc, char *argv[])
{
char *tmp;
- char buf[BUFSIZ], pgpath[STRMAX];
+ char buf[BUFSIZ], pgpath[STRMAX], pgpath2[STRMAX];
char in[16];
int a, i, n;
FILE *f;
@@ -205,7 +205,8 @@ int main(int argc, char *argv[])
if(argc == 2) {
for(i=0; i<numpages; i++) {
snprintf(pgpath, STRMAX, "%s/%04d.png", bookdir, pages[i]->num);
- if((f = fopen(pgpath, "r")) != NULL) {
+ snprintf(pgpath2, STRMAX, "%s/%04d.jpg", bookdir, pages[i]->num);
+ if((f = fopen(pgpath, "r")) != NULL || (f = fopen(pgpath2, "r")) != NULL) {
fclose(f);
continue;
}