5 - screenscrape the commodities trading screen
6 - produce the results as a tab separated values file
7 - **TODO** upload the results to PCTB
9 To run it, change to this directory, type `make', and then:
10 ./ypp-commodities --tsv >commods.tsv
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.
16 It may put up a window asking about characters it does not understand.
17 It is important to get these inputs right or your client may
18 misrecognise text in future. You *must* read the documentation in
19 README.charset before answering these questions.
25 Setting the operation mode:
26 --find-window-only Just check that we can find the YPP client window.
27 --screenshot-only Page through and take screenshots, do not OCR
28 --analyse-only | --same Process previously taken screenshots
29 --everything (default) Take screenshots and process them
31 Options to vary the processing:
32 --single-page One screenful, no paging - results will be incomplete
33 --quiet Suppress progress messages
34 --screenshot-file F Store or read screenshots in F rather than #pages#.pnm
35 --window-id ID Specified X window is the YPP client - do not search
37 Controlling what happens to the results:
38 --upload (default) Upload to the PCTB server
39 --tsv Print data as clean tab-separated-values file
40 --raw-tsv Dump the raw (not deduped, unsorted) OCR'd data
41 --best-prices Print best buy and sell price for each commodity
42 --arbitrage Print arbitrage opportunities
45 Files we use and update
46 -----------------------
48 The program reads and writes the following files:
52 Contains one or more images (as raw ppms, end-to-end) which are the
53 screenshots taken in the last run. This is (over)written whenever
54 we take screenshots from the YPP client. You can reprocess an
55 existing set of screenshots with the --same (aka --analyse-only)
56 option; in that case we just read the screenshots file.
58 You can specify a different file with --screenshot-file.
60 If you want to display the contents of this file, `display' can do
61 it. Don't try `display vid:#pages#.pnm' as this will consume
62 truly stupendous quantities of RAM - it wedged my laptop.
66 Character set database. For the semantics of the contents of this
67 file see README.charset. There is not currently any accurate
68 documentation of this database format.
70 If you delete this file you'll have to re-enter a lot of glyph data
71 (and probably get it wrong and make the program misrecognise
72 things). If you want to undo any mistakes you may have made
73 answering OCR questions you can safely revert this to the version
78 Map from commodity names to the numbers required by the PCTB
79 server. This is fetched and updated automatically as necessary.
80 It can safely be deleted as it will then be refetched.
84 When any of these tools overwrite one of the persistent database
85 files, they temporarily write to <file>.new.
87 These files are all in the current working directory. There is not
88 yet any feature to have them be somewhere else. The helper programs
90 yppsc-commod-processor
91 must (currently) also be in the current directory.
93 Future versions may have more helpers and more data files.
96 Installation requirements
97 -------------------------
99 This program has quite a few dependencies:
100 Package (Debian etch)
102 - For building, C compiler and build environment build-essential
103 - pnm library, including dev files for building libnetpbm10-dev
104 - pnm command line utilities for image manipulation netpbm
105 - X11 libraries, including dev files for building libx11-dev
106 - XTEST library, including dev files for building libxtst-dev
107 - Tk interpreter /usr/bin/wish tk8.4
108 - Perl module XML::Parser libxml-parser-perl
109 - Perl module JSON::Parser libjson-perl
110 - XTEST extension in the X server (part of X package)
111 - Perl interpreter and basic modules perl (usu.installed)
113 On other Linux distros the packages may have different names, but
114 these should be roughly right for Debian and its derivatives.
120 If you need to report a bug, for example an inability to recognise,
121 please be sure to remember the exact error message and circumstances.
122 Also, for recognition problems there will probably be a very useful
123 screenshot file called `#pages#.pnm'. This is likely to be very large
124 so don't just email it to me, but if you can put it up on a webpage
125 for me to download that will help. At least keep a copy of it.
127 If the problem is a failure to cope with some particular YPP client
128 display and is reproducible, try running:
129 ./ypp-commodities --raw-tsv --single-page
130 If this reproduces the problem, please email me the screenshot file
131 #pages#.pnm, which will consist only of the single screen, plus the
132 error messasge. I'll then be able to understand what's wrong,
136 Phoning home - privacy
137 ----------------------
139 The main purpose of this program is to connect to the PCTB server and
140 upload data. The program does not currently phone home at all in
141 modes other than --upload, and when it does it connects to the
142 PCTB server not to a system of mine.
144 However, there are some improvements which I may introduce in the
145 future which may change this. I am considering:
147 * Having the ocr character resolver talk to a server run by me
148 to look for missing glpyhs, and/or upload those glyphs back
149 to that server so that they can be shared.
151 * Having the upload client upload a copy of the data to a server run
152 by me, when run in --upload mode.
154 If I do do this these new functions may be enabled by default, but it
155 will be possible to turn them off, or direct them to different
156 servers, with command-line options, and they will be documented here.
160 ijackson@chiark.greenend.org.uk
161 Aristarchus on the Midnight ocean