chiark / gitweb /
WIP db populate; compute shortest paths in Perl (takes 1.5s on liberator)
[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   - upload the results to PCTB
8
9 To build, install the dependencies, cd to this directory and type `make'.
10
11 To screenscrape and upload to the PCTB server, select `trade
12 commodities' from the hold of a vessel or building, and run:
13    ./ypp-commodities
14 Currently we use pctb.ilk.org, the testing instance of the PCTB
15 database, pending approval from the operators of the main server.
16
17 Or, for example, for a tab-separated values dump:
18    ./ypp-commodities --tsv >commods.tsv
19
20 While it is capturing the screenshots, do not move the mouse or use
21 the keyboard.  Keyboard focus must stay in the YPP client window.
22 If you use Gnome or KDE you must raise the YPP client window so that
23 it is completely unobscured - the ypp-commodities program tries to do
24 this but metacity and kwin do not honour the request.
25
26
27 Command-line options
28 --------------------
29
30 Setting the operation mode:
31   --find-window-only       Just check that we can find the YPP client window.
32   --screenshot-only        Page through and take screenshots, do not OCR
33   --analyse-only | --same  Process previously taken screenshots
34   --everything (default)   Take screenshots and process them
35
36 Options to vary the processing:
37   --single-page         One screenful, no paging - results will be incomplete
38   --quiet               Suppress progress messages
39   --screenshot-file F   Store or read screenshots in F rather than _pages.ppm
40   --window-id ID        Specified X window is the YPP client - do not search
41   --edit-charset        Enable character set editing.  See README.dictionary.
42   --no-edit-charset     Do not edit charset even if _local-char*.txt exists.
43   --find-island         Find and print the ocean and island.  Suppresses OCR
44                          and output unless used with result processing option.
45   --test-servers        Set default servers to be the test servers, not
46                          the real live ones (doesn't affect explicit settings).
47
48 Controlling what happens to the results - only one at a time:
49   --upload (default) Upload to the PCTB server
50   --tsv              Print data as clean tab-separated-values file
51   --raw-tsv          Dump the raw (not deduped, unsorted) OCR'd data
52   --best-prices      Print best buy and sell price for each commodity
53   --arbitrage        Print arbitrage opportunities
54
55 Privacy options, which control conversations with the dictionary server:
56   --dict-local-only  *  Do not talk to the server even to fetch new dictionary.
57   --dict-read-only   *  Only fetch new dictionary, do not submit new entries.
58   --dict-anon           Don't quote pirate name if submitting entries.
59   --dict-submit         Submit entries quoting my pirate name.  (default)
60 Please do not use options marked * with --upload.  See README.privacy.
61
62 Options to override which servers we talk to:
63   --pctb-server HOST|URL  Talk to the PCTB server at HOST or URL.
64   --dict-submit-url URL   Submit dictionary entries with HTTP POST under URL.
65   --dict-update-from SRC  Fetch updated master dictionary with rsync from SRC.
66 Or set the environment variables YPPSC_PCTB{_PCTB, _DICT_UPDATE, _DICT_SUBMIT}
67
68
69 Installation requirements
70 -------------------------
71
72 Your X server must be 24bpp (or better).
73
74 This program has quite a few dependencies:
75                                                         Package (Debian etch)
76
77  - For building, C compiler and build environment       build-essential
78  - pnm library, including dev files for building        libnetpbm10-dev
79  - pnm command line utilities for image manipulation    netpbm
80  - X11 libraries, including dev files for building      libx11-dev
81  - XTEST library, including dev files for building      libxtst-dev
82  - Perl-compatible regexp library, including dev files  libpcre3-dev
83  - Tk interpreter /usr/bin/wish                         tk8.4
84  - Perl module XML::Parser                              libxml-parser-perl
85  - Perl module JSON::Parser                             libjson-perl
86  - XTEST extension in the X server                      (part of X package)
87  - Perl interpreter and basic modules                   perl (usu.installed)
88
89 On other Linux distros the packages may have different names, but
90 these should be roughly right for Debian and its derivatives.  You can
91 install them with this rune:
92   sudo apt-get install build-essential libnetpbm10-dev netpbm libx11-dev libxtst-dev libpcre3-dev tk8.4 libxml-parser-perl libjson-perl
93
94
95 The supplied helper programs
96   dictionary-manager
97   commod-results-processor
98   database-info-fetch
99 must (currently) also be in the current working directory when you run
100 the main ypp-commodities program.
101
102 The data files (see README.files) are also left in the current working
103 directory.  There is notyet any feature to have the data files and
104 helpers be somewhere else.
105
106
107 Reporting problems
108 ------------------
109
110 If you need to report a bug, for example an inability to recognise,
111 please be sure to remember the exact error message and circumstances.
112 Also, for recognition problems there will probably be a very useful
113 screenshot file called `_pages.ppm'.  This is likely to be very large
114 so don't just email it to me, but if you can put it up on a webpage
115 for me to download that will help.  At least keep a copy of it.
116
117 If the problem is a failure to cope with some particular YPP client
118 display and is reproducible, try running:
119    ./ypp-commodities --raw-tsv --single-page
120 If this reproduces the problem, please email me the screenshot file
121 _pages.ppm, which will consist only of the single screen, plus the
122 error messasge.  I'll then be able to understand what's wrong,
123 hopefully.
124
125
126 Privacy
127 -------
128
129 The main purpose of this program is to connect to the PCTB server and
130 upload data.  It will do that if you run it with --upload.
131
132 This program will also, by default, talk to the dictionary server I
133 have set up: to download updated image dictionaries, and to upload new
134 dictionary entries which you create with the PCTB client dictionary
135 GUI.  This feature is mentioned in and controllable in the GUI itself,
136 so it won't happen without you knowing about it.
137
138 The uploads will by default mention your ocean and pirate name; if you
139 don't want that, pass the --dict-anon option, or untick the box in the
140 GUI.
141
142 See README.privacy for full details.
143
144
145 Authorship and copyright
146 ------------------------
147
148 The PCTB server itself is a project of Joel Lord and various others.
149
150
151 However, this screenscraper and upload client was written entirely
152 from scratch by me, Ian Jackson.  It is part of ypp-sc-tools, a set of
153 third-party tools for assisting players of Yohoho Puzzle Pirates.
154
155 ypp-sc-tools is
156 Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
157
158 This program is free software: you can redistribute it and/or modify
159 it under the terms of the GNU General Public License as published by
160 the Free Software Foundation, either version 3 of the License, or
161 (at your option) any later version.
162
163 This program is distributed in the hope that it will be useful,
164 but WITHOUT ANY WARRANTY; without even the implied warranty of
165 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
166 GNU General Public License for more details.
167
168 You should have received a copy of the GNU General Public License
169 along with this program.  If not, see <http://www.gnu.org/licenses/>.
170
171 Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
172 are used without permission.  This program is not endorsed or
173 sponsored by Three Rings.
174
175
176 The character and UI images copied from the YPP client, and submitted
177 to stored and shared by the YPP SC PCTB dictionary server, are those
178 provided by Three Rings as part of the YPP client and by your Java
179 installation.  I regard the current use of these images in this way as
180 Fair Dealing (in the UK) or Fair Use (in the USA).
181
182 These images do not form part of the ypp-sc-tools distribution,
183 although the ypp-sc-tools pctb client does download them automatically
184 from my dictionary server when run in the most ordinary way.
185
186
187  - Ian Jackson
188    ijackson@chiark.greenend.org.uk
189    Aristarchus on the Midnight ocean