getht-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getht-commit] arch commit: getht--mainline--0.1--patch-34


From: Nick
Subject: [Getht-commit] arch commit: getht--mainline--0.1--patch-34
Date: Thu, 3 Apr 2008 01:42:36 +0100
User-agent: Mutt/1.5.16 (2007-06-09)

Revision: getht--mainline--0.1--patch-34
Archive: address@hidden
Creator: Nick White <address@hidden>
Date: Thu Apr  3 01:42:00 BST 2008
Standard-date: 2008-04-03 00:42:00 GMT
Removed-files: src/.arch-ids/mediarev.c.id
    src/.arch-ids/mediaxml.c.id src/mediarev.c
    src/mediaxml.c
Modified-files: BUGS doc/getht.man src/Makefile.am src/cli.c
    src/config.c src/download.c src/getht.c src/getht.h
    src/issue.h src/issuemem.c src/tocxml.c
New-patches: address@hidden/getht--mainline--0.1--patch-34
Summary: Removed all media handling code
Keywords: 


This patch has no new features. It just removes all of the
media handling code. It was proving too hard to maintain, and
lots of it is now available at the website anyway.
D  src/.arch-ids/mediarev.c.id
D  src/.arch-ids/mediaxml.c.id
D  src/mediarev.c
D  src/mediaxml.c
M  src/issuemem.c
M  doc/getht.man
M  src/cli.c
M  BUGS
M  src/config.c
M  src/download.c
M  src/getht.c
M  src/getht.h
M  src/issue.h
M  src/tocxml.c
M  src/Makefile.am

* modified files

--- orig/BUGS
+++ mod/BUGS
@@ -1,82 +0,0 @@
-
-!! BIG BUG !!
-read media xml crashes, as cannot find any issue info, so sets issue & leaves 
an item with all blank fields
-a few things to fix with this:
-
-       read rev:
-               at the moment looks for
-                       set the filename of player \"player1\" to \"%s\"
-                       set the filename of player \"player1\" to \"
-               however, "player1" has now been changed to "PubDesk"
-               therefore change scanning routine to along the lines of
-                       set the filename of player \"*\" to \"%s\"
-               more complex but worthwhile
-               -also-
-               if no url is found inside a "on mouseUp" clause, do not keep a 
blank media entry
-               best way to do this would be to:
-                       dealloc the media item,
-                       realloc the pointer array,
-                       and -1 to no_of_media
-
-
-further progress:
--      main obstacle is that "on mouseUp" no longer necessarily follows a 
newline - file now less organised still
-       therefore we'll have to scan each line (except when already in useful 
clause (check this)) char by char for the occurance
-       best way to do this would be to scan char by char, and if one 
worthwhile is found to copy from this point to a new string for parsing
-       worth spending a few minutes checking if there's a library function out 
there to do this, if not create a simple generic one, using pointers, roughly 
of the form:
-               int containstring(char * toparse, char * match), returning 1 if 
found and 0 otherwise
--      change of scanning routine has been done, but is untested
-       consider changing for an improved getquote which can take the nth quote
-               this is due to it being best not to rely on end of lines at end 
of bit we're interested in
--      2nd clause of above (if no url is found) is very important now, as 
majority are unuseful
-
-
-currently (16/08/2007):
-
-the strcontains does not appear to be working correctly; appears to accept any 
line as a match
-this then creates a bunch of structures, which eventually become confused
-       this may point to some niggling bug in the memory management, but for 
the moment focus on correct basic rev parsing
-
-currently (28/11/2007):
-
-strcontains works mostly - check the TODO
-the sscanf for extracting uri isn't working - best to just have a slightly 
more sophisticated getquote function
-next actions:
-       /no_of_media strangely changes where it's pointing to to be "out of 
bounds" half way through
-       /       always gets stuck on 'Geometry'
-       /       must have an overflow, prob in strcontains (only happens when 
it's used lots)
-       /       rewrite strcontains using array arithmetic - easier to maintain
-       /ensure whole lines are always parsed (not just first parts thereof) 
[should now be done]
-       /       to test search output for 1st reference to Publisher, and see 
if a few lines above is a successful on mouseUp recognition
-       /       get rid of ugly & unnecessary extra checks, which are put there 
just to ensure nothing bad happens in the delicate phase
-
-currently (09/12/2007)
-
-strcontains has been rewritten to use friendly arrays; appears to work fine 
(though not heavily tested)
-getting a str has been rewritten into a function: gzgetstr ; appears to work 
fine thouth also not well tested
-
-note - arch changes they've made:
-only one regular media item (in form of earlier)
-now a new "songs" section, with neat urls following "SongsURLs" (when not in 
on mouseUp section)
-       song titles follow, again on separate neat lines, but without any easy 
delimiter to hook on to
-there is also a video section in a "on menupick pItem" clause
-       different syntax to traditional
-       has to work out url using quality choices from pItem (high, med, low; 
given below)
-       won't be too hard, just be somewhat tricky to get the different options 
(start with them hardcoded, i.e. on "put tSize & '.mov' after tURL" just make 3 
items with high, med, & low qualities
-there is also an interviews section, which looks very similar to Songs 
(InterviewsURLs)
-       note that interview names are encased in html
-there are also thumbnail jpgs, but they needn't be handled for a while
-
-next actions:
-       improve getquote to point where sscanf line is replaced [e.g. allow to 
only return quote n (and ignore prev)]
-       only include stack if it has a uri attached (otherwise throw away)
-
-18/12/07
-
-getquote has been rewritten to extract an arbitrary quote n
-empty uri strings are ignored
-
-TODO w/bugs
-generally:
-
-we should be able to read rev.gz / xml from hd, to save time & server hitting 
with testing


--- orig/doc/getht.man
+++ mod/doc/getht.man
@@ -32,9 +32,9 @@
 .SH DESCRIPTION
 .PP
 .I GetHT
-is a program which downloads multimedia and pdf files 
-from Hinduism Today. It has good proxy support, and
-is small, fast, and simple.
+is a program which downloads pdf files from Hinduism
+Today. It has good proxy support, and is small, fast,
+and simple.
 
 .I GetHT
 is not endorsed by or affiliated with Hinduism Today. 
@@ -51,14 +51,6 @@
 Download the issue numbered issno (use \fI-l\fR to find
 issue numbers).
 .TP
-.B \-n, \-\-download-media medno
-Download the multimedia file numbered medno (use \fI-m\fR
-to find media numbers).
-.TP
-.B \-m, \-\-download-all-media
-Download all multimedia files distributed by Hinduism 
-Today.
-.TP
 .B \-f, \-\-force
 Force getht to download files, even if they have
 already been downloaded. This is useful if a download
@@ -68,17 +60,9 @@
 List the issues of Hinduism Today, with issue numbers,
 sorted by date.
 .TP
-.B \m, \-\-list-media
-List the multimedia files associated with Hinduism 
-today, with media numbers, sorted by issue date.
-.TP
 .B \-t, \-\-tocfile tocfile
 Use a different contents file, as specified by tocfile.
 .TP
-.B \-x, \-\-mediatocfile mediatocfile
-Use a different media contents file, as specified by
-mediatocfile.
-.TP
 .B \-h, \-\-help
 Print a brief usage message.
 .TP
@@ -101,9 +85,8 @@
 The following options may be set.
 .TP
 .B issuepath
-Stores the path in which all issues and multimedia 
-files will be saved. The default setting is
-\fB~/hinduism_today/\fR
+Stores the path in which all issues will be saved
+The default setting is \fB~/hinduism_today/\fR
 .TP
 .B startup_check
 Whether to automatically check for new issues each 
@@ -115,11 +98,6 @@
 for the publication.
 Default: \fBhttp://www.hinduismtoday.com/digital/htde_toc.xml\fR
 .TP
-.B mediatoc_url
-A url to the rev.gz file listing the media included with 
-the publication.
-Default: \fBhttp://www.hinduismtoday.com/digital/htde_media-player.rev.gz\fR
-.TP
 .B proxy_type
 The type of proxy (if any) through which GetHT is to
 pass. GetHT currently supports the following options:


--- orig/src/Makefile.am
+++ mod/src/Makefile.am
@@ -3,5 +3,5 @@
 bin_PROGRAMS = getht
 
 getht_SOURCES = config.c cli.c download.c getht.c issuemem.c   \
-               mediarev.c mediaxml.c tocxml.c xml.c    \
+               tocxml.c xml.c  \
                getht.h issue.h version.h


--- orig/src/cli.c
+++ mod/src/cli.c
@@ -59,47 +59,15 @@
        }
 }
 
-void list_media(iss ** issue, int no_of_issues, int verbose)
-{
-       int iss_no, med_no, med_global;
-       for(iss_no=0, med_global=0;iss_no<=no_of_issues;iss_no++)
-       {
-               if(issue[iss_no]->no_of_media >= 0)
-               {
-                       printf("%s\n", issue[iss_no]->title);
-                       if(verbose >= 2)
-                               printf("Year: %i; Months: %i - 
%i\n",issue[iss_no]->date.year,issue[iss_no]->date.firstmonth,issue[iss_no]->date.lastmonth);
-                       for(med_no=0; med_no <= (issue[iss_no]->no_of_media); 
med_no++, med_global++)
-                       {
-                               printf("[%i]\t", med_global);
-                               printf("%s\n", 
issue[iss_no]->media[med_no]->title);
-                               if(verbose >= 1)
-                               {
-                                       printf("\t%s\n", 
issue[iss_no]->media[med_no]->uri);
-                                       if(verbose >=2)
-                                       {
-                                               
if(issue[iss_no]->media[med_no]->comment[0]!='\0')
-                                                       printf("\t%s\n", 
issue[iss_no]->media[med_no]->comment);
-                                       }
-                               }
-                       }
-               }
-       }
-}
-
 void showusage()
 {
        printf("Usage: getht [-ualmofhv] [-d issno] [-n medno] [-t tocfile]\n");
        printf("-u | --update                 Update contents files\n");
        printf("-a | --download-all           Download all issues\n");
        printf("-d | --download-issue issno   Download issue number issno\n");
-       printf("-n | --download-media medno   Download media number n\n");
-       printf("-o | --download-all-media     Download all media\n");
        printf("-f | --force                  Force re-download of existing 
files\n");
        printf("-l | --list-issues            List available issues\n");
-       printf("-m | --list-media             List available media\n");
        printf("-t | --tocfile file           Use alternative contents xml 
file\n");
-       printf("-x | --mediatocfile file      Use alternative media contents 
xml file\n");
        printf("-h | --help                   Print this help message\n");
        printf("-v | --verbose                Make output more verbose\n");
        printf("-V | --version                Print version information\n");


--- orig/src/config.c
+++ mod/src/config.c
@@ -31,7 +31,6 @@
 extern char proxy_user[STR_MAX];
 extern char proxy_pass[STR_MAX];
 extern char issue_url[STR_MAX];
-extern char media_url[STR_MAX];
 
 int loadconfig(char * htde_path, char * issue_path, int * update)
 /*     Loads variables from config file to extern and passed
@@ -60,8 +59,6 @@
                        *update = atoi(parameter);
                else if(!strcmp(option, "toc_url"))
                        strncpy(issue_url, parameter, STR_MAX);
-               else if(!strcmp(option, "mediatoc_url"))
-                       strncpy(media_url, parameter, STR_MAX);
                else if(!strcmp(option, "proxy_type"))
                {
                        if(!strcmp(parameter, "http"))
@@ -125,8 +122,6 @@
                fprintf(config_file, "%s = %i\n", "startup_check", *update);
        if(issue_url[0])
                fprintf(config_file, "%s = %s\n", "toc_url", issue_url);
-       if(media_url[0])
-               fprintf(config_file, "%s = %s\n", "mediatoc_url", media_url);
        if(proxy_type != NONE)
        {
                if(proxy_type = HTTP)


--- orig/src/download.c
+++ mod/src/download.c
@@ -184,48 +184,3 @@
                        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);
-}


--- orig/src/getht.c
+++ mod/src/getht.c
@@ -33,13 +33,11 @@
 
 int update_contents_files();
 
-med * findnewestmed(iss ** issue, int no_of_issues);
-
 proxytype proxy_type; char proxy_addr[STR_MAX]; long proxy_port;
 proxyauth proxy_auth; 
 char proxy_user[STR_MAX]; char proxy_pass[STR_MAX];
-char issue_xml[STR_MAX]; char media_xml[STR_MAX]; char media_rev[STR_MAX];
-char issue_url[STR_MAX]; char media_url[STR_MAX];
+char issue_xml[STR_MAX];
+char issue_url[STR_MAX];
 CURL *main_curl_handle; 
 
 int main(int argc, char *argv[])
@@ -59,18 +57,14 @@
                }
 
        snprintf(issue_xml,STR_MAX,"%s/%s",getht_path,ISS_XML_FILE);
-       snprintf(media_xml,STR_MAX, "%s/%s", getht_path, MED_XML_FILE);
-       snprintf(media_rev,STR_MAX,"%s/%s",getht_path,MED_REVGZ_FILE);
 
        strncpy(issue_url,XML_TOC_URL,STR_MAX);
-       strncpy(media_url,MEDIA_TOC_URL,STR_MAX);
 
        snprintf(save_path,STR_MAX,"%s/hinduism_today",getenv("HOME"));
 
-       int downall = 0, downallmedia = 0;
+       int downall = 0;
        int downissue = 0, downissueno = -1;
-       int downmedia = 0, downmediano = -1;
-       int listissues = 0, listmedia = 0;
+       int listissues = 0;
        int force = 0, update = 0;
        int verbose = 0, option = 0;
 
@@ -82,7 +76,7 @@
        proxy_pass[0] = '\0';
 
        if(loadconfig(getht_path, &save_path, &update) != 0)
-               writefreshconfig(getht_path, &save_path, &update, &issue_url, 
&media_url);
+               writefreshconfig(getht_path, &save_path, &update, &issue_url);
 
        if(!opendir(save_path))
                if(mkdir(save_path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | 
S_IXOTH))
@@ -100,14 +94,10 @@
        {
                {"download-all", no_argument, 0, 'a'},
                {"download-issue", required_argument, 0, 'd'},
-               {"download-media", required_argument, 0, 'n'},
-               {"download-all-media", no_argument, 0, 'o'},
                {"force", no_argument, 0, 'f'},
                {"list-issues", no_argument, 0, 'l'},
-               {"list-media", no_argument, 0, 'm'},
                {"update", no_argument, 0, 'u'},
                {"tocfile", required_argument, 0, 't'},
-               {"mediatocfile", required_argument, 0, 'x'},
                {"help", no_argument, 0, 'h'},
                {"verbose", no_argument, 0, 'v'},
                {"version", no_argument, 0, 'V'},
@@ -129,20 +119,6 @@
                                listissues = 1;
                                option = 1;
                                break;
-                       case 'm':
-                               listmedia = 1;
-                               option = 1;
-                               break;
-                       case 'o':
-                               downallmedia = 1;
-                               downmedia = 1;
-                               option = 1;
-                               break;
-                       case 'n':
-                               downmedia = 1;
-                               downmediano = atoi(optarg);
-                               option = 1;
-                               break;
                        case 'f':
                                force = 1;
                                option = 1;
@@ -154,9 +130,6 @@
                        case 't':
                                strncpy(issue_xml, strdup(optarg), STR_MAX);
                                break;
-                       case 'x':
-                               strncpy(media_xml, strdup(optarg), STR_MAX);
-                               break;
                        case 'h':
                                showusage();
                                return 0;
@@ -222,54 +195,10 @@
                        downloadissue(NULL, save_path, issue[downissueno], 
force);
        }
        
-       if(downmedia || listmedia)
-       {
-               int newest;
-
-               issue = parsemedia(media_xml, issue, &no_of_issues);
-
-               if(!issue)
-               {
-                       if(!update)
-                       {
-                               printf("Cannot open media contents file, trying 
to update contents\n");
-                               if(update_contents_files())
-                                       return 1;
-                               issue = parsemedia(media_xml, issue, 
&no_of_issues);
-                       }
-                       else
-                       {
-                               printf("Cannot open contents file, try running 
`getht --update`\n");
-                               return 1;
-                       }
-               }
-
-               if(downallmedia)
-               {
-                       for(i = 0; i <= no_of_issues; i++)
-                       {
-                               for(newest = 0; newest <= 
issue[i]->no_of_media; newest++)
-                                       downloadmedia(NULL, save_path, 
issue[i]->media[newest], force);
-                       }
-               }
-               else if(downmediano >= 0)
-               {
-                       int med_global, med_no;
-
-                       for(i=0,med_global=0; i<=no_of_issues; i++)
-                               if(issue[i]->no_of_media >= 0)
-                                       for(med_no=0; med_no <= 
(issue[i]->no_of_media); med_no++,med_global++)
-                                               if(med_global == downmediano)
-                                                       downloadmedia(NULL, 
save_path, issue[i]->media[med_no], force);
-               }
-       }
 
        if(listissues)
                list_issues(issue, no_of_issues, verbose);
 
-       if(listmedia)
-               list_media(issue, no_of_issues, verbose);
-
        /* Ensure curl cleans itself up */
        curl_easy_cleanup(main_curl_handle);
 
@@ -281,34 +210,6 @@
 {
        if(save_file(NULL, issue_url, issue_xml))
                return 1;
-       
-       char isstitle[STR_MAX];
-       issdates date;
-
-       /*      see if current issue's media toc has already
-               been written to the xml, if not do so */
-       if(access(issue_xml, R_OK) == 0)
-       {
-               if(cur_identifiers(issue_xml, isstitle, &date))
-                       return 1;
-       }
        else
-               return 1;
-
-       if(media_accounted_for(media_xml, &date))
-       {
-               if(save_file(NULL, media_url, media_rev))
-                       return 1;
-       
-               med ** temp_med;
-               int med_no = -1;
-
-               temp_med = parsemediagz(media_rev, &med_no);
-
-               unlink(media_rev);
-
-               addmediaissue(media_xml, isstitle, &date, temp_med, med_no);
-       }
-
-       return 0;
+               return 0;
 }


--- orig/src/getht.h
+++ mod/src/getht.h
@@ -20,16 +20,14 @@
  */
 
 #define XML_TOC_URL            
"http://www.hinduismtoday.com/digital/htde_toc.xml";
+
+/* currently unused - see 0.1 patch-30 for latest version parsing media */
 #define MEDIA_TOC_URL  
"http://www.hinduismtoday.com/digital/htde_media-player.rev.gz";
 
-#define MED_XML_FILE   "media_toc.xml"
 #define ISS_XML_FILE   "htde_toc.xml"
-#define MED_REVGZ_FILE "htde_media-player.rev.gz"
 
 #define STR_MAX                512
 
-#define MAX_ISS                10
-
 typedef enum
 {
        NONE,


--- orig/src/issue.h
+++ mod/src/issue.h
@@ -47,31 +47,16 @@
 
 typedef struct
 {
-       char uri[512];
-       char title[512];
-       char comment[512];
-       char preview_uri[512];
-       int size;
-} med;
-
-typedef struct
-{
        char preview_uri[512];
        char title[512];
        int size;
        issdates date;
        sec ** section;
        int no_of_sections;
-       med ** media;
-       int no_of_media;
 } iss;
 
 iss ** parsetoc(char *filepath, int * iss_no);
-iss ** parsemedia(char * filepath, iss ** issue, int * no_of_issues);
-
-med ** parsemediagz(char * media_path, int * no_of_media);
 
 iss ** assignnew_iss(iss ** issue, int *no_of_issues);
 sec ** assignnew_sec(sec ** section, int * no_of_sections);
 it ** assignnew_it(it ** item, int * no_of_items);
-med ** assignnew_med(med ** media, int * no_of_media);


--- orig/src/issuemem.c
+++ mod/src/issuemem.c
@@ -107,30 +107,6 @@
        return tmp;
 }
 
-med ** assignnew_med(med ** media, int * no_of_media)
-{
-       med ** tmp = NULL;
-
-       if(*no_of_media < 0)
-       {       /* make **section a new array of section pointers */
-               if( (tmp = malloc(sizeof(med *))) == NULL )
-                       nogo_mem();
-       }
-       else
-       {       /* add a new pointer to media pointer list */
-               if( (tmp = realloc(media, sizeof(med *) + (((*no_of_media)+1) * 
sizeof(med *)))) == NULL )
-                       nogo_mem();
-       }
-
-       (*no_of_media)++;                                         
-
-       /* make new array item a pointer to issue */
-       if( ( tmp[*no_of_media] = malloc(sizeof(med)) ) == NULL )
-               nogo_mem();
-
-       return tmp;
-}
-
 int issuesort(iss ** issue, int no_of_issues)
 /* does a basic bubble sort, by date, returning sorted issue */
 {


--- orig/src/tocxml.c
+++ mod/src/tocxml.c
@@ -68,7 +68,6 @@
                                        issue = assignnew_iss(issue, 
&no_of_issues);
 
                                        /* setup issue globals */
-                                       issue[no_of_issues]->no_of_media = -1;
                                        issue[no_of_issues]->no_of_sections = 
-1;
                                        issue[no_of_issues]->date.year =
                                                atoi( (const char 
*)(xmlStrsub(node->name,5,4)) );







reply via email to

[Prev in Thread] Current Thread [Next in Thread]