thestr4ng3r / chiaki

Moved to https://git.sr.ht/~thestr4ng3r/chiaki - Free and Open Source PS4 Remote Play Client
https://git.sr.ht/~thestr4ng3r/chiaki
2.19k stars 369 forks source link

Improved CLI-Usage for direct streaming a device #346

Closed tuximail closed 3 years ago

tuximail commented 3 years ago

Disclaimer: This is the first time I wrote (that much) code for a C++/Qt project. It is possible that I didn't use the perfect ways to achieve all my goals. I am of cource open for feedback and willing to improve parts, if they need to be.

New Features

Auto-read of config settings from cli

This is an improvement based on https://github.com/thestr4ng3r/chiaki/issues/345. morning and reg key are now automatically read from the config file if the nickname of the ps4 is passed:

$ chiaki stream PS4-123

To achieve this behaviour the IP address of the PS4 is now stored in the config file. The limit at this time is that it only works if you're IP doesn't change. However the user is able to override the IP and pass the correct one if this scenario might have happened:

$ chiaki stream PS4-123 192.168.178.25

To make the user aware of this, an Information is printed out by default when the param is used: Using IP '192.168.178.24' from the configuration file. This IP could have changed. If the connection does not succeed please pass the correct IP manually. (To avoid this in the future assign a static IP to your PS4)

List nickname of PS4

To get the nickname one can use the newly introduced param list:

$ chiaki list
Host: PS4-123

Fullscreen (when using stream param)

In combination with the new feature the param --fullscreen=true can be used to start the stream in fullscreen directly:

$ ./chiaki --fullscreen=true stream PS4-123

What has not changed

All calls with other params are working as before, e.g.:

$ ./chiaki --registkey 123456789 --morning abcdefgh== stream 192.168.178.24
thestr4ng3r commented 3 years ago

Also please rebase on top of master to resolve the conflicts.

tuximail commented 3 years ago

Sorry for the intendation - this was due to a configuration of my git client, that I was not aware of. I fixed this. Also I did a rebase on the current master.

tuximail commented 3 years ago

What would make more sense in my opinion is, when no explicit ip is passed, to first run discovery until the selected PS4 is discovered and then connect to it. This would probably make sense in a second pr. What do you think?

I thought so too, but from what I understood the discovery heavily relies on the components declared in maindow.cpp - which means we would loose the comfort we are now having where we directly run the streamingwindow. Maybe I am just mistaken and the discovery can easily be started from main.cpp in this case I should have a deeper look...

thestr4ng3r commented 3 years ago

I thought so too, but from what I understood the discovery heavily relies on the components declared in maindow.cpp - which means we would loose the comfort we are now having where we directly run the streamingwindow. Maybe I am just mistaken and the discovery can easily be started from main.cpp in this case I should have a deeper look...

The discovery in the gui is indeed implemented as part of the MainWindow, but this is only an interface on top of the functionality that is implemented in the library. You can see an example of this in the non-gui CLI: https://github.com/thestr4ng3r/chiaki/blob/master/cli/src/discover.c

By using this, it would be even possible to launch a stream by just typing chiaki stream without anything else. It could start discovery, wait until the first known console is detected and then automatically start the stream. If an explicit console name is passed, wait until this exact console is available.

tuximail commented 3 years ago

So I changed the PR as discussed to include the following features:

  1. Read morning and regkey from config file
  2. Add fullscreen param

Param combinations that are ensured to work:

Let me know, if you still see anything that should be changed or could be done in a better way :)

tuximail commented 3 years ago

The discovery in the gui is indeed implemented as part of the MainWindow, but this is only an interface on top of the functionality that is implemented in the library. You can see an example of this in the non-gui CLI: https://github.com/thestr4ng3r/chiaki/blob/master/cli/src/discover.c

Thanks for pointing me in this direction. This seems indeed like the best approach. I will try this in a "to be created soon"- pull request ;-)

thestr4ng3r commented 3 years ago

Very nice now, thank you! I have pushed a few style fixes myself since that's faster than going through review again. By the way, the registered PS4s are generally identified by their MAC address more than their Nickname so providing that option on the CLI would be another nice addition.