chiark / gitweb /
Reflect new filenames in README
[ypp-sc-tools.db-test.git] / pctb / README
1 Overview
2 --------
3
4 This tool can:
5   - screenscrape the commodities trading screen
6   - produce the results as a tab separated values file
7   - **TODO** upload the results to PCTB
8
9 To run it, change to this directory, type `make', and then:
10   ./ypp-commodities --tsv >commods.tsv
11
12 While it is capturing the screenshots, do not move the mouse or use
13 the keyboard.  Keyboard focus must stay in the YPP client window.
14
15 You will probably need to turn off `Use antialiased font' in the YPP
16 client.  This is in the Ye panel, Options, tab `General'.
17
18 Command-line options
19 --------------------
20
21 Setting the operation mode:
22   --find-window-only       Just check that we can find the YPP client window.
23   --screenshot-only        Page through and take screenshots, do not OCR
24   --analyse-only | --same  Process previously taken screenshots
25   --everything (default)   Take screenshots and process them
26
27 Options to vary the processing:
28   --single-page         One screenful, no paging - results will be incomplete
29   --quiet               Suppress progress messages
30   --screenshot-file F   Store or read screenshots in F rather than #pages#.pnm
31   --window-id ID        Specified X window is the YPP client - do not search
32   --edit-charset        Enable character set editing.  See README.dictionary.
33   --find-island         Find and print the ocean and island.  Suppresses OCR
34                          and output unless used with result processing option.
35   --test-servers        Set default servers to be the test servers, not
36                          the real live ones (doesn't affect explicit settings).
37
38 Controlling what happens to the results - only one at a time:
39   --upload (default) Upload to the PCTB server
40   --tsv              Print data as clean tab-separated-values file
41   --raw-tsv          Dump the raw (not deduped, unsorted) OCR'd data
42   --best-prices      Print best buy and sell price for each commodity
43   --arbitrage        Print arbitrage opportunities
44
45 Privacy options, which control conversations with the dictionary server:
46   --dict-local-only  *  Do not talk to the server even to fetch new dictionary.
47   --dict-read-only   *  Only fetch new dictionary, do not submit new entries.
48   --dict-anon           Don't quote pirate name if submitting entries.
49   --dict-submit         Submit entries quoting my pirate name.  (default)
50 Please do not use options marked * with --upload.  See README.privacy.
51
52 Options to override which servers we talk to:
53   --pctb-server HOST|URL  Talk to the PCTB server at HOST or URL.
54   --dict-submit-url URL   Submit dictionary entries with HTTP POST under URL.
55   --dict-update-from SRC  Fetch updated master dictionary with rsync from SRC.
56 Or set the environment variables YPPSC_PCTB{_PCTB, _DICT_UPDATE, _DICT_SUBMIT}
57
58
59 Files we use and update
60 -----------------------
61
62 The program reads and writes the following files:
63
64  * #pages#.pnm
65
66    Contains one or more images (as raw ppms, end-to-end) which are the
67    screenshots taken in the last run.  This is (over)written whenever
68    we take screenshots from the YPP client.  You can reprocess an
69    existing set of screenshots with the --same (aka --analyse-only)
70    option; in that case we just read the screenshots file.
71
72    You can specify a different file with --screenshot-file.
73
74    If you want to display the contents of this file, `display' can do
75    it.  Don't try `display vid:#pages#.pnm' as this will consume
76    truly stupendous quantities of RAM - it wedged my laptop.
77
78  * #master-char*#.txt  #local-char*#.txt
79    #master-pixmap#.txt #local-pixmap#.txt
80
81    Character set and image dictionaries.  For the semantics of the
82    char* files README.charset.  There is not currently any accurate
83    documentation of this dictionary format.
84
85    #master-*#.txt contain the centrally defined and approved data.
86    They are downloaded automatically from the SC PCTB server and
87    updated each run.  You can safely delete this file, if everything
88    is online, if you want to fetch a fresh copy.
89
90    #local-*#.txt are a local copy of your submissions, so that they
91    will be used by your client pending approval by me.  You can delete
92    this file if you think you may have made a mistake.
93
94    See README.privacy for details of the communications with the SC
95    server about the contents of these dictionaries.
96
97  * #commodmap#.tsv
98
99    Map from commodity names to the numbers required by the PCTB
100    server.  This is fetched and updated automatically as necessary.
101    It can safely be deleted as it will then be refetched.
102
103  * <file>.new
104
105    When any of these tools overwrite one of the persistent dictionary
106    files, they temporarily write to <file>.new.
107
108 These files are all in the current working directory.  There is not
109 yet any feature to have them be somewhere else.  The helper programs
110   dictionary-manager
111   commod-results-processor
112 must (currently) also be in the current directory.
113
114 Future versions may have more helpers and more data files.
115
116
117 Installation requirements
118 -------------------------
119
120 This program has quite a few dependencies:
121                                                         Package (Debian etch)
122
123  - For building, C compiler and build environment       build-essential
124  - pnm library, including dev files for building        libnetpbm10-dev
125  - pnm command line utilities for image manipulation    netpbm
126  - X11 libraries, including dev files for building      libx11-dev
127  - XTEST library, including dev files for building      libxtst-dev
128  - Perl-compatible regexp library, including dev files  libpcre3-dev
129  - Tk interpreter /usr/bin/wish                         tk8.4
130  - Perl module XML::Parser                              libxml-parser-perl
131  - Perl module JSON::Parser                             libjson-perl
132  - XTEST extension in the X server                      (part of X package)
133  - Perl interpreter and basic modules                   perl (usu.installed)
134
135 On other Linux distros the packages may have different names, but
136 these should be roughly right for Debian and its derivatives.
137
138
139 Reporting problems
140 ------------------
141
142 If you need to report a bug, for example an inability to recognise,
143 please be sure to remember the exact error message and circumstances.
144 Also, for recognition problems there will probably be a very useful
145 screenshot file called `#pages#.pnm'.  This is likely to be very large
146 so don't just email it to me, but if you can put it up on a webpage
147 for me to download that will help.  At least keep a copy of it.
148
149 If the problem is a failure to cope with some particular YPP client
150 display and is reproducible, try running:
151    ./ypp-commodities --raw-tsv --single-page
152 If this reproduces the problem, please email me the screenshot file
153 #pages#.pnm, which will consist only of the single screen, plus the
154 error messasge.  I'll then be able to understand what's wrong,
155 hopefully.
156
157
158 Privacy
159 -------
160
161 The main purpose of this program is to connect to the PCTB server and
162 upload data.  It will do that if you run it with --upload.
163
164 This program will also, by default, talk to the dictionary server I
165 have set up: to download updated image dictionaries, and to upload new
166 dictionary entries which you create with the PCTB client dictionary
167 GUI.  This feature is mentioned in and controllable in the GUI itself,
168 so it won't happen without you knowing about it.
169
170 The uploads will by default mention your ocean and pirate name; if you
171 don't want that, pass the --dict-anon option, or untick the box in the
172 GUI.
173
174 See README.privacy for full details.
175
176
177
178  - Ian Jackson
179    ijackson@chiark.greenend.org.uk
180    Aristarchus on the Midnight ocean