-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.replay-upload
150 lines (119 loc) · 7.11 KB
/
README.replay-upload
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
HOWTO make SPADS upload replays of games to replays.springrts.com
=================================================================
SPADS supports automatic uploading of "Spring Demo Files" (*.sdf[z]) to the replays
website using an external Python script.
Software requirements:
----------------------
* SPADS version >= 0.10
* Spring engine version >= 89.0
* Python >= 2.6 (Windows users make sure the Python install directory is added
to your PATH variable.)
* optional: PycURL (for bandwidth throttling)
Python can be obtained from: http://python.org/download/
Debian/Ubuntu/Fedora/Arch: python
Gentoo: dev-lang/python:2.7
Windows: use binary package from homepage
PycURL can be obtained from: http://pycurl.sourceforge.net/
Debian/Ubuntu/Fedora/Arch: python-pycurl
Gentoo: dev-python/pycurl
Windows: compile from source or search binary packages (watch out for correct
OS version and 32/64 bit). Success was reported with package from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl
short version:
--------------
* log in once with a Spring account which will be the "owner" of the uploaded
replays: http://replays.springrts.com/#/
* update endGameCommand, endGameCommandEnv and endGameCommandMsgsettings in
spads.conf as follows (replace <owner> by the actual Spring account used in
previous step):
endGameCommand:python replay_upload.py -v -r %result -d %gameDuration "%type on %map" "autouploaded" "%type,%structure" "%demoFile" "<owner>"
endGameCommandEnv:XMLRPC_USER=%ahName;XMLRPC_PASSWORD=%ahPassword
endGameCommandMsg:(0)Demo file uploaded to http://replays.springrts.com/replay/%gameId|(1-9)Failed to upload demo file!
* if you wish to use another user account than the autohosts for authentication
to the replay site, you can use any other Spring account (replace %ahName and
%ahPassword previous step). If you choose to use a separate user account for
uploading, it must have at least some minutes of ingame time, or an automated
cleanup program will remove it after 3 month! So if you choose to use a
separate user account you must play or spectate at least one game with it!
As using two accounts make debugging problems more difficult it is
recommended to use the same account for uploading and the autohost, that is
%ahName / %ahPassword as in the exampole above.
* if you wish to use bandwidth throttling, read the section "Bandwidth throttling"
* restart SPADS
Usage (long version):
---------------------
Configure endGameCommand, endGameCommandEnv and endGameCommandMsgsettings in
spads.conf.
endGameCommand:python replay_upload.py -v -r %result -d %gameDuration "title" "comment" "tag1,tag2" "%demoFile" "owner"
endGameCommandEnv:XMLRPC_USER=%ahName;XMLRPC_PASSWORD=%ahPassword
endGameCommandMsg:(0)Demo file uploaded to http://replays.springrts.com/replay/%gameId/|(1-9)Failed to upload demo file!
This would upload the Spring Demo File with a title "title", a comment "comment",
add the tags "tag1" and "tag2" and make it owned by the Spring user "owner".
For authentication the autohosts account data would be used. If you do not wish
to use the autohosts credentials, create a Spring account and use its username
and password instead. Username and password are passed to the Python script as
environment variable, to hide them from the eyes of other users of the system.
The "owner" must have logged in at least once to the replays site, or the upload
will fail! http://replays.springrts.com/#/
The replays website saves a title, a comment, tags and an owner for each
uploaded replay. The owner can login to the site and edit the replays title,
comment and tags. Owner accounts are Spring accounts. Title, comment, tags and
owner name are passed to the Python script on the command line.
endGameCommandMsg prints different messages, depending on the exit code of the
upload script. SPADS logs the exit code. See section "Error codes" below for the
interpretation of the codes.
I suggest to test settings first on the command line, and if everything works as
expected, make them permanent in the configuration file.
Please run "python replay_upload.py -h" now, to see a help screen.
Set authentication parameters:
# export XMLRPC_USER="Dansan"
# export XMLRPC_PASSWORD="sEcReT"
Optionally use the testing site for upload (owner must login there first!):
# export XMLRPC_URL=http://replays-test.springrts.com/xmlrpc/
Run the upload:
# python replay_upload.py -v "awesome game" "checkout that dude in SE" "tag1,tag2,tag3" "/tmp/20130229_123456_RustyDelta_v2_88.sdf" "Danchan"
The game will be uploaded to the testing site: http://replays-test.springrts.com/
or an error message will be shown. The "-v" makes it display information and
errors. SPADS will not log any output of the upload script (only the exit code),
but textual output will be shown on stdout in a terminal.
In the configuration file you can use variables to describe the game better:
http://planetspads.free.fr/spads/doc/spadsDoc_All.html#set:endGameCommand
Example:
endGameCommand:python replay_upload.py -v -r %result -d %gameDuration "%type on %ahName" "autouploaded" "%type,%structure" "%demoFile" "[Your]Account"
endGameCommandEnv:XMLRPC_USER=%ahName;XMLRPC_PASSWORD=%ahPassword
endGameCommandMsg:(0)Demo file uploaded to http://replays.springrts.com/replay/%gameId/|(1-9)Failed to upload demo file!
Again, if you wish to test your settings before uploading to the replays site,
just use testing site by appending ";XMLRPC_URL=http://replays-test.springrts.com/xmlrpc/"
to endGameCommandEnv (mind the ";"):
endGameCommandEnv:XMLRPC_USER=%ahName;XMLRPC_PASSWORD=%ahPassword;XMLRPC_URL=http://replays-test.springrts.com/xmlrpc/
If you wish for games NOT to be uploaded that
* never started or
* were shorter than 3 minutes or
* !stop AND shorter than 6 minutes
you must use "-r %result -d %gameDuration" in endGameCommand as written above.
Restart SPADS.
Bandwidth throttling
--------------------
The cURL library is used for bandwidth throttling the transfer. You must install
its Python binding and a Python-module to use it as a replay-transpor:
* install PycURL (see section "Software requirements" for download/package)
* download pyCURLTransport.py, and put it into the same directory as replay_upload.py:
# wget https://raw.github.com/dansan/spring-replay-site/master/srs/contrib/pyCURLTransport.py
* add "-t num" to endGameCommand between "replay_upload.py -v" and "title":
endGameCommand:python replay_upload.py -t 204800 title comment tags "%demoFile" "owner"
* the number is bytes per second. To upload with 200 KB/s use "204800".
* restart SPADS
Error codes
-----------
0 no error, upload was a success
1 unknown, inactive or invalid *uploader* account
2 unknown or inactive *owner* account (remember to log in via web interface once)
3 replay already exists (same gameID)
4 server or network error
5 no error, but the match did not start or was shorter than 3 min. and thus the replay was not uploaded
6 could not read spring demo file from disk
Support
-------
Please report problems regarding replay upload to one of
* Github: https://github.com/dansan/spring-replay-site/issues
* Forum: https://springrts.com/phpbb/viewforum.php?f=88