[INFO] How To Open Replay Links

Discussion in 'Videos And Replays!' started by cptconundrum, May 1, 2014.

  1. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    @DeathByDenim @cola_colin I have chrome installed (the actuall chrome not chromium) but no cigar either.

    it does load the page and ask to open application but nothing happens.

    where can I configure what it does?
  2. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
  3. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    No, all a protocol handler should do is pass the bit after startpa:// to the program attached to the handler, i.e. PA. I don't have Chrome, but I'll do a more thorough study once I am home. You can always copy-paste the lobby ID's in PA itself in the mean time. :)
  4. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    thanks for the help!! don't give up on me :p
  5. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    Ok, I think I got it. This is the install script:
    Code:
    #!/bin/bash
    
    if [ x"$1" == x"" ]
    then
       echo "Give path to the PA executable as argument"
       exit 1
    fi
    
    echo "Using \"$1\" as the location of the PA executable"
    
    # Installing the mime-type, so that it actually exists.
    cat > /tmp/planetaryannihilation-startpa.xml <<EOF
    <?xml version="1.0"?>
    <mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="x-scheme-handler/startpa">
      <comment>Planetary Annihilaton Replay</comment>
      <generic-icon name="folder-html"/>
    </mime-type>
    EOF
    
    xdg-mime install /tmp/planetaryannihilation-startpa.xml
    
    rm /tmp/planetaryannihilation-startpa.xml
    
    
    # Installing the handler.
    cat > ~/.local/share/applications/startpa.desktop <<EOF
    [Desktop Entry]
    Type=Application
    Encoding=UTF-8
    Name=Planetary Annihilation Replay
    Exec="$1" --uioptions %u
    Terminal=false
    MimeType=x-scheme-handler/startpa
    NoDisplay=true
    EOF
    
    xdg-mime default startpa.desktop x-scheme-handler/startpa
    
    Save to a file, for example "install_startpa_handler.sh" and chmod +x it. (I've also attached it to this post)
    Usage:
    Code:
    ./install_startpa_handler.sh /this/is/the/PAdir/PA
    The argument is the location of the PA executable (not path!)

    The script will install the startpa protocol on the OS level, allowing Firefox to see it. No need to configure Firefox anymore apparently. You can throw away the install script afterwards by the way (unless you move PA somewhere else, then you need to rerun it obviously).

    @cptconundrum : Could you update the Linux instructions?

    Attached Files:

    cola_colin and tatsujb like this.
  6. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
  7. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    Hello,

    I installed PA through steam and got some errors like missing libraries at runtime using startpahandler.sh script.
    This is because steam requires LD_LIBRARY_PATH to be set correctly to use it's "own" libraries.

    Steam is providing a script that set the correct environment to run, here :
    /home/uggla/.local/share/Steam/ubuntu12_32/steam-runtime/run.sh (replace /home/uggla with your own home directory)

    So I customized a bit the startpahandler.sh scritpt, it looks like this now :

    Code:
    #!/bin/sh
    
    cd "/home/uggla/.local/share/Steam/ubuntu12_32/steam-runtime"
    
    # Note : $@ below is replaced by the replay url from PAstats
    ./run.sh "/home/uggla/data/steam/Planetary Annihilation/PA" $@
    

    Thanks to @DeathByDenim for the script / firefox instructions above.
  8. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    Hello,

    I'd like to not type my PA password to identify myself each time I want to watch a replay.
    So, is there a way to pass the password using a script or an auth token to PA ?
  9. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    There are multiple ways however all of them require you to store your password as plaintext somewhere. Basically the most simple thing is to modify the UI with your hardcoded login data and just directly call "login".
    If you do something like ./pa --help you also get some info on how to use an auth token when starting PA. However auth tokens tend to go invalid at some random point in time.
    To get a new token you can do this:

    Code:
    curl --data '{TitleId: 4, AuthMethod: "UberCredentials", UberName: "user", Password: "password"}' --header "Content-Type: application/json" https://uberent.com/GC/Authenticate
    returns something like:
    {"SessionTicket":"<sessionTicketHere>","UberName":"ubername","UberId":123,"DisplayName":"?","UberIdString":"123"}
    
    But that also will need you to have a script somewhere that knows your password. If you are fine with that then proceed.
    uggla88 likes this.
  10. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    Thanks cola_colin for the ultra fast answer !
    I will have a look and post if I manage to do what I want.

    Also a big thanks for all the work around the forum and PAStats ! :cool:
    cola_colin likes this.
  11. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    I did few tests with the above code. It works well to login with the provided token. This is great !
    Last edited: January 5, 2015
  12. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    Hello,

    Strange bug seems to raise with 79600 build, maybe a bit earlier ?
    PA failed to load the replays. It looks like the reason is the region not properly set. (was not the case before)

    PA process is spawn with this command line :
    /home/uggla/data/steam/Planetary Annihilation/PA --uioptions startpa://replay=6651824744993064260
    When I go to parameters, I can see this and I can't change it anymore.

    Capture d'écran de 2015-03-24 00:39:17.png

    Any idea how to correct this ?

    Best regards.
    René
  13. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    restart PA. I think that happens when it for whatever reason fails the initial "get region" calls. Maybe happens to me once every 500 times or so. Not sure if related to mods or not.
  14. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    Hello Cola_colin,

    Thanks for quick answer. Unfortunately not.
    Right now it happens all the time I try to show a replay.

    Starting the game without --uioptions startpa://replay=6651824744993064260 seems ok, region is set into parameters. (of course replay is not fired)

    But if I add the --uioptions startpa://replay=6651824744993064260 replay is fired and fails. Region parameter is not set as in the above screenshot. I guess it could be the issue.

    Best regards.
    René
  15. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    That is interesting. So PA starts, you login within PA and then it fails to get the regions?
    Random attempt whenever there are issues with ubernet webservices: try the ajax option that PA Stats offers under Settings > PA Stats > use ajax for ubernet stuff.

    If that does not help do you know how to open the UI debugger and have a look at it? Maybe it shows some errors.
  16. uggla88

    uggla88 New Member

    Messages:
    29
    Likes Received:
    14
    Hello @cola_colin

    Thanks for your answer as usually extremely fast.
    I apologize for the previous post, the issue was simply corrupted replays on my side.
    @DeathByDenim noticed that to me.


    Best regards.
    René.
  17. coldboot

    coldboot Active Member

    Messages:
    447
    Likes Received:
    112
    Is there a way to run the game with Steam.exe and pass through the command-line options for the replay ID?

    I couldn't find anything in the Steam documentation.
  18. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
  19. lulamae

    lulamae Planetary Moderator

    Messages:
    796
    Likes Received:
    307
    @DeathByDenim I've got the .sh file sitting on my windows desktop. would you describe how to install it with a bit more detail?

    And what's the difference between 'path' vs 'location'?

    Thanks
  20. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,327
    Likes Received:
    2,125
    Those instructions I posted were for Linux though. For Windows you'll need to follow the instructions from the very first post in this thread.

    (On the off-chance that you did mean to install it for Linux and to clarify for future readers, with "location" I meant the path + executable together. For example in my case it would be /home/username/Games/PA/stable/PA.)

Share This Page