rremy
Joined: Oct 01, 2012
|
  Posted:
Jan 31, 2019 - 14:48 |
|
Hi,
Is it possible to download, for a given match, a log file describing all its actions ?
Thanks,
Remy |
|
|
SzieberthAdam
Joined: Aug 31, 2008
|
  Posted:
Jan 31, 2019 - 15:21 |
|
|
rremy
Joined: Oct 01, 2012
|
  Posted:
Jan 31, 2019 - 15:28 |
|
That's a good news, thanks. I presume that I can try to download some of my games but if I want to extract a lot of games, I have to contact you before ? |
|
|
SzieberthAdam
Joined: Aug 31, 2008
|
  Posted:
Jan 31, 2019 - 15:38 |
|
Note that the usage might not be trivial with that Python library. I will send you a PM later today about some hints.
Do not think about mass downloading unless you have the programming skills to make a script which does a sleep period between downloads. Plus you must avoid busy hours of the server and ask Christer before doing anything like that. |
_________________
|
|
koadah
Joined: Mar 30, 2005
|
  Posted:
Feb 08, 2019 - 22:39 |
|
|
finsterface
Joined: Apr 29, 2012
|
  Posted:
Feb 09, 2019 - 17:00 |
|
SzieberthAdam wrote: | Note that the usage might not be trivial with that Python library.
I will send you a PM later today about some hints. |
Hi,
I'm currently looking at this part of the fumbbl-api (for pulling match-replay-data),
as I would like to extract more details from matches (i.e. not just the results).
Unfortunately I couldn't get the Python library by Adam to work and I'm not into
Python at all, which is why debugging it is really cumbersome for me. Instead I
tried to extract the crucial info from that code and implement the same thing in
Java (where I'm much more at home) - still couldn't get this to work, though.
So maybe someone has actually been fiddling with this part of the api in Java as
well (or has enough knowledge in Java) and can help me out?
I'm attaching a rather short (almost minimal) piece of java-code, that shoul be
requesting the fumbbl-api for a specific match replay (the id is hard coded,
see below).
The code executes and produces the following output:
Code: |
Main: Instantiating FumbblTestClient...
2019-02-09 16:49:25.849:INFO::main: Logging initialized @428ms to org.eclipse.jetty.util.log.StdErrLog
==> METHOD_INVOKED: onOpen. (Connection successfully opened)
Main: done.
Main: Sending msg = { 'netCommandId': 'clientReplay', 'gameId': 1132196, 'replayToCommandNr': 0 }
Main: done.
|
...so it's executing without Exceptions being thrown and actually opens a
Connection to fumbbl through the given URI, but is never able to receive
any msg from the fumbbl-api...
Java-Class FumbblTestClient (including main-method)
Code: |
import java.io.IOException;
import java.net.URI;
import javax.websocket.ClientEndpoint;
import javax.websocket.ContainerProvider;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
import javax.websocket.DeploymentException;
@ClientEndpoint
public class FumbblTestClient {
private static final String uriStr = "ws://fumbbl.com:22223/command";
private Session session;
public static void main(String[] args) {
System.out.println("Main: Instantiating FumbblTestClient...");
FumbblTestClient client = new FumbblTestClient();
System.out.println("Main: done.");
String msg = "{ 'netCommandId': 'clientReplay', 'gameId': 1132196, 'replayToCommandNr': 0 }";
System.out.println("Main: Sending msg = " + msg);
client.sendMessage(msg);
try { Thread.sleep(10000); }
catch(Exception e) { e.printStackTrace(); }
System.out.println("Main: done.");
}
public FumbblTestClient(){
try{
URI uri = new URI(uriStr);
WebSocketContainer container=ContainerProvider.getWebSocketContainer();
container.connectToServer(this,uri);
}
catch(DeploymentException de){
//de.printStackTrace();
System.out.println(" ERROR while trying to connect to Server...:");
System.out.println(" Message = " + de.getMessage());
System.out.println(" Cause = " + de.getCause().getMessage());
}
catch(Exception e){
e.printStackTrace();
}
}
@OnOpen
public void onOpen(Session session){
System.out.println("==> METHOD_INVOKED: onOpen. (Connection successfully opened)");
this.session=session;
}
@OnMessage
public void onMessage(String message, Session session){
System.out.println("==> METHOD_INVOKED: onMessage.");
System.out.println(message);
}
public void sendMessage(String message){
try {
session.getBasicRemote().sendText(message);
}
catch(IOException e) { e.printStackTrace(); }
}
}
|
|
|
|
Christer
Joined: Aug 02, 2003
|
This is a supremely terrible way of downloading replays. |
|
|
finsterface
Joined: Apr 29, 2012
|
  Posted:
Feb 09, 2019 - 23:19 |
|
Christer wrote: | This is a supremely terrible way of downloading replays. |
Edit: If it was downloading replays at all, I wouldn't mind so much, but I guess
you have some other method in mind? (was thinking about using some more high-level
library (like jax), when I achieved a basic understanding how exactly the api is working...
(Is it a REST over WebSockets design?) |
|
|
Christer
Joined: Aug 02, 2003
|
That interface is a direct connection to the FFB Server, and you'll need to pretend you're the FFB Client downloading a replay. |
|
|
finsterface
Joined: Apr 29, 2012
|
  Posted:
Feb 10, 2019 - 00:34 |
|
Christer wrote: | That interface is a direct connection to the FFB Server, and you'll need to pretend you're the FFB Client downloading a replay. |
Hmm, would it be possible to access the code of the FFB-Client?
Since I know that is Java, I would certainly be able to extract the relevant
code-snippets in question and that would save me some headaches. |
|
|
finsterface
Joined: Apr 29, 2012
|
  Posted:
Feb 10, 2019 - 14:35 |
|
My motivation is to generate more detailed infos about matches for
fluff, like in this team-bio and also more (geeky) statistics that go
beyond what we have out of the box, already... |
|
|
SzieberthAdam
Joined: Aug 31, 2008
|
  Posted:
Feb 10, 2019 - 15:10 |
|
I recommend to get my code working somehow. It works for me, it works for rremy. Based on the exception you get I still suspect that it is something in your PC/network/router/firewall configuration. For the record, it is thrown by the first send message and is a
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1000 (OK), no reason |
_________________
|
|
finsterface
Joined: Apr 29, 2012
|
  Posted:
Feb 10, 2019 - 17:59 |
|
SzieberthAdam wrote: | I recommend to get my code working somehow. It works for me, it works for rremy. Based on the exception you get I still suspect that it is something in your PC/network/router/firewall configuration. For the record, it is thrown by the first send message and is a
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1000 (OK), no reason |
Thx for your effort (here on the forum and also with providing more info as to
how to approach making it work via PMs). As much as I'd like to get that
Python-code working, I'd still be planning to transfer the code / my understanding
of it to Java as that's where I'm familiar and already have tons of tools for generating
BB-Code / doing statistics, etc. Also, ever since Christer said that this part
of the api is just what the FFB-Client is doing, I doubt, that it's a general
network-setting, as then, it shouldn't work with the client as well (wich works
perfectly on the same laptop). So possibly it's a network-setting, which is only
related to my Python-interpreter and not my Java-VM, but then it shouldn't be a
problem in Java, which it is (though, ofc, I can't be sure it's the *same* problem).
As far as that particular error-msg (connection closed / no particular reason) is
concerned: I don't have a clue about what I could derive from that.
Edit: I already do not have a firewall nor antivirus on my computer... |
|
|
finsterface
Joined: Apr 29, 2012
|
  Posted:
Feb 11, 2019 - 09:50 |
|
Ok, I resolved it and got it working, thx for you people giving hints!
...well, what's working atm is getting the replay-json - now I can figure out how
to parse it and extract the information I am looking for
Christer wrote: | That interface is a direct connection to the FFB Server, and you'll need to pretend you're the FFB Client downloading a replay. |
...this was the critial piece of information, as I have now just decompiled the
ffb-client and found all the crucial information (and much more) in that .jar. |
|
|
|