Changeset 78

Show
Ignore:
Timestamp:
10/16/06 19:39:16 (7 years ago)
Author:
max
Message:

Updated gconf-builder.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/gconf-builder

    r58 r78  
    2727        "amounts of bandwidth. Category 2 grabbers are quite fast\n" . 
    2828        "and download relatively few files.\n\n"; 
    29 $config->{category} = ask("Which category is $grabber?"); 
     29$config->{category} = ask_choice("Which category is $grabber?", 1, 1, 2); 
    3030 
    3131print   "\nCATEGORY: Channels Supported\n\n" . 
     
    4141 
    4242print   "\nCATEGORY: Days Supported\n\n" . 
    43         "Enter how many days of data $grabber can retrieve. The current\n" . 
    44         "day is considered to be day 1.\n\n"; 
     43        "Enter how many days of data $grabber can retrieve.\n\n"; 
    4544 
    4645$config->{max_days} = ask("Days supported? [default=7]"); 
     
    4948print   "\nSome grabbers aren't always able to retrieve the maximum number\n" . 
    5049        "of days, because sometimes the datasource isn't topped up. Enter\n" . 
    51         "the minimum number of days of data that $grabber can reliably fetch,\n" . 
    52         "where today is day 1.\n\n"; 
    53  
    54 $config->{min_days} = ask("Minimum days supported? [default=7]"); 
    55 $config->{min_days} ||= 7; 
     50        "the minimum number of days of data that $grabber can reliably fetch.\n\n"; 
     51 
     52$config->{max_reliable_days} = ask("Days reliably supported? [default=7]"); 
     53$config->{max_reliable_days} ||= 7; 
     54 
     55print   "\nCATEGORY: Regions Supported\n\n" . 
     56        "Enter the region IDs supported by $grabber. If $grabber supports\n" . 
     57        "all regions, just hit Enter. If it supports a limited number of regions,\n" . 
     58        "enter these separated by spaces (e.g. \"94 104 118\"). If it supports\n" . 
     59        "most but not all regions, enter a minus sign followed by a list of the\n" . 
     60        "unsupported regions (e.g. \"-112 114 128\").\n\n"; 
     61 
     62$config->{regions} = ask("Regions supported?"); 
    5663 
    5764print   "\nCATEGORY: Configuration Requirements\n\n" . 
     
    5966        "before it can run (such as registration on a remote web site).\n\n"; 
    6067 
    61 $config->{config_reqd} = ask_boolean("Requires manual configuration? "); 
    62  
    63 if ($config->{config_reqd}) 
    64 { 
     68if (ask_boolean("Requires manual configuration? ")) 
     69{ 
     70    $config->{config_reqd} = 1; 
     71         
    6572    print   "\nShepherd needs a way of detecting whether $grabber has been\n" . 
    6673            "correctly configured or not. Please enter a command-line option\n" . 
    6774            "that will cause $grabber to exit with status 0 if it is configured\n" . 
    6875            "correctly, and exit with another status if it is not.\n\n"; 
    69     $config->{option_ready} = ask("Command-line option for readiness? [default=--ready]"); 
    70     $config->{option_ready} ||= '--ready'; 
     76            $config->{option_ready} = ask("Command-line option for readiness? [default=--ready]"); 
     77            $config->{option_ready} ||= '--ready'; 
    7178} 
    7279else 
     
    7885    $config->{option_ready} = ask("Command-line option for compilation check? " . 
    7986            "[default=--version]"); 
    80     $config->{option_read} ||= '--version'; 
    81 } 
    82  
    83 print   "\nCATEGORY: Niceness\n\n" . 
    84         "NOTE: This metric will probably change, so don't sweat it for now.\n". 
    85         "Rate the niceness of $grabber. Niceness is a general score out\n" . 
    86         "of 10 for how quickly, efficiently, and, well, nicely, the\n" . 
    87         "grabber can retrieve data.\n\n"; 
    88  
    89 $config->{niceness} = ask("Niceness? [default=5]"); 
    90 $config->{niceness} ||= 5; 
     87    $config->{option_ready} ||= '--version'; 
     88} 
     89 
     90print   "\nCATEGORY: Data Quality\n\n" . 
     91        "Rate the accuracy of the data $grabber fetches; i.e. how often it\n" . 
     92        "can be relied upon to report the right programs in the right timeslots.\n" . 
     93        "(This is a measure of the source $grabber relies upon rather than a\n". 
     94        "a judgement of $grabber itself.)\n" . 
     95        "(1) Guide data is often inaccurate\n" . 
     96        "(2) Guide data is occasionally or sometimes inaccurate\n" . 
     97        "(3) Guide data is 100% accurate, or very close to it\n\n"; 
     98 
     99$config->{quality} = ask_choice("Data quality?", 3, 1, 2, 3); 
     100 
     101#print  "\nCATEGORY: Niceness\n\n" . 
     102#       "NOTE: This metric will probably change, so don't sweat it for now.\n". 
     103#       "Rate the niceness of $grabber. Niceness is a general score out\n" . 
     104#       "of 10 for how quickly, efficiently, and, well, nicely, the\n" . 
     105#       "grabber can retrieve data.\n\n"; 
     106# 
     107#$config->{niceness} = ask("Niceness? [default=5]"); 
     108#$config->{niceness} ||= 5; 
    91109 
    92110my $g = ''; 
     
    96114        "as opposed to having to fetch all or nothing.\n\n"; 
    97115 
    98 $s = ask_boolean("Can $grabber fetch a single day of data only? "); 
     116$s = ask_boolean("Can $grabber fetch a single day of data only? ", 1); 
    99117 
    100118if ($s) 
     
    109127    $config->{option_days} ||= '--days'; 
    110128 
     129    print   "\nDoes $grabber consider day 1 to be today? That is, if invoked\n". 
     130            "with the option \"" . $config->{option_days} . "1\", will $grabber\n" . 
     131            "fetch data for today? If you answer 'no', we will assume that $grabber\n" . 
     132            "considers tomorrow to be day 1.\n\n"; 
     133    $config->{day_zero} = ask_boolean("Day 1 is today?", 1) ? 0 : 1; 
     134 
    111135    print   "\nWhat option needs to be sent to $grabber to specify the\n" . 
    112136            "day to begin fetching data for? (E.g. if $grabber\n" . 
     
    117141    $config->{option_days_offset} ||= '--offset'; 
    118142 
    119     print   "\nAssuming today is day 1 and tomorrow is day 2, which day(s)\n" . 
    120             "will $grabber retrieve data for if invoked with the following\n" . 
    121             "command:\n" . 
     143    print   "\nIf invoked with the command:\n" . 
    122144            "  ./$grabber $config->{option_days} 2 $config->{option_days_offset} 1\n" . 
    123             "Enter a range, such as \"2-4\" or \"2-2\".\n\n"; 
    124     $s = ask("Days fetched with the above option? " . 
    125             "[default=2-2]"); 
    126     $s ||= '2-2'; 
    127     if ($s =~ /(\d)-(\d)/) 
     145            "... how many days of data will $grabber fetch?\n\n"; 
     146    $s = ask("Days fetched? [default=2]"); 
     147    $s ||= 2; 
     148    unless ($s == 2) 
    128149    { 
    129         $config->{option_days_adjust} = 2- $2; 
    130         $config->{option_days_offset_adjust} = 2- $1; 
     150        $config->{option_offset_eats_days} = 1; 
    131151    } 
    132152 
     153#    print   "\nIf today is day 1 and tomorrow is day 2, which day(s) will\n" . 
     154#           "$grabber retrieve data for if invoked with the command:\n" . 
     155#           "  ./$grabber $config->{option_days} 2 $config->{option_days_offset} 1\n" . 
     156#           "Enter a range, such as \"2-3\" or \"2-2\".\n\n"; 
     157#    $s = ask("Days fetched with the above option? " . 
     158#           "[default=2-3]"); 
     159#    $s ||= '2-3'; 
     160#    if ($s =~ /(\d)-(\d)/) 
     161#    { 
     162#       $config->{option_days_offset_adjust} = 2 - $config->{day_zero} - $1; 
     163#       if ($2 - $config->{day_zero} != 3) 
     164#       { 
     165#           $config->{option_days_includes_offset} = 1; 
     166#       } 
     167# 
     168#   } 
     169 
    133170} 
    134171 
    135172print "\n"; 
    136173 
    137 $s = ask_boolean("Can $grabber fetch a single channel of data only? "); 
    138  
    139 if ($s) 
    140 { 
    141     $g .= 'c'; 
    142     print   "\nWhat option needs to be sent to $grabber to specify\n" . 
    143             "the channels wanted? For example, if $grabber can be\n" . 
    144             "instructed to fetch data for channels Seven and Nine by\n" . 
    145             "the option \"--channels Seven,Nine\", enter \"--channels\".\n\n"; 
    146      
    147     $config->{option_channels} = ask("Command-line option for channels? " . 
    148             "[default=--channels]"); 
    149     $config->{option_channels} ||= '--channels'; 
    150 } 
    151  
    152 $config->{granularity} = $g; 
    153  
    154 print   "\nCATEGORY: Caching\n\n" . 
    155         "Some grabbers use an internal cache, to avoid re-fetching data.\n\n"; 
    156  
    157 $config->{cache} = ask_boolean("Does $grabber use an internal cache?"); 
    158  
    159 if ($config->{cache}) 
    160 { 
    161  
    162     print   "\nSome grabbers are able to run in \"cheap\" mode, which\n" . 
    163             "means they verify and return their internal cache without\n" . 
    164             "fetching many web pages or taking too long to run.\n\n"; 
    165     $config->{cheap_mode} = ask_boolean("Does $grabber have a \"cheap\" mode?"); 
    166     if ($config->{cheap_mode}) 
    167     { 
    168         $config->{option_cheap} = ask("\nWhat option enables this \"cheap\" " . 
    169                 "mode? [default=--cheap]"); 
    170         $config->{option_cheap} ||= '--cheap'; 
    171     } 
    172  
    173     # Possibly ask a question about cache verification 
    174 } 
     174# I think we'll rewrite channels.conf to simulate this for all grabbers 
     175# (or rather, write temporary channels.conf files). 
     176# 
     177#$s = ask_boolean("Can $grabber fetch a single channel of data only? "); 
     178# 
     179#if ($s) 
     180#{ 
     181#    $g .= 'c'; 
     182#    print   "\nWhat option needs to be sent to $grabber to specify\n" . 
     183#           "the channels wanted? For example, if $grabber can be\n" . 
     184#           "instructed to fetch data for channels Seven and Nine by\n" . 
     185#           "the option \"--channels Seven,Nine\", enter \"--channels\".\n\n"; 
     186#     
     187#    $config->{option_channels} = ask("Command-line option for channels? " . 
     188#           "[default=--channels]"); 
     189#    $config->{option_channels} ||= '--channels'; 
     190#} 
     191# 
     192#$config->{granularity} = $g; 
     193 
     194if ($config->{category} == 1) 
     195{ 
     196    print   "\nCATEGORY: Verified Caching\n\n" . 
     197            "Category 1 grabbers often have an internal cache. They can use this\n" . 
     198            "to greatly reduce the amount of downloads necessary, by returning the\n" . 
     199            "cached data rather than fetching it anew. An important part of this\n" . 
     200            "process is verification, or checking to make sure that the schedule\n" . 
     201            "hasn't changed significantly from the cache.\n\n"; 
     202 
     203    $config->{cache} = ask_boolean("Can $grabber reduce downloads by through verified caching?", 1); 
     204} 
     205 
     206# I think this is no longer needed because Shepherd will keep track of 
     207# what's in the cache, yes? 
     208# 
     209# 
     210#if ($config->{cache}) 
     211#{ 
     212# 
     213#    print   "\nSome grabbers are able to run in \"cheap\" mode, which\n" . 
     214#           "means they verify and return their internal cache without\n" . 
     215#           "fetching many web pages or taking too long to run.\n\n"; 
     216#    $config->{cheap_mode} = ask_boolean("Does $grabber have a \"cheap\" mode?"); 
     217#    if ($config->{cheap_mode}) 
     218#    { 
     219#       $config->{option_cheap} = ask("\nWhat option enables this \"cheap\" " . 
     220#               "mode? [default=--cheap]"); 
     221#       $config->{option_cheap} ||= '--cheap'; 
     222#    } 
     223# 
     224#} 
    175225 
    176226print   "\nCATEGORY: Description\n\n" . 
     
    179229$config->{desc} = ask("Description?"); 
    180230 
    181 print   "\nCONFIGURATION COMPLETE\n\n" . 
     231print   "\nCONFIGURATION COMPLETE!\n\n" . 
    182232        "Grabber: $grabber\n" . 
    183233        Dumper($config);