Skip to content

Commit

Permalink
Merge pull request #195 from jellyfin/bugfix
Browse files Browse the repository at this point in the history
Fix bugs #191, #194, #193
  • Loading branch information
iwalton3 authored Mar 25, 2021
2 parents 94b4c31 + bbde7f0 commit 85a788d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Jellyfin MPV Desktop.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Jellyfin Desktop"
#define MyAppVersion "1.10.1"
#define MyAppVersion "1.10.2"
#define MyAppPublisher "Ian Walton"
#define MyAppURL "https://github.com/jellyfin/jellyfin-desktop"
#define MyAppExeName "run-desktop.exe"
Expand Down
3 changes: 3 additions & 0 deletions jellyfin_mpv_shim/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def save_credentials(self):
def login(
self, server: str, username: str, password: str, force_unique: bool = False
):
if server.endswith("/"):
server = server[:-1]

protocol, host, port, path = path_regex.match(server).groups()

if not protocol:
Expand Down
2 changes: 1 addition & 1 deletion jellyfin_mpv_shim/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME = "jellyfin-mpv-shim"
USER_APP_NAME = "Jellyfin MPV Shim"
CLIENT_VERSION = "1.10.1"
CLIENT_VERSION = "1.10.2"
USER_AGENT = "Jellyfin-MPV-Shim/%s" % CLIENT_VERSION
CAPABILITIES = {
"PlayableMediaTypes": "Video",
Expand Down
24 changes: 17 additions & 7 deletions jellyfin_mpv_shim/event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,24 @@ def __init__(self):
self.it_event_set = set()

def handle_event(
self, client: "JellyfinClient_type", event_name: str, arguments: dict
self,
client: "JellyfinClient_type",
event_name: str,
arguments: dict,
from_web=False,
):
# Pass GeneralCommands to desktop client when no media
# is playing and the event doesn't come from the web client.
if (
event_name == "GeneralCommand"
and not playerManager.is_playing()
and self.it_on_event
and (not from_web or arguments.get("Name") != "DisplayContent")
):
timelineManager.delay_idle()
self.it_on_event("GeneralCommand", arguments)
return

if event_name in bindings:
log.debug("Handled Event {0}: {1}".format(event_name, arguments))
bindings[event_name](self, client, event_name, arguments)
Expand Down Expand Up @@ -101,12 +117,6 @@ def play_media(self, client: "JellyfinClient_type", _event_name, arguments: dict
def general_command(
self, client: "JellyfinClient_type", _event_name, arguments: dict
):
# Pass GeneralCommands to desktop client when no media
# is playing.
if not playerManager.is_playing() and self.it_on_event:
self.it_on_event("GeneralCommand", arguments)
return

command = arguments.get("Name")
if command == "SetVolume":
# There is currently a bug that causes this to be spammed, so we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@

<content_rating type="oars-1.1" />
<releases>
<release version="1.10.2" date="2021-03-25">
<description>
<p>This release fixes some important bugs. Changes:</p>
<ul>
<li>#191 Playing media from episode page crashes player logic and doesn't set subtitle/audio streams.</li>
<li>#194 Fix erratic navigation in webclient caused by sending back bad display mirror events.</li>
<li>#193 Handle trailing slashes in server URLs.</li>
</ul>
</description>
</release>
<release version="1.10.1" date="2021-03-24">
<description>
<p>This release fixes websocket forwarding and casting in the desktop client. Changes:</p>
Expand Down
18 changes: 11 additions & 7 deletions jellyfin_mpv_shim/webclient_view/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ def it_on_event(name, event):
server_id = event["ServerId"]
if type(event) is dict and "value" in event and len(event) == 2:
event = event["value"]
pl_event_queue.put({
"dest": "ws",
"MessageType": name,
"Data": event,
"ServerId": server_id
})
pl_event_queue.put(
{
"dest": "ws",
"MessageType": name,
"Data": event,
"ServerId": server_id,
}
)

playerManager.on_playstate = on_playstate
eventHandler.it_on_event = it_on_event
Expand Down Expand Up @@ -240,7 +242,9 @@ def mpv_shim_message():
if client is None:
log.warning("Message recieved but no client available. Ignoring.")
return resp
eventHandler.handle_event(client, req["name"], req["payload"])
eventHandler.handle_event(
client, req["name"], req["payload"], from_web=True
)
return resp

@app.route("/mpv_shim_wsmessage", methods=["POST"])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="jellyfin-mpv-shim",
version="1.10.1",
version="1.10.2",
author="Ian Walton",
author_email="iwalton3@gmail.com",
description="Cast media from Jellyfin Mobile and Web apps to MPV.",
Expand Down

0 comments on commit 85a788d

Please sign in to comment.