chiark / gitweb /
Merge remote-tracking branch 'mason/master'
[ypp-sc-tools.web-live.git] / yoweb-scrape.txt
1                 yoweb-scrape
2                 ------------
3
4 This program can:
5   * Fetch information for crew and pirates from yoweb
6   * Display tables of puzzle standings
7   * Keep track of who is on board a vessel
8
9 Putting this all together, it can be used to show a table of who's
10 good at what when you're running a pillage.
11
12 You run it roughly like this:
13   ./yoweb-scrape ship-aid ~/yohoho/Aristarchus_midnight_chat-log-iwj 
14 It has various other modes - see the usage message.
15
16
17 Key features:
18
19  * Tracks boarding and departure of pirates and shows a table
20    of currently-aboard pirates with their relevant puzzle standings in
21    a compressed format.
22
23  * Shows time and nature their last interaction with you as XO
24    (abandoning stations, being given orders) and where and when their
25    last to-you-visible chat was.
26
27  * Remembers whether you have ever given the pirate an order to gun
28    since they boarded.
29
30  * Caches and severely rate-limits fetches from yoweb to avoid
31    overloading the Three Rings servers.  In ship-aid mode, will
32    display twirling batons while you wait for data, so that crew
33    on board info remains correct.
34
35  * Can sort pirates by their skills in the key duty puzzles.  Press
36    a single keystroke to sort by:
37       s: sailing                   b: bilging
38       c: carpentry                 g: gunning
39       n: navigation (duty nav)     t: treasure haul
40       d: driving (battle nav)      a: sort by pirate name
41    It will prefer to list near the top pirates whose other skills
42    are weaker.  This functionality is disabled if stdin is not a tty.
43    Other keystrokes:
44       q: quit the program (^C works too)
45       /: start entering a local extra commands (see below)
46       +: start entering local extra commands starting "/a"
47       ESC: clear local extra command or abandon local extra commands entry
48
49 Things you need to know:
50
51  * Please don't leave it running if you're not in charge.  If everyone
52    runs yoweb-scrape all the time it will produce precisely the load
53    on the yoweb servers that we want to avoid.
54
55  * You must enable the YPP client chat log.  It is disabled by
56    default.  This can be found in the client in the options panel
57    under `Ye'.  Contrary to what the client UI seems to suggest, the
58    filename you specify there is not used directly: information about
59    your pirate name and ocean are added by the client, which is good
60    because yoweb-scrape can dig it out again.
61
62  * If you leave and then reboard a vessel, the list of pirates on
63    board may be wrong.  This is because the chat log doesn't contain
64    information about who's on board the ship when you reboard it.
65
66    yoweb-scrape assumes that, unless it is told otherwise (or notices
67    for itself), the set of pirates on board doesn't change while
68    you're off the ship (unless you're away for more than an hour, in
69    which case it assumes the ship is empty when you return to it).
70
71    You can tell it otherwise with specially formatted chat messages.
72    Messages sent or received to officer chat, and messages sent (not
73    received) in private message, are scanned for special `commands' to
74    yoweb-scrape.  (So you can have an officer on board the ship keep
75    your yoweb-scrape up to date if you like.)
76    
77    The commands are of the following format:
78          /a <pirate>...                 /d <pirate>...
79          /a <ship-spec>: <pirate>...    /d <ship-spec>: <pirate>...
80    And also:
81          /j <pirate>
82    which simulates "<pirate> applied for the posted job".
83
84    <ship-spec> can be the full name of the ship, or or only the second
85    word (the noun).  It can also be a pattern, where `*' matches any
86    (nonempty) series of characters including spaces, and which counts
87    if it matches either the whole ship name or just the noun.
88
89    For example:
90          /a haddock: aiah
91          /d aiah
92          /a smart sunfish: copperkatie
93          /a s* sunfish: anaplian
94    These are actually sent by typing in the chat box things like:
95          /o /d plonker
96          /off /a hypiscles
97    since other formulations interpret the scraper command as a YPP
98    chat command.  This is deliberate and makes it harder to invoke by
99    mistake.
100
101    If you don't specify a ship, it will assume that it's the ship that
102    you (or the officer speaking) are on board.  (For full details of
103    the matching algorithm, see below.)  If more than one ship is being
104    managed with yoweb-scrape, any user who wishes to issue these
105    commands should say:
106          /a relevant fish: executiveofficer
107    so that everyone else's yoweb-scrape knows which ship they're on
108    and thus which ship their /a commands refer to.
109
110  * For the ship duty puzzle display, and for sorting pirates by
111    skill, we take the best of Sailing and Rigging.
112
113 Other things to mention:
114
115  * There are some things which don't reliably appear in the chat log,
116    for example: when you disembark, and when a pirate leaves a duty
117    station.  That can mean that yoweb-scrape isn't always as up to
118    date as you would like.  You'll just have to tell it manually.
119
120  * The `tabulate details of my whole crew' mode takes a long time
121    to run.  This is normal; it's trying to spread the load on yoweb
122    (perhaps excessively so).
123
124  * I haven't decided on a final copyright licence.  You may treat this
125    version as GPLv3.
126
127  * The program will become confused when the clocks change,
128    particularly when they go backwards.  This is due to the chat log
129    containing timestamps in local time without a timezone.  If this
130    bothers you, make everything be in UTC.  If it does get confused,
131    you can fix it by logging off and logging on again (perhaps waiting
132    until after the duplicated hour has passed) as that writes a new
133    date record to the log and starts a new series of timestamps.
134
135  * It's Python so it may eat CPU and memory.
136
137  * You may need to install some python modules.  BeautifulSoup (yes,
138    really!) is in the Debian package  python-beautifulsoup
139
140
141 Some more details about tracking semantics:
142
143  * The program will notice that a pirate is on board if you give them
144    a stationing order or they abandon a duty station (in circumstances
145    where the game reports this in the log, which doesn't seem to be
146    all the time), and from many of the other messages that occur.
147
148  * Matching for ship patterns in /a and /d commands picks the first
149    of the following which applies and is not contradicted by any
150    name or partial name specified in the command:
151       - The ship we think the person telling us is on board
152       - The ship we think we are on board
153       - Any other ship we know about, if at least a something was
154          specified, and provided that is not ambiguous
155       - The specific ship name if it is completely specified,
156          possibly recording this as a new ship
157    <pirate> and <ship> can be in any case and will be converted to
158    the proper mixed-case form automatically.