43 coaches online • Server time: 18:27
Index Search Usergroups Profile
Log in
Recent Forum Topics goto Post kill, apo, killgoto Post Blocking in turn 16goto Post Any Elves but Wood? ...
SearchSearch 
Post new topic   Reply to topic
View previous topic Log in to check your private messages View next topic
rremy



Joined: Oct 01, 2012

Post   Posted: Jan 31, 2019 - 14:48 Reply with quote Back to top

Hi,

Is it possible to download, for a given match, a log file describing all its actions ?

Thanks,

Remy
SzieberthAdam



Joined: Aug 31, 2008

Post   Posted: Jan 31, 2019 - 15:21 Reply with quote Back to top

Yes.

https://github.com/FUMBBLPlus/fumbblreplay

_________________
"I love him who is ashamed when the dice fall in his favour, and who then asketh: 'Am I a dishonest player?' - for he is willing to succumb."
-- Friedrich Nietzsche: Thus Spake Zarathustra, Zarathustra's Discourses, 4.
rremy



Joined: Oct 01, 2012

Post   Posted: Jan 31, 2019 - 15:28 Reply with quote Back to top

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

Post   Posted: Jan 31, 2019 - 15:38 Reply with quote Back to top

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.

_________________
"I love him who is ashamed when the dice fall in his favour, and who then asketh: 'Am I a dishonest player?' - for he is willing to succumb."
-- Friedrich Nietzsche: Thus Spake Zarathustra, Zarathustra's Discourses, 4.
koadah



Joined: Mar 30, 2005

Post   Posted: Feb 08, 2019 - 22:39 Reply with quote Back to top

SzieberthAdam wrote:

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.


Ah, so you're the guy. Twisted Evil

_________________
Image
[SL] Rookie Rumble - Brand new teams - 100+ Races - Always recruiting
finsterface



Joined: Apr 29, 2012

Post   Posted: Feb 09, 2019 - 17:00 Reply with quote Back to top

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... Crying or Very sad

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

Post   Posted: Feb 09, 2019 - 21:20
FUMBBL Staff
Reply with quote Back to top

This is a supremely terrible way of downloading replays.
finsterface



Joined: Apr 29, 2012

Post   Posted: Feb 09, 2019 - 23:19 Reply with quote Back to top

Christer wrote:
This is a supremely terrible way of downloading replays.


Embarassed

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

Post   Posted: Feb 10, 2019 - 00:23
FUMBBL Staff
Reply with quote Back to top

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

Post   Posted: Feb 10, 2019 - 00:34 Reply with quote Back to top

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. Razz
finsterface



Joined: Apr 29, 2012

Post   Posted: Feb 10, 2019 - 14:35 Reply with quote Back to top

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

Post   Posted: Feb 10, 2019 - 15:10 Reply with quote Back to top

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

_________________
"I love him who is ashamed when the dice fall in his favour, and who then asketh: 'Am I a dishonest player?' - for he is willing to succumb."
-- Friedrich Nietzsche: Thus Spake Zarathustra, Zarathustra's Discourses, 4.
finsterface



Joined: Apr 29, 2012

Post   Posted: Feb 10, 2019 - 17:59 Reply with quote Back to top

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). Laughing

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. Confused

Edit: I already do not have a firewall nor antivirus on my computer...
finsterface



Joined: Apr 29, 2012

Post   Posted: Feb 11, 2019 - 09:50 Reply with quote Back to top

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 Razz

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.
Display posts from previous:     
 Jump to:   
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Log in to check your private messages View next topic