Changeset 4785


Ignore:
Timestamp:
2003-06-24T14:30:33+12:00 (21 years ago)
Author:
mdewsnip
Message:

Commented out print_usage functions - plugins should now call $self->print_txt_usage() to display their usage text. Updates to the options of a plugin should be made in the $options and $arguments data structures at the top of the plugin.

Location:
trunk/gsdl/perllib/plugins
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r4778 r4785  
    330330#  }
    331331
    332 # print_usage should be overridden for any sub-classes having
    333 # their own plugin specific options
    334332# sub print_usage {
    335333#     print STDERR "\nThis plugin has no plugin specific options\n\n";
  • trunk/gsdl/perllib/plugins/DBPlug.pm

    r4744 r4785  
    6161        'args'     => $arguments };
    6262
    63 sub print_usage {
    64     print STDERR "\n  usage: plugin DBPlug [options]\n\n";
    65     print STDERR "  options:\n";
    66     print STDERR "\n";
    67 }
     63sub print_usage {
     64    print STDERR "\n  usage: plugin DBPlug [options]\n\n";
     65    print STDERR "  options:\n";
     66    print STDERR "\n";
     67}
    6868
    6969sub new {
     
    7878             "allow_extra_options")) {
    7979    print STDERR "\nIncorrect options passed to DBPlug, check your collect.cfg configuration file\n";
    80     &print_usage();
     80    $self->print_txt_usage();
    8181        die "\n";
    8282    }
  • trunk/gsdl/perllib/plugins/EMAILPlug.pm

    r4744 r4785  
    8080}
    8181
    82 sub print_usage {
    83     print STDERR "\n  usage: plugin EMAILPlug [options]\n\n";
    84     print STDERR "  options:\n";
    85     print STDERR "   -split_exp        A perl regular expression used to split files\n";
    86     print STDERR "                     containing many messages into individual documents.\n\n";
    87     print STDERR "   -no_attachments   Do not save message attachments.\n\n";
    88 
    89 }
     82#  sub print_usage {
     83#      print STDERR "\n  usage: plugin EMAILPlug [options]\n\n";
     84#      print STDERR "  options:\n";
     85#      print STDERR "   -split_exp        A perl regular expression used to split files\n";
     86#      print STDERR "                     containing many messages into individual documents.\n\n";
     87#      print STDERR "   -no_attachments   Do not save message attachments.\n\n";
     88#  }
    9089
    9190my $arguments =
     
    127126    print STDERR "\nIncorrect options passed to $class.";
    128127    print STDERR "\nCheck your collect.cfg configuration file\n";
     128    $self->print_txt_usage();
    129129    die "\n";
    130130    }
  • trunk/gsdl/perllib/plugins/HTMLPlug.pm

    r4748 r4785  
    160160
    161161    print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
    162     &print_usage();
     162    $self->print_txt_usage();
    163163    die "\n";
    164164    }
  • trunk/gsdl/perllib/plugins/ImagePlug.pm

    r4744 r4785  
    7979
    8080
    81 sub print_usage {
    82     my ($plugin_name) = @_;
    83 
    84     print STDERR "
    85   usage: plugin ImagePlug [options]
    86 
    87    -noscaleup         Don't scale up small images when making thumbnails
    88 
    89    -thumbnailsize n   Make thumbnails of size nxn
    90 
    91    -thumbnailtype s   Make thumbnails in format 's'
    92 
    93    -screenviewsize n  If set, makes an image of size n for screen display
    94                       and sets Screen, ScreenSize, ScrrenWidth and Screeneight
    95                       metadata.  By default it is not set.
    96 
    97    -screenviewtype s  If -screenviewsize is set, this sets the screen display
    98                       image type.  Defaults to jpg.
    99 
    100    -convertto s       Convert main inage to (gif|png|jpg)
    101 
    102    -minimumsize n     Ignore images smaller than n bytes
    103 
    104 "
    105 }
     81sub print_usage {
     82    my ($plugin_name) = @_;
     83
     84    print STDERR "
     85  usage: plugin ImagePlug [options]
     86
     87   -noscaleup         Don't scale up small images when making thumbnails
     88
     89   -thumbnailsize n   Make thumbnails of size nxn
     90
     91   -thumbnailtype s   Make thumbnails in format 's'
     92
     93   -screenviewsize n  If set, makes an image of size n for screen display
     94                      and sets Screen, ScreenSize, ScrrenWidth and Screeneight
     95                      metadata.  By default it is not set.
     96
     97   -screenviewtype s  If -screenviewsize is set, this sets the screen display
     98                      image type.  Defaults to jpg.
     99
     100   -convertto s       Convert main inage to (gif|png|jpg)
     101
     102   -minimumsize n     Ignore images smaller than n bytes
     103
     104"
     105}
    106106
    107107sub new {
     
    127127    print STDERR "\nImagePlug uses an incorrect option.\n";
    128128    print STDERR "Check your collect.cfg configuration file.\n";
    129         &print_usage($plugin_name);
     129    $self->print_txt_usage();
    130130    die "\n";
    131131    }
  • trunk/gsdl/perllib/plugins/MACROPlug.pm

    r4744 r4785  
    4646        'args'     => $arguments };
    4747
    48 sub print_usage {
    49     print STDERR "\n  usage: plugin MACROPlug [options]\n\n";
    50     print STDERR "  options:\n";
    51     print STDERR "   -title_sub\t     Substitution expression to modify string stored as Title.\n";
    52     print STDERR "\t\t     Used by, for example, PSPlug to remove \"Page 1\" etc from\n";
    53     print STDERR "\t\t     text used as the title.\n";
    54 
    55     print STDERR "\n";
    56 }
     48sub print_usage {
     49    print STDERR "\n  usage: plugin MACROPlug [options]\n\n";
     50    print STDERR "  options:\n";
     51    print STDERR "   -title_sub\t     Substitution expression to modify string stored as Title.\n";
     52    print STDERR "\t\t     Used by, for example, PSPlug to remove \"Page 1\" etc from\n";
     53    print STDERR "\t\t     text used as the title.\n";
     54
     55    print STDERR "\n";
     56}
    5757
    5858
  • trunk/gsdl/perllib/plugins/MARCPlug.pm

    r4744 r4785  
    5353use MARC::Batch; 
    5454
    55 sub print_usage {
    56     print STDERR "\n  usage: plugin MARCPlug [options]\n\n";
    57     print STDERR "  options:\n";
    58     print STDERR
    59 "   -metadata_mapping  Name of file that includes mapping details from MARC
    60                       values to Greenstone metadata names. Defaults to
    61                       'marctodc.txt' found in the site's etc directory.\n\n";
    62 }
     55sub print_usage {
     56    print STDERR "\n  usage: plugin MARCPlug [options]\n\n";
     57    print STDERR "  options:\n";
     58    print STDERR
     59"   -metadata_mapping  Name of file that includes mapping details from MARC
     60                      values to Greenstone metadata names. Defaults to
     61                      'marctodc.txt' found in the site's etc directory.\n\n";
     62}
    6363
    6464sub new {
     
    7373
    7474    print STDERR "\nIncorrect options passed to MARCPlug, check your collect.cfg configuration file\n";
    75     &print_usage();
     75    $self->print_txt_usage();
    7676    die "\n";
    7777    }
  • trunk/gsdl/perllib/plugins/OAIPlug.pm

    r4747 r4785  
    4040        'inherits' => "yes" };
    4141
    42 sub print_usage {
    43     print STDERR "\n  usage: plugin OAIPlug [options]\n\n";
    44     print STDERR "  currently no options:\n";
    45 }
     42sub print_usage {
     43    print STDERR "\n  usage: plugin OAIPlug [options]\n\n";
     44    print STDERR "  currently no options:\n";
     45}
    4646
    4747sub new {
     
    5353
    5454    print STDERR "\nIncorrect options passed to OAIPlug, check your collect.cfg configuration file\n";
    55     &print_usage();
     55    $self->print_txt_usage();
    5656    die "\n";
    5757    }
  • trunk/gsdl/perllib/plugins/PDFPlug.pm

    r4744 r4785  
    7878
    7979    print STDERR "\nIncorrect options passed to PDFPlug, check your collect.cfg configuration file\n";
    80     &print_usage();
     80    local $self = new ConvertToPlug($class, @_, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
     81    $self->print_txt_usage();
    8182    die "\n";
    8283    }
     
    118119
    119120
    120 sub print_usage {
    121     print STDERR "\n  usage: plugin PDFPlug [options]\n\n";
    122     print STDERR "  options:\n";
    123     print STDERR "   -convert_to (html|text) Convert to TEXT or HTML (default html)\n";
    124     print STDERR "   -use_sections     Create a separate section for each page\n";
    125     print STDERR "                     of the PDF file.\n";
    126     print STDERR "   -noimages         Don't attempt to extract images from PDF.\n";
    127     print STDERR "   -complex          Create more complex output. With this option\n";
    128     print STDERR "                     set the output html will look much more like\n";
    129     print STDERR "                     the original PDF file. For this to function\n";
    130     print STDERR "                     properly you Ghostscript installed (for *nix\n";
    131     print STDERR "                     gs should be on your path while for windows\n";
    132     print STDERR "                     you must have gswin32c.exe on your path).\n";
    133     print STDERR "   -nohidden         Prevent pdftohtml from attempting to extract\n";
    134     print STDERR "                     hidden text. This is only useful if the -complex\n";
    135     print STDERR "                     option is also set.";
    136     print STDERR "   -zoom             The factor by which to zoomthe PDF for output\n";
    137     print STDERR "                     (this is only useful if -complex is set).\n\n";
    138 }
     121sub print_usage {
     122    print STDERR "\n  usage: plugin PDFPlug [options]\n\n";
     123    print STDERR "  options:\n";
     124    print STDERR "   -convert_to (html|text) Convert to TEXT or HTML (default html)\n";
     125    print STDERR "   -use_sections     Create a separate section for each page\n";
     126    print STDERR "                     of the PDF file.\n";
     127    print STDERR "   -noimages         Don't attempt to extract images from PDF.\n";
     128    print STDERR "   -complex          Create more complex output. With this option\n";
     129    print STDERR "                     set the output html will look much more like\n";
     130    print STDERR "                     the original PDF file. For this to function\n";
     131    print STDERR "                     properly you Ghostscript installed (for *nix\n";
     132    print STDERR "                     gs should be on your path while for windows\n";
     133    print STDERR "                     you must have gswin32c.exe on your path).\n";
     134    print STDERR "   -nohidden         Prevent pdftohtml from attempting to extract\n";
     135    print STDERR "                     hidden text. This is only useful if the -complex\n";
     136    print STDERR "                     option is also set.";
     137    print STDERR "   -zoom             The factor by which to zoomthe PDF for output\n";
     138    print STDERR "                     (this is only useful if -complex is set).\n\n";
     139}
    139140
    140141
  • trunk/gsdl/perllib/plugins/PSPlug.pm

    r4744 r4785  
    7777             "allow_extra_options")) {
    7878    print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
    79     &print_usage();
     79    $self->print_txt_usage();
    8080    die "\n";
    8181    }
     
    8484}
    8585
    86 sub print_usage {
    87     print STDERR "\n  usage: plugin PSPlug [options]\n\n";
    88     print STDERR "  options:\n";
    89     print STDERR "   -extract_date               Extract date from PS header\n";
    90     print STDERR "   -extract_pages              Extract pages from PS header\n";
    91     print STDERR "   -extract_title              Extract title from PS header\n";
    92     print STDERR "\n\nNote! This is a \"poor man's\" ps to text converter. If you are serious, consider\n";
    93     print STDERR "using the PRESCRIPT package, which is available for download at\n   http://www.nzdl.org/html/software.html\n\n";
    94 }
     86sub print_usage {
     87    print STDERR "\n  usage: plugin PSPlug [options]\n\n";
     88    print STDERR "  options:\n";
     89    print STDERR "   -extract_date               Extract date from PS header\n";
     90    print STDERR "   -extract_pages              Extract pages from PS header\n";
     91    print STDERR "   -extract_title              Extract title from PS header\n";
     92    print STDERR "\n\nNote! This is a \"poor man's\" ps to text converter. If you are serious, consider\n";
     93    print STDERR "using the PRESCRIPT package, which is available for download at\n   http://www.nzdl.org/html/software.html\n\n";
     94}
    9595
    9696sub get_default_block_exp {
  • trunk/gsdl/perllib/plugins/RecPlug.pm

    r4744 r4785  
    122122        'args'     => $arguments };
    123123
    124 sub print_usage {
    125     my ($plugin_name) = @_;
    126 
    127     print STDERR "
    128   usage: plugin RecPlug [options]
    129 
    130    -use_metadata_files  Read metadata from metadata XML files.
    131 
    132 "
    133 }
     124sub print_usage {
     125    my ($plugin_name) = @_;
     126
     127    print STDERR "
     128  usage: plugin RecPlug [options]
     129
     130   -use_metadata_files  Read metadata from metadata XML files.
     131
     132"
     133}
    134134
    135135my ($self);
     
    149149    print STDERR "\nRecPlug uses an incorrect option.\n";
    150150    print STDERR "Check your collect.cfg configuration file.\n\n";
    151         &print_usage("RecPlug");
     151    $self->print_txt_usage();
    152152    die "\n";
    153153    }
  • trunk/gsdl/perllib/plugins/SRCPlug.pm

    r4744 r4785  
    6868        'args'     => $arguments };
    6969
    70 sub print_usage {
    71     print STDERR "\n  usage: plugin SRCPlug [options]\n";
    72     print STDERR "Try to import C and C++ source code. Adds \"class\"";
    73     print STDERR " metadata.\n\n";
    74     print STDERR "  options:\n";
    75     print STDERR "  -remove_prefix <pattern>   Remove this leading pattern from the filename\n";
    76     print STDERR "                             (eg -remove_prefix /tmp/XX/src/). The default is to\n";
    77     print STDERR "                             remove the whole path from the filename.\n";
    78     print STDERR "\n";
    79 }
     70sub print_usage {
     71    print STDERR "\n  usage: plugin SRCPlug [options]\n";
     72    print STDERR "Try to import C and C++ source code. Adds \"class\"";
     73    print STDERR " metadata.\n\n";
     74    print STDERR "  options:\n";
     75    print STDERR "  -remove_prefix <pattern>   Remove this leading pattern from the filename\n";
     76    print STDERR "                             (eg -remove_prefix /tmp/XX/src/). The default is to\n";
     77    print STDERR "                             remove the whole path from the filename.\n";
     78    print STDERR "\n";
     79}
    8080
    8181sub new {
     
    9494        print STDERR "\nIncorrect options passed to SRCPlug, ";
    9595        print STDERR "check your collect.cfg configuration file\n";
    96         &print_usage();
     96    $self->print_txt_usage();
    9797        die "\n";
    9898    }
  • trunk/gsdl/perllib/plugins/TEXTPlug.pm

    r4744 r4785  
    5656        'args'     => $arguments };
    5757
    58 sub print_usage {
    59     print STDERR "\n  usage: plugin TEXTPlug [options]\n\n";
    60     print STDERR "  options:\n";
    61     print STDERR "   -title_sub\t     Substitution expression to modify string stored as Title.\n";
    62     print STDERR "\t\t     Used by, for example, PSPlug to remove \"Page 1\" etc from\n";
    63     print STDERR "\t\t     text used as the title.\n";
     58sub print_usage {
     59    print STDERR "\n  usage: plugin TEXTPlug [options]\n\n";
     60    print STDERR "  options:\n";
     61    print STDERR "   -title_sub\t     Substitution expression to modify string stored as Title.\n";
     62    print STDERR "\t\t     Used by, for example, PSPlug to remove \"Page 1\" etc from\n";
     63    print STDERR "\t\t     text used as the title.\n";
    6464
    65     print STDERR "\n";
    66 }
     65    print STDERR "\n";
     66}
    6767
    6868sub new {
     
    7878             "allow_extra_options")) {
    7979    print STDERR "\nIncorrect options passed to TEXTPlug, check your collect.cfg configuration file\n";
    80     &print_usage();
     80    $self->print_txt_usage();
    8181        die "\n";
    8282    }
  • trunk/gsdl/perllib/plugins/UnknownPlug.pm

    r4744 r4785  
    8181        'args'     => $arguments };
    8282
    83 sub print_usage {
    84     print STDERR "\n  usage: plugin UnknownPlug [options]\n\n";
    85     print STDERR "  options:\n";
    86     print STDERR "   -assoc_field\t     Name of the metadata field that will hold\n";
    87     print STDERR "\t\t     the associated file's name.\n";
    88     print STDERR "\n";
    89     print STDERR "   -file_type\t     Mime type of the file (e.g. image/gif)\n";
    90     print STDERR "\n";
    91 }
     83sub print_usage {
     84    print STDERR "\n  usage: plugin UnknownPlug [options]\n\n";
     85    print STDERR "  options:\n";
     86    print STDERR "   -assoc_field\t     Name of the metadata field that will hold\n";
     87    print STDERR "\t\t     the associated file's name.\n";
     88    print STDERR "\n";
     89    print STDERR "   -file_type\t     Mime type of the file (e.g. image/gif)\n";
     90    print STDERR "\n";
     91}
    9292
    9393sub new {
     
    104104             "allow_extra_options")) {
    105105    print STDERR "\nIncorrect options passed to UnknownPlug, check your collect.cfg configuration file\n";
    106     &print_usage();
     106    $self->print_txt_usage();
    107107        die "\n";
    108108    }
  • trunk/gsdl/perllib/plugins/W3ImgPlug.pm

    r4744 r4785  
    225225
    226226
    227 sub print_usage {
    228     print STDERR "\nUsage: plugin W3ImgPlug [options]\n\n";
    229     print STDERR "  options:\n";
    230     print STDERR "   -aggressiveness     Range of related text extraction techniques to use [4]\n";
    231     print STDERR "                        1: Filename, path, ALT text only\n";
    232     print STDERR "                        2: All of 1, plus caption where available\n";
    233     print STDERR "                        3: All of 2, plus near paragraphs where available\n";
    234     print STDERR "                        4: All of 3, plus previous headers (<h1>, <h2>...)\n";
    235     print STDERR "                           where available\n";
    236     print STDERR "                        5: All of 4, plus textual references where available\n";
    237     print STDERR "                        6: All of 4, plus page metatags (title, keywords, etc)\n";
    238     print STDERR "                        7: All of 6, 5 and 4 combined\n";
    239     print STDERR "                        8: All of 7, plus repeat caption, filename, etc (raise \n";
    240     print STDERR "                           ranking of more relevant results)\n";
    241     print STDERR "                        10: All of 1, plus full text of source page\n";
    242     print STDERR "\n";
    243     print STDERR "   -no_cache_images    Don't cache images (point to URL of original)\n";
    244     print STDERR "   -index_pages        Index the pages along with the images.\n";
    245     print STDERR "                       Otherwise reference the pages at the source URL\n";
    246     print STDERR "   -min_size           Bytes. Skip images smaller than this [2000]\n";
    247     print STDERR "   -min_width          Pixels. Skip images narrower than this [50 pixels]\n";
    248     print STDERR "   -min_height         Pixels. Skip images shorter than this [50 pixels]\n";
    249     print STDERR "   -thumb_size         Max thumbnail size. Both width and height [100 pixels]\n";
    250     print STDERR "   -convert_params     Additional parameters for ImageMagicK convert on\n";
    251     print STDERR "                       thumbnail creation. For example, '-raise' will give\n";
    252     print STDERR "                       a three dimensional effect to thumbnail images.\n";
    253     print STDERR "   -document_text      Add image text as document:text (otherwise IndexedText\n";
    254     print STDERR "                       metadata field)\n";
    255     print STDERR "\n";
    256     print STDERR " Advanced Options (applicability depends on aggressiveness level)\n";
    257     print STDERR "   -smallpage_threshold Images on pages smaller than this (bytes) will have\n";
    258     print STDERR "                        the page (title, keywords, etc) meta-data added [2048]\n";
    259     print STDERR "   -textrefs_threshold  Threshold for textual references. Lower values mean\n";
    260     print STDERR "                        the algorithm is less strict [2]\n";
    261     print STDERR "   -caption_length      Maximum length of captions (in characters) [100]\n";
    262     print STDERR "   -neartext_length     Target length of near text (in characters) [300]\n";
    263     print STDERR "   -max_near_text       Maximum characters near images to extract [400]\n";
    264     print STDERR "   -min_near_text       Minimum characters of near text or caption to extract [10]\n";
    265     print STDERR "\n";
    266     print STDERR " Tag set configuration file (XML format):\n";
    267     print STDERR "   <collectionpath>/etc/W3ImgPlug.cfg \n";
    268     print STDERR "\n";
    269     print STDERR "\n";
    270     print STDERR "W3ImgPlug inherits all of HTMLPlug's functionality and options:\n";
    271     HTMLPlug::print_usage();
    272     print STDERR "\n";
    273 }
     227sub print_usage {
     228    print STDERR "\nUsage: plugin W3ImgPlug [options]\n\n";
     229    print STDERR "  options:\n";
     230    print STDERR "   -aggressiveness     Range of related text extraction techniques to use [4]\n";
     231    print STDERR "                        1: Filename, path, ALT text only\n";
     232    print STDERR "                        2: All of 1, plus caption where available\n";
     233    print STDERR "                        3: All of 2, plus near paragraphs where available\n";
     234    print STDERR "                        4: All of 3, plus previous headers (<h1>, <h2>...)\n";
     235    print STDERR "                           where available\n";
     236    print STDERR "                        5: All of 4, plus textual references where available\n";
     237    print STDERR "                        6: All of 4, plus page metatags (title, keywords, etc)\n";
     238    print STDERR "                        7: All of 6, 5 and 4 combined\n";
     239    print STDERR "                        8: All of 7, plus repeat caption, filename, etc (raise \n";
     240    print STDERR "                           ranking of more relevant results)\n";
     241    print STDERR "                        10: All of 1, plus full text of source page\n";
     242    print STDERR "\n";
     243    print STDERR "   -no_cache_images    Don't cache images (point to URL of original)\n";
     244    print STDERR "   -index_pages        Index the pages along with the images.\n";
     245    print STDERR "                       Otherwise reference the pages at the source URL\n";
     246    print STDERR "   -min_size           Bytes. Skip images smaller than this [2000]\n";
     247    print STDERR "   -min_width          Pixels. Skip images narrower than this [50 pixels]\n";
     248    print STDERR "   -min_height         Pixels. Skip images shorter than this [50 pixels]\n";
     249    print STDERR "   -thumb_size         Max thumbnail size. Both width and height [100 pixels]\n";
     250    print STDERR "   -convert_params     Additional parameters for ImageMagicK convert on\n";
     251    print STDERR "                       thumbnail creation. For example, '-raise' will give\n";
     252    print STDERR "                       a three dimensional effect to thumbnail images.\n";
     253    print STDERR "   -document_text      Add image text as document:text (otherwise IndexedText\n";
     254    print STDERR "                       metadata field)\n";
     255    print STDERR "\n";
     256    print STDERR " Advanced Options (applicability depends on aggressiveness level)\n";
     257    print STDERR "   -smallpage_threshold Images on pages smaller than this (bytes) will have\n";
     258    print STDERR "                        the page (title, keywords, etc) meta-data added [2048]\n";
     259    print STDERR "   -textrefs_threshold  Threshold for textual references. Lower values mean\n";
     260    print STDERR "                        the algorithm is less strict [2]\n";
     261    print STDERR "   -caption_length      Maximum length of captions (in characters) [100]\n";
     262    print STDERR "   -neartext_length     Target length of near text (in characters) [300]\n";
     263    print STDERR "   -max_near_text       Maximum characters near images to extract [400]\n";
     264    print STDERR "   -min_near_text       Minimum characters of near text or caption to extract [10]\n";
     265    print STDERR "\n";
     266    print STDERR " Tag set configuration file (XML format):\n";
     267    print STDERR "   <collectionpath>/etc/W3ImgPlug.cfg \n";
     268    print STDERR "\n";
     269    print STDERR "\n";
     270    print STDERR "W3ImgPlug inherits all of HTMLPlug's functionality and options:\n";
     271    HTMLPlug::print_usage();
     272    print STDERR "\n";
     273}
    274274
    275275sub new {
     
    301301
    302302    print STDERR "\nIncorrect options passed to W3ImgPlug, check your collect.cfg configuration file\n";
    303     &print_usage();
     303    $self->print_txt_usage();
    304304    die "\n";
    305305    }
Note: See TracChangeset for help on using the changeset viewer.