chiark / gitweb /
Rename main program from ypp-commodities to yarrg
[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
46 Things you need to know:
47
48  * Please don't leave it running if you're not in charge.  If everyone
49    runs yoweb-scrape all the time it will produce precisely the load
50    on the yoweb servers that we want to avoid.
51
52  * You must enable the YPP client chat log.  It is disabled by
53    default.  This can be found in the client in the options panel
54    under `Ye'.  Contrary to what the client UI seems to suggest, the
55    filename you specify there is not used directly: information about
56    your pirate name and ocean are added by the client, which is good
57    because yoweb-scrape can dig it out again.
58
59  * If you leave and then reboard a vessel, the list of pirates on
60    board may be wrong.  This is because the chat log doesn't contain
61    information about who's on board the ship when you reboard it.
62
63    yoweb-scrape assumes that, unless it is told otherwise (or notices
64    for itself), the set of pirates on board doesn't change while
65    you're off the ship (unless you're away for more than an hour, in
66    which case it assumes the ship is empty when you return to it).
67
68    You can tell it otherwise with specially formatted chat messages.
69    Messages sent or received to officer chat, and messages sent (not
70    received) in private message, are scanned for special `commands' to
71    yoweb-scrape.  (So you can have an officer on board the ship keep
72    your yoweb-scrape up to date if you like.)
73    
74    The commands are of the following format:
75          /a <pirate>...                 /d <pirate>...
76          /a <ship-spec>: <pirate>...    /d <ship-spec>: <pirate>...
77
78    <ship-spec> can be the full name of the ship, or or only the second
79    word (the noun).  It can also be a pattern, where `*' matches any
80    (nonempty) series of characters including spaces, and which counts
81    if it matches either the whole ship name or just the noun.
82
83    For example:
84          /a haddock: aiah
85          /d aiah
86          /a smart sunfish: copperkatie
87          /a s* sunfish: anaplian
88    These are actually sent by typing in the chat box things like:
89          /o /d plonker
90          /off /a hypiscles
91    since other formulations interpret the scraper command as a YPP
92    chat command.  This is deliberate and makes it harder to invoke by
93    mistake.
94
95    If you don't specify a ship, it will assume that it's the ship that
96    you (or the officer speaking) are on board.  (For full details of
97    the matching algorithm, see below.)  If more than one ship is being
98    managed with yoweb-scrape, any user who wishes to issue these
99    commands should say:
100          /a relevant fish: executiveofficer
101    so that everyone else's yoweb-scrape knows which ship they're on
102    and thus which ship their /a commands refer to.
103
104  * For the ship duty puzzle display, and for sorting pirates by
105    skill, we take the best of Sailing and Rigging.
106
107 Other things to mention:
108
109  * There are some things which don't reliably appear in the chat log,
110    for example: when you disembark, and when a pirate leaves a duty
111    station.  That can mean that yoweb-scrape isn't always as up to
112    date as you would like.  You'll just have to tell it manually.
113
114  * The `tabulate details of my whole crew' mode takes a long time
115    to run.  This is normal; it's trying to spread the load on yoweb
116    (perhaps excessively so).
117
118  * I haven't decided on a final copyright licence.  You may treat this
119    version as GPLv3.
120
121  * The program will become confused when the clocks change,
122    particularly when they go backwards.  This is due to the chat log
123    containing timestamps in local time without a timezone.  If this
124    bothers you, make everything be in UTC.  If it does get confused,
125    you can fix it by logging off and logging on again (perhaps waiting
126    until after the duplicated hour has passed) as that writes a new
127    date record to the log and starts a new series of timestamps.
128
129  * It's Python so it may eat CPU and memory.
130
131  * You may need to install some python modules.  BeautifulSoup (yes,
132    really!) is in the Debian package  python-beautifulsoup
133
134
135 Some more details about tracking semantics:
136
137  * The program will notice that a pirate is on board if you give them
138    a stationing order or they abandon a duty station (in circumstances
139    where the game reports this in the log, which doesn't seem to be
140    all the time), and from many of the other messages that occur.
141
142  * Matching for ship patterns in /a and /d commands picks the first
143    of the following which applies and is not contradicted by any
144    name or partial name specified in the command:
145       - The ship we think the person telling us is on board
146       - The ship we think we are on board
147       - Any other ship we know about, if at least a something was
148          specified, and provided that is not ambiguous
149       - The specific ship name if it is completely specified,
150          possibly recording this as a new ship
151    <pirate> and <ship> can be in any case and will be converted to
152    the proper mixed-case form automatically.