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