python-plexapi
python-plexapi copied to clipboard
Create Server to Test Client
I have a few ideas to create a server to help test the PlexClient functionality. It'll be limited to one person testing at a time, but our test setup does that already. I might toss a second PlexServer on the same machine as well.
If it can run in the same droplet, let me know.
It probably can. But I'd feel more comfortable owning the server myself. Don't want others to have to pay and maintain servers for this project. :)
I just found https://www.digitalocean.com/company/blog/easily-transfer-snapshots-between-accounts/. So i could make a snapshot the the server and send it to you.
I got stuck. My idea was to install gnome-panel and vnc4server to get a crappy UI and then install OpenPHT on it. Everything went fine, but OpenPHT wont start because of the error below. I assume this is because there is no real video card on the droplets capable of running it.
02:05:50 T:140062471915712 NOTICE: Log level changed to 0
02:05:50 T:140062471915712 NOTICE: Loading media sources from special://masterprofile/sources.xml
02:05:50 T:140062244022016 NOTICE: PulseAudio: Opened device Default in pcm mode with Buffersize 300 ms
02:05:50 T:140062471915712 NOTICE: Running database version Addons15
02:05:50 T:140062471915712 NOTICE: Running database version PlexServerCache4
02:05:50 T:140062471915712 NOTICE: Setup SDL
02:05:50 T:140062471915712 ERROR: CXRandR::Query - unable to open xrandr xml
02:05:50 T:140062471915712 NOTICE: Checking resolution 16
02:05:51 T:140062471915712 ERROR: Failed to find matching visual
02:05:51 T:140062471915712 ERROR: InitRenderSystem() glewInit returned 1: Missing GL version
02:05:51 T:140062471915712 FATAL: CApplication::Create: Unable to init rendering system
:(
We'll get it, just not until we figure this out. :P
I looked around a bit for a cheapo VPS with a GPU, and they are all quite expensive. Then I got to thinking that there a Plex Client that runs on a Raspi, and I do have one of those sitting at my place collecting dust. I may toss RasPlex on it and leave it running at my place for a few weeks to see how it goes.
Have you tested how much you can control plex web? If we can control it we could probably use selenium.
I don't think you can control plexweb at all. It's a webpage (not a server), how could it possibly be listening on a port for commands?
I should note progress here. -- I tried setting up an Ubuntu installation and installing OpenPHT on it, but came up short as they don't provide pre-built debs, and when trying to compile it myself I started going down a rabbit hole of compile issues that I didn't quite understand. So I'm going on to plan B which should be much easier.
Plan B is to install RasPlex directly, which is a simple and well understood thing that just boots right up into a OpenPHT. I may mess with it a bit after installation to see if I can toss Plex Media Server on it as well to have a nice consolidated testing box. If I can get the server working, great, if not ohh well. We'll at least have a dedicated PlexClient just for testing in a few days.
just a pro tip dont save anything a users enters :P : https://pushingkarma.com/p/magnets/ Im the i like big butts guy. I didnt know you saved it. I was just kidding around :xD
I actually enjoy going back to that page and seeing the crazy words people put in there. :D
:D
I'm going to put this on hold a little bit. I spent the last several days trying a whole slew of different things and keep coming up short. The goal is to get a PlexClient that can be always on, and have remote access to kick it if it ever gets stuck or needs setting changes. Things I've tried so far, and the problems I hit.
-
Install Ubuntu on RasPi2 then try to build OpenPHT -- OpenPHT will not compile on the RasPi2. It hit the error mentioned above:
InitRenderSystem() glewInit returned 1: Missing GL version
. VNC is very easy to install this way. -
Install RasPlex on RasPi2 then try getting VNC working -- RasPlex installs fine, but getting VNC working is another story. There are reports online that this can be done, but not many examples on how exactly to do it. Most of the conversations of people asking end in "why would you ever want to do that?" On top of that, RasPlex is installed on a OS called OpenElec which is very locked down and quite difficult to install anything on (its basically a read only OS).
-
Install Raspbian on RasPi2, then install Kodi, then install the KodiPlexClient -- This solution seems the like the least desired path. I am not sure the KodiPlexClient will act like a full fledged client, or more like the WebClient, where it can't be controlled (I suspect the latter). However, we can't know, because after installing Kodi, I tried following the instructions to get the Plex Client installed, and it seems the version of Kodi the RasPi is not new enough for the beta version of KodiPlexClient. So alas, we're stuck again. VNC is very easy to install with this method as well.
I do have an older Apple MacMini that I don't use too often which could be used for this purpose, but it seems like overkill to tie up a $700 machine just so TravisCI can run a few tests. I'd really like to get the RasPi working as it seems like the perfect hardware for this purpose. Just need to get over these hurdles.
If we can't figure it out we can just mock the library. I'd prefere a integration tests like we have tho.
I just spun up an AWS EC2 Windows Instance and successfully installed and started Plex Media Server and Plex Media Player on it. I'll see if I can setup a bunch of content on it tonight. It'll be kind of nice to have the server and the client on the same machine. I am unsure if we can even control a Plex client if its not on the same network.
According to the EC2 Cost Calculator, this should only cost $13/mo. We'll see, AWS pricing is so damn confusing. (t2micro instance in us-east-1a - Windows_Server-2016-English-Full-Base-2017.01.11)
https://gist.github.com/Hellowlol/26bc66e3c32e1a8942ad725919e5502b What i used to wrote the asserts.
Lol a lot of interesting variable names.
OK, So I populated the server with some content and tried to playMedia() from to the client I have in EC2. I'm currently getting back BadRequest (406) not_acceptable
when I try this. I'm guessing this is because I am trying to control the client from a different network. Need to investigate a bit more.
@Hellowlol - At this point I'm willing to share all the login information if you want to give anything a shot. Should I use the same email on your Plex server?
Yeah, but i cant remember the password. Ill send it to you when i get home from work.
Crazy, you can control the PlexWeb Client remotely. Didn't know that.
Thats awesome. Does it need to be on the same network? What commands works?
Why not use mock to mock out the server so you do not need to rely on a active server with specific media in it?
The Plex Server is essentially a black box to us, the only insight we have into it is watching what the Plex Web Client is asking it and seeing how the server responds. Without testing against an actual server or client directly, I don't really feel we are verifying this project is working.
Not to mention Plex has in the past, and probably will in the future, change the way things work. Mock testing would not catch these changes.
I understand this issue is old, but I have been considering something similar for testing a plugin. I haven't put all the pieces together yet, but I was thinking that using a Plex docker container might work inside a github workflow. I setup another workflow that makes use of dockerfiles (https://github.com/SunshineStream/Sunshine/blob/870b6e26753810f628608c0cf173f1f781da85db/.github/workflows/create_package.yml#L145).
I image using the host networking option would be fine and just use localhost:32400
as the server address.
These are assumptions I am making, until I actually try setting this up.
- The claim token can be left blank (I can't think of a reason why it would need to be claimed for testing)
- The mock media and database can be setup on a standard ubuntu server, then both copied into a separate repo.
- That repo can be a submodule that is included during the checkout action.
Unless I am missing something, this method would allow as many simultaneous tests as you wish.
This issue is outdated. The CI uses unclaimed PMS instances for PRs and claimed instances for master
commits using Docker images for some time.
@ReenigneArcher @jjlawren, you're talking about different things ;) The issue is about testing integration with a Plex Client, not a server.
Ah, yes it is. Although I still understand the latest comment to be around using PMS docker containers in the CI which is already being done (both claimed and unclaimed).
Yes @jjlawren , you put me on the right track. Still need to find time to implement something similar in my projects. Thanks!