Skip to content

Commit

Permalink
Advertise name of player.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalton3 committed Aug 18, 2019
1 parent feb3a19 commit d79fae2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
21 changes: 20 additions & 1 deletion plex_mpv_shim/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,26 @@ def poll(self, path, arguments):
self.xmlOutput = timelineManager.GetCurrentTimeLinesXML(pollSubscriber)

def resources(self, path, arguments):
pass
mediaContainer = et.Element("MediaContainer")
player = et.Element("Player")

capabilities = "timeline,playback,navigation"
if settings.enable_play_queue:
capabilities = "timeline,playback,navigation,playqueues"

info = (("deviceClass", "pc"),
("machineIdentifier", settings.client_uuid),
("product", "Plex MPV Shim"),
("protocolCapabilities", capabilities),
("protocolVersion", "1"),
("title", settings.player_name),
("version", "1.0"))

for key, value in info:
player.set(key, value)

mediaContainer.append(player)
self.xmlOutput = mediaContainer

def playMedia(self, path, arguments):
address = arguments.get("address", None)
Expand Down
5 changes: 3 additions & 2 deletions plex_mpv_shim/gdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,16 @@ def clientDetails(self, c_id, c_name, c_port, c_product, c_version):

data = {
b"Name": str(c_name).encode("utf-8"),
b"RawName": str(c_name).encode("utf-8"),
b"Port": str(c_port).encode("utf-8"),
b"Product": str(c_product).encode("utf-8"),
b"Content-Type": b"plex/media-player",
b"Product": str(c_product).encode("utf-8"),
b"Protocol": b"plex",
b"Protocol-Version": b"1",
b"Protocol-Capabilities": capabilities,
b"Version": str(c_version).encode("utf-8"),
b"Resource-Identifier": str(c_id).encode("utf-8"),
b"Device-Class": b"HTPC"
b"Device-Class": b"pc"
}

self.client_data = b""
Expand Down
2 changes: 1 addition & 1 deletion plex_mpv_shim/mpv_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def update_gdm_settings(name=None, value=None):
gdm.clientDetails(settings.client_uuid, settings.player_name,
settings.http_port, "RaspberryPi", "1.0")
settings.http_port, "Plex MPV Shim", "1.0")

def main():
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout, format="%(asctime)s [%(levelname)8s] %(message)s")
Expand Down

0 comments on commit d79fae2

Please sign in to comment.