New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client request: Plex Media Server #387

Closed
kicsyromy opened this Issue Nov 23, 2017 · 11 comments

Comments

Projects
None yet
3 participants
@kicsyromy

kicsyromy commented Nov 23, 2017

I would like to take a look at implementing a new client for Plex Media Server within Tizonia.

Is this something that is desired, or allowed within the project?

Thank you.

@juanrubio

This comment has been minimized.

Collaborator

juanrubio commented Nov 23, 2017

Hi, thanks for getting in touch!.

Plex Media Server support?. Of course, that would be amazing. Actually, I'm a big fan, I've been running a Plex server at home for more than 5 years now. So yes, definitely, you are more than welcome if you would like try. I will be happy to help.

Is there an API and/or clients already implemented? Let me know if you need anything.

@kicsyromy

This comment has been minimized.

kicsyromy commented Nov 23, 2017

I have some experience with a small app I made for my bachelor's degree that took advantage of the undocumented API to interrogate a Plex server.
I'm thinking this could be a good starting point.

I'll surely be in touch for guidance ☺️

@juanrubio

This comment has been minimized.

Collaborator

juanrubio commented Nov 23, 2017

Great!

@kicsyromy

This comment has been minimized.

kicsyromy commented Nov 25, 2017

Hi @juanrubio

I started looking at the code, building it for the first time, getting a feel for things.

I noticed early on that all clients, at a top level, are split between a C and C++ interface and a python one; where the C intrafce is based on the C++ one and it, in turn, is based on the Python one.

Is this a requirement for every client or is the design based on the fact that there already were APIs in Python for them and you wanted to reuse as much as you could?
Or am I just way off base? 😄

Thanks!

@juanrubio

This comment has been minimized.

Collaborator

juanrubio commented Nov 26, 2017

Hi @kicsyromy

Your analysis is correct. The cloud client libs are most of them based on pre-existing Python APIs. So I wanted to make used of them. To do that, the Python is encapsulated using a C++-based boost::python wrapper, and that in turn is wrapped on a very thin C adapter, so that the whole thing can be driven from within a C-based OpenMAX IL component.

Finally, the Tizonia player is a C++ application that creates pipelines or "graphs" of OpenMAX IL components, like for example this one:

[ audio_source.http.gmusic ] -> [ audio_decoder.mp3 ] -> [alsa or pulseaudio pcm renderer]
etc, etc

So there really is no requirement to use python at all. It is in use for the sake of re-use what it's already out there.

@kicsyromy

This comment has been minimized.

kicsyromy commented Nov 26, 2017

Thanks for the clarifications!

I'll be in touch.

@tizonia

This comment has been minimized.

Owner

tizonia commented Feb 18, 2018

@kicsyromy : I decided I'd give it a try myself. Please have a look at the 'plex' branch, and your are more than welcome to chip in if you want.

I'm using https://github.com/pkkid/python-plexapi, and the results are looking pretty good.

At the moment only mp3 streams can be played and there are 4 search options: tracks, artist, album and playlist.

I believe other formats could be retrieved from the server, like flac, ogg etc. These are not supported at the moment. Also, I'm trying to investigate an issue with casting of Plex URLs to chromecast devices, see balloob/pychromecast#146

@kicsyromy

This comment has been minimized.

kicsyromy commented Feb 20, 2018

Hi @juanrubio,

Sorry for the silence, I've bee busy chugging away at porting some old Qt dependent code for interacting with a Plex Media Server to pure C++. This was one of the first steps I wanted to take towards implementing this feature.

Just that progress has been slow with real life stuff getting in the way 😋.

I'll check out what you've done, maybe I can pitch in since you decided to go with the python implementation.

Thanks for the heads up 🙂

@tizonia

This comment has been minimized.

Owner

tizonia commented Feb 21, 2018

@kicsyromy

Sorry for the silence,

No worries. And thanks for getting back to me.

maybe I can pitch in since you decided to go with the python implementation.

Yes, I decided to go with the python API because it looked pretty easy and well documented. Since all the existing clients in the project are based on third-party Python apis, it was just a matter of following the familiar pattern.

I'm really struggling with something though. And that is the casting of Plex URLs. The process is this: I first retrieve the streaming URLs from the Plex server and after that, I send the URLs to the Chromecast device for playback. This works with all the other services, GMusic, YouTube, SoundCloud, Dirble. With Plex, I'm currently unable to make this scenario work. The Plex URLs retrieved are good since I can receive the mp3 data from the server when consuming the URL with Tizonia or any other streaming client. But it looks as if the Plex server refused to stream the compressed audio to a Chromecast device using that same URL. As discussed in balloob/pychromecast#146, Plex servers may be producing different URLs for Chromecast devices. I was wondering if you would be familiar with this, by any chance.

Regarding the 'plex' branch, FYI, I'm currently using this as a 'develop' branch, so there is some unrelated stuff that I'm also putting in there. I think I'll start using a dedicated 'develop' branch in the next cycle, but for now, it's all going into 'plex'.

@kicsyromy

This comment has been minimized.

kicsyromy commented Feb 22, 2018

@tizonia
Unfortunately not really familiar with Chromecast part, but I can give it a shot during the weekend.
I'll get back to you if I find anything.

@tizonia tizonia added the enhancement label Mar 10, 2018

@tizonia tizonia added this to the v0.13.0 milestone Mar 10, 2018

@tizonia

This comment has been minimized.

Owner

tizonia commented Mar 10, 2018

The Plex branch has been merged to master. I will be creating a separate issue for adding Chromecast support with Plex.

@tizonia tizonia closed this Mar 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment