If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Findings & questions/suggestions about the built-in mpd

DenzoNLDenzoNL Posts: 10Members, Plex Pass Plex Pass

Hey all,

So I've been using PlexAmp for a while now, and I decided to poke a little bit into it's inner workings. As it's using mpd under hood, I was wondering if I simply could connect with any old mpd client and control Plexamp from there. By default, the mpd client in Plexamp isn't using the default port of 6600, so I had to figure that out first. Luckily, the mpd.conf file wasn't too hard to find, as it can be found at

%LOCALAPPDATA%\Programs\plexamp\resources\helpers\mpd.conf on Windows 10.

As it turns out, the port that's used is 36600. I had no trouble connecting to the mpd instance using either ncmpcpp under WSL or using Auremo on Windows. Unfortunately, that's where the fun ends; almost nothing works, except for previous/next, stop and play (pause and resume unfortunately not) and surprisingly, volume control works just fine. However, previous just restarts the current song.

As for playlists and the Media library, they are entirely nonexistent and crash ncmpcpp for me, but not Auremo. Instead, there are two files queued up with not the title of the song, but instead an URL in the following format (decoded for convenience):

http://127.0.0.1:20000/proxy?source=[..]&endpoint=/library/parts/159913/1512592717/file.flac?download=1&X-Plex-Client-Identifier=[..]&X-Plex-Session-Identifier=[..]

The song playing is always the first song in queue, and next skips gaplessly/crossfades to the next song and that becomes the first in queue, so I assume that's how they've got gapless playback working (by making sure the next song is always preloaded), and that's why the previous functionality doesn't work straight from mpd.

Interesting useless fact: by copy-pasting the url into your browser, it downloads the song directly from your server :wink:

I haven't delved deeper into it as it seems fairly pointless and too much effort, but it gave rise to the following questions/suggestions I'd have for the development team:

  1. Could you elaborate more on how you've got the connection between mpd and Plex working?
  2. Would it be possible to expose the entire Plex library to mpd sufficiently enough that we could actually use clients like `ncmpcpp' to control a future headless version of PlexAmp?
  3. As a follow-up to 2, it would be amazing if you could release that functionality separately from PlexAmp? I would love it if my own mpd instance could simply connect to Plex and have that be the one and only master library, and also to be able to use mpd remotely without hassle.

Thanks in advance!

Tagged:

Comments

  • bencarrbencarr Posts: 1Members, Plex Pass Plex Pass

    I too as a long time MPD and Open Source user like the ability to expose the MPD daemon for other clients!

    For your questions @DenzoNL
    1) They are proxying the transport with plex authentication, and then pointing the client to localhost, you can check /tmp/mpd.log

    http://127.0.0.1:20000/proxy/file.mp3?source=0b9656f6600xxxyyyzzzd358a3f6bbfba4fd&endpoint=/library/parts/390020/1489809940/file.mp3?download=1&X-Plex-Client-Identifier%xxxyyyzzz-452e-47a0-906f-d1cc7c663b83&X-Plex-Session-Identifier%xxxyyyzzz-06ef-4cde-ae9f-9114b3a80aa7

    2) I am totally with you on this, the ability to have "thin" clients with HiFi would be great, bury it and have it default off, but allow users to toggle MPD port exposure. PlexAmp is interesting, but let those of us with "other" but already covered needs connect other lighter clients to the process, you already have the DB.

    3) See (2)

    mpd uses 20MB of RAM and 0.3 CPU on an i5-42xx

    PlexAmp + PlexAmp Helpers use 74 threads, 50% of a core, and 805MB of RAM

    We appreciate what you have built, but some of us would like to attach another client.

  • elanelan CTO and Co-founder MauiPosts: 6,978Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    1. The Plexamp server process provides an HTTP proxy with read-ahead and seamless connection switching. The server side handles the play queue, and lots of other nuances of playback.
    2. We will be providing a "headless" version of Plexamp, without any UI, and with only the server process and MPD. We don't have any interest in making it work with other MPD clients (there's way too much work which would be needed, we're totally neutering all the library/database stuff inside MPD).

    Hope that makes sense :sweat_smile:

    instagram @elan // the wife's photography site.
    the Medium page // the dog's twitter feed.

  • elanelan CTO and Co-founder MauiPosts: 6,978Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee

    (And to clarify, the headless version will be a Plex player app, controllable from any other Plex app, including e.g. Alexa).

    instagram @elan // the wife's photography site.
    the Medium page // the dog's twitter feed.

  • christopherruchristopherru Posts: 20Members, Plex Pass Plex Pass

    @elan. Cool! can't wait to try the headless version out.

Sign In or Register to comment.