diff options
Diffstat (limited to 'src/download.c')
-rw-r--r-- | src/download.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/download.c b/src/download.c index cddf0de..a1853f5 100644 --- a/src/download.c +++ b/src/download.c @@ -184,48 +184,3 @@ void downloadissue(CURL *curl_handle, char * directory, iss * issue, int force) save_file(curl_handle, cur_section->uri, filename); } } - -void downloadmedia(CURL * curl_handle, char * directory, med * media, int force) -/* Download media pointed to. */ -{ - char newdir[STR_MAX], filename[STR_MAX], fn[STR_MAX]; - FILE * testfile; - - /* for the moment just save to down/media, in future save to issue directories - * (regardless of if they're occupied) */ - snprintf(newdir,STR_MAX,"%s/%s",directory,"media"); - - if(!opendir(newdir)) - if(mkdir(newdir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) - { - printf("Please enter the path of a directory to save media in: "); - scanf("%s", newdir); /* TODO: incorporate GETTEXT */ - } - - /* get the position of the final forwardslash of the uri */ - int slashpos; - for(slashpos=strlen(media->uri); - slashpos>=0 && media->uri[slashpos] != '/'; - slashpos--); - - /* copy from there to fn */ - int tmp; - for(tmp=0, slashpos++; media->uri[slashpos]; tmp++, slashpos++) - fn[tmp] = media->uri[slashpos]; - fn[tmp] = '\0'; - - snprintf(filename,STR_MAX,"%s/%s", newdir, fn); - - if(!force){ - testfile = fopen(filename, "r"); - if(!testfile) - save_file(curl_handle, media->uri, filename); - else - { - fclose(testfile); - printf("Skipping download of media item %s\n", media->title); - } - } - else - save_file(curl_handle, media->uri, filename); -} |