| 1 |
15 |
art |
forgottenislanderbot -- command reference
|
| 2 |
|
|
|
| 3 |
|
|
fib-cadb2sql.py
|
| 4 |
|
|
Usage: python fib-cadb2sql.py (output) (input...)
|
| 5 |
|
|
where
|
| 6 |
|
|
output
|
| 7 |
|
|
is the name of the SQlite database file to write to.
|
| 8 |
|
|
If it already exists, duplicate entries may be created,
|
| 9 |
|
|
so this should not be used to update existing databases.
|
| 10 |
|
|
input...
|
| 11 |
|
|
is at least one tab-separated values file from
|
| 12 |
|
|
http://www.gov.pe.ca/civicaddress/download/index.php3
|
| 13 |
|
|
with all values. Usually 3 will be used, one for each county.
|
| 14 |
|
|
Example:
|
| 15 |
|
|
python fib-cadb2sql.py database.sqlite queens.tsv kings.tsv prince.tsv
|
| 16 |
|
|
|
| 17 |
|
|
|
| 18 |
|
|
fib-crawlbot.py
|
| 19 |
|
|
Usage: python fib-crawlbot.py (database) (sparsity) (interval) (noCities)
|
| 20 |
|
|
where
|
| 21 |
|
|
database
|
| 22 |
|
|
is the SQlite database file generated by fib-cadb2sql.py,
|
| 23 |
|
|
containing the list of civic addresses. DSL statuses will be
|
| 24 |
|
|
stored in the same database. Already-checked addresses will not
|
| 25 |
|
|
be rechecked.
|
| 26 |
|
|
sparsity
|
| 27 |
|
|
is the minimum difference between civic numbers on a road to
|
| 28 |
|
|
check. A sparsity of 10 would get #500, not #509, #510, and
|
| 29 |
|
|
#550. The first address on each road will always be gotten.
|
| 30 |
|
|
To get every address, use 1.
|
| 31 |
|
|
interval
|
| 32 |
|
|
is the delay in seconds to wait between requests to the server.
|
| 33 |
|
|
Can be a float. The bot is single-threaded. Due to the database
|
| 34 |
|
|
size, a delay of 1 is practical.
|
| 35 |
|
|
noCities
|
| 36 |
|
|
is whether to ignore the two cities or not, as they likely have
|
| 37 |
|
|
DSL. Can be 'y' or 'n'. If the whole database is being fetched,
|
| 38 |
|
|
this may as well be 'n'.
|
| 39 |
|
|
Example:
|
| 40 |
|
|
python fib-crawlbot.py database.sqlite 1 1 n
|
| 41 |
|
|
|
| 42 |
|
|
|
| 43 |
|
|
fib-dbutil.py
|
| 44 |
|
|
Usage: python fib-dbutil.py (database) (COMMAND) (OPTIONS)
|
| 45 |
|
|
where
|
| 46 |
|
|
database
|
| 47 |
|
|
is the SQlite database to work on.
|
| 48 |
|
|
COMMANDS: OPTIONS:
|
| 49 |
|
|
--stats (dslmask) (sparsity) (noCities)
|
| 50 |
|
|
Prints a table of totals of each
|
| 51 |
|
|
DSL status. Useful for predicting
|
| 52 |
|
|
the results of a given sparsity,
|
| 53 |
|
|
and determining the final count
|
| 54 |
|
|
of no-DSL addresses.
|
| 55 |
|
|
--list (dslmask) (sparsity) (noCities)
|
| 56 |
|
|
Prints out all addresses matching
|
| 57 |
|
|
the given sparsity. Not very use-
|
| 58 |
|
|
ful, for now.
|
| 59 |
|
|
--kml (dslmask) (sparsity) (noCities) (outputKML)
|
| 60 |
|
|
Generates a Keyhole Markup Language
|
| 61 |
|
|
virtual-globe overlay, with DSL status
|
| 62 |
|
|
represented by differently-coloured
|
| 63 |
|
|
icons. Sparsity is important here,
|
| 64 |
|
|
as Google Earth is not fun to use
|
| 65 |
|
|
when displaying 68000 placemarks.
|
| 66 |
17 |
art |
Default colors are EMPTY: white,
|
| 67 |
|
|
NODSL: yellow, BASIC: cyan, ULTRA: green.
|
| 68 |
15 |
art |
dslmask
|
| 69 |
|
|
is which DSL-statuses to work with. It should be four y/n
|
| 70 |
|
|
characters, like 'nynn' -- respectively, EMPTY (unchecked),
|
| 71 |
|
|
NODSL, BASIC, and ULTRA. For --kml, 'nyyy' or 'nynn' are useful.
|
| 72 |
|
|
For --stats, use 'yyyy'.
|
| 73 |
|
|
sparsity
|
| 74 |
|
|
is the minimum difference between civic numbers on a road to
|
| 75 |
|
|
work with. A sparsity of 10 would get #500, not #509, #510, and
|
| 76 |
|
|
#550. The first address on each road will always be used. To get
|
| 77 |
|
|
every address, use 1. This should be 1 for --stats, but for
|
| 78 |
|
|
--kml you'll probably want something lower, like 40.
|
| 79 |
|
|
noCities
|
| 80 |
|
|
is a y/n character specifying whether to exclude the two cities.
|
| 81 |
|
|
I'd usually use 'n'.
|
| 82 |
|
|
outputKML
|
| 83 |
|
|
is the filename to write the KML to.
|
| 84 |
|
|
Examples:
|
| 85 |
|
|
python fib-dbutil.py database.sqlite --stats yyyy 1 n
|
| 86 |
|
|
python fib-dbutil.py database.sqlite --list nynn 1000 n
|
| 87 |
|
|
python fib-dbutil.py database.sqlite --kml nyyy 40 n map.kml
|
| 88 |
|
|
|
| 89 |
|
|
|
| 90 |
|
|
All commands require all of their "options."
|
| 91 |
|
|
The next major version will be integrated into one command, fib.py, which will
|
| 92 |
|
|
offer actual options, using the optparse module, in addition to offering more
|
| 93 |
|
|
options and an automated mode.
|
| 94 |
18 |
art |
|
| 95 |
|
|
Next Major Version -- so far
|
| 96 |
|
|
fib.py
|
| 97 |
|
|
Usage: python fib.py (COMMAND) [ OPTIONS ]
|
| 98 |
|
|
where
|
| 99 |
|
|
COMMAND
|
| 100 |
|
|
is required, and is ONE of
|
| 101 |
|
|
-h, --help show this help message and exit
|
| 102 |
|
|
--all do everything -- get civic addresses, run bot, and produce KMLs
|
| 103 |
|
|
--newdb download civic addresses and make a new, empty database
|
| 104 |
|
|
--crawl query the Bell Aliant server, finding DSL statuses
|
| 105 |
|
|
--kml generate a KML overlay from a database
|
| 106 |
|
|
--stats print the totals of each DSL status
|
| 107 |
|
|
--list print every selected address
|
| 108 |
|
|
However, only --help, --kml, --stats, and --list work now.
|
| 109 |
|
|
OPTIONS
|
| 110 |
|
|
are optional, at last, and can include
|
| 111 |
|
|
-h, --help show this help message and exit
|
| 112 |
|
|
--db=FILE SQlite database file to work with. Default:
|
| 113 |
|
|
database.sqlite
|
| 114 |
|
|
--dslmask=MASK DSL types to process; y/n for each of EMPTY, NODSL,
|
| 115 |
|
|
BASIC, & ULTRA. Overrides defaults: crawl=ynnn,
|
| 116 |
|
|
stats=yyyy, kml=nyyy
|
| 117 |
|
|
--sparsity=INT minimum difference in civic numbers along a road to
|
| 118 |
|
|
process. Overrides defaults: crawl=1, stats=1, kml=40
|
| 119 |
|
|
--nocities don't process addresses in Charlottetown or Summerside
|
| 120 |
|
|
--max process more addresses when using a >1 sparsity.
|
| 121 |
|
|
--always-get=HOUSE ignoring sparsity, which address on the end of a road
|
| 122 |
|
|
to always get. Values: 'none', 'first' (default),
|
| 123 |
|
|
'last', 'both'.
|
| 124 |
|
|
--sql-where=SQL custom SQL SELECT conditions. Inserted directly after
|
| 125 |
|
|
WHERE. Be careful!
|
| 126 |
|
|
--coord-rect=latA,longA,latB,longB
|
| 127 |
|
|
latitude/longitude coordinates limiting processing to
|
| 128 |
|
|
addresses within the rectangle
|
| 129 |
|
|
--tsv=TSV-FILE TSV database of civic addresses to add to SQlite
|
| 130 |
|
|
database. Can appear multiple times.
|
| 131 |
|
|
--override-robot-exclusion-standard
|
| 132 |
|
|
override a robots.txt, instead of asking
|
| 133 |
|
|
--quiet-fail don't ask about a robots.txt -- just exit
|
| 134 |
|
|
--delay=SECONDS time to sleep between single-threaded requests to Bell
|
| 135 |
|
|
Aliant server. Can be float. Default: 1.0
|
| 136 |
|
|
--no-connect Don't reconnect HTTP connection between requests.
|
| 137 |
|
|
Experimental, will probably fail.
|
| 138 |
|
|
--useragent=NAME user-agent for the bot to represent itself with.
|
| 139 |
|
|
Default: forgottenislanderbot
|
| 140 |
|
|
--pause-every=QUERIES
|
| 141 |
|
|
number of requests to run between database-commit /
|
| 142 |
|
|
kill-opportunity sleep
|
| 143 |
|
|
--pause-time=SECONDS time to sleep at an intermittent pause
|
| 144 |
|
|
--map=KMLFILE file to write KML to. Will be overwritten. Default:
|
| 145 |
|
|
dslmap.kml
|
| 146 |
|
|
--globe=[GE|NWW] virtual-globe to optimize KML for
|
| 147 |
|
|
--civic-addresses-in-kml
|
| 148 |
|
|
Label icons in KML by civic address. May raise privacy
|
| 149 |
|
|
concerns, file size, lag.
|
| 150 |
|
|
--no-highlight Disable highlightable icons in KML. Experimental.
|
| 151 |
|
|
--kmz Make a compressed KMZ from the KML.
|
| 152 |
|
|
--iconsize=FLOAT Size of KML icons. Default: 1.0
|
| 153 |
|
|
--icontheme=[NAME|ante*post.png]
|
| 154 |
|
|
Icons to use in KML. Either builtin, like 'GM', or
|
| 155 |
|
|
external, like 'dsl-*.png', where '*' comprises
|
| 156 |
|
|
'ERROR', 'EMPTY', 'NODSL', 'BASIC', and 'ULTRA', in
|
| 157 |
|
|
separate files. It can also be a URL.
|
| 158 |
|
|
--iconhotspot=x,y Pixel coords in an icon where it is aligned over the
|
| 159 |
|
|
lat/long coords.
|
| 160 |
|
|
--iconcolours=LIST Colours to tint KML icons, as comma-separated list of
|
| 161 |
|
|
five colours like 'bf0000ff', in 'AABBGGRR' format.
|
| 162 |
|
|
--pipeable Changes stdout flushing behavior. May cause problems
|
| 163 |
|
|
on some systems. Not implemented.
|
| 164 |
|
|
--verbose Prints additional information. Not implemented.
|
| 165 |
|
|
--debug Prints massive amounts of debug information.
|
| 166 |
|
|
Implemented as necessary.
|
| 167 |
|
|
the only ones that work, of course, are the ones which control
|
| 168 |
|
|
--kml, --stats, and --list
|