Skip to content

Commit

Permalink
SyncPlay for 10.7.0 (#177)
Browse files Browse the repository at this point in the history
* checkpoint

* SyncPlay sort-of works now.

* Fix issue with not sending ready.

* Additional work on SyncPlay.

* Additional work on SyncPlay.

* #170 Fix sending zero position on finished_callback.

* Add ping back but make errors less noisy.

* Disable server discovery which isn't used.

* Fix skipping, stop delay (#175), and SyncPlay (#168).

* Update po/pot.

* Up version to 1.9.0.
  • Loading branch information
iwalton3 authored Mar 18, 2021
1 parent cf28260 commit 840df54
Show file tree
Hide file tree
Showing 31 changed files with 3,007 additions and 2,698 deletions.
4 changes: 2 additions & 2 deletions Jellyfin MPV Desktop.iss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Jellyfin MPV Desktop"
#define MyAppVersion "1.8.1"
#define MyAppName "Jellyfin Desktop"
#define MyAppVersion "1.9.0"
#define MyAppPublisher "Ian Walton"
#define MyAppURL "https://github.com/jellyfin/jellyfin-desktop"
#define MyAppExeName "run-desktop.exe"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ subtitles. You must either [use the menu](https://github.com/jellyfin/jellyfin-d

Please note the following issues with controlling SyncPlay:
- The desktop client can join SyncPlay groups from the web app's menu, but not create them.
- If you attempt to create a group from the web app's menu, it will break SyncPlay for all users until you close the client or leave the invalid group. ([Link to Issue.](https://github.com/jellyfin/jellyfin-desktop/issues/107))
- If you attempt to join a SyncPlay group when casting to MPV Shim, it will play the media but it will not activate SyncPlay.
- You can, however, proceed to activate SyncPlay [using the menu within MPV](https://github.com/jellyfin/jellyfin-desktop#menu).
- If you would like to create a group or join a group for currently playing media, [use menu within MPV](https://github.com/jellyfin/jellyfin-desktop#menu).
- SyncPlay as of 10.7.0 is new and kind of fragile. You may need to rejoin or even restart the client. Please report any issues you find.

Music playback sort-of works, but repeat, shuffle, and gapless playback have not been implemented and
would require major changes to the application to properly support, as it was built for video.
Expand Down
14 changes: 13 additions & 1 deletion jellyfin_mpv_shim/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _connect_client(self, server):

is_logged_in = False
client = self.client_factory()
state = client.authenticate({"Servers": [server]})
state = client.authenticate({"Servers": [server]}, discover=False)
server["connected"] = state["State"] == CONNECTION_STATE["SignedIn"]
if server["connected"]:
is_logged_in = True
Expand Down Expand Up @@ -235,5 +235,17 @@ def stop(self):
for client in self.clients.values():
client.stop()

def get_username_from_client(self, client):
# This is kind of convoluted. It may fail if a server
# was added before we started saving usernames.
for uuid, client2 in self.clients.items():
if client2 is client:
for server in self.credentials:
if server["uuid"] == uuid:
return server.get("username", "Unknown")
break

return "Unknown"


clientManager = ClientManager()
2 changes: 1 addition & 1 deletion jellyfin_mpv_shim/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_NAME = "jellyfin-mpv-shim"
USER_APP_NAME = "Jellyfin MPV Shim"
CLIENT_VERSION = "1.8.1"
CLIENT_VERSION = "1.9.0"
USER_AGENT = "Jellyfin-MPV-Shim/%s" % CLIENT_VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,17 @@

<content_rating type="oars-1.1" />
<releases>
<release version="1.8.1" date="2020-12-12">
<release version="1.9.0" date="2021-03-18">
<description>
<p>This release adds support for SyncPlay on 10.7.0. Changes:</p>
<ul>
<li>Speed up closing the player.</li>
<li>Drop SyncPlay 10.6.x support.</li>
<li>Upgrade the web client.</li>
</ul>
</description>
</release>
<release version="1.8.1" date="2020-12-12">
<description>
<p>This is a maintenance update and the last one to support SyncPlay on 1.6.x. Changes:</p>
<ul>
Expand Down
12 changes: 12 additions & 0 deletions jellyfin_mpv_shim/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ def set_streams(self, aid: Optional[int], sid: Optional[int]):

return need_restart

def get_playlist_id(self):
return self.parent.queue[self.parent.seq]["PlaylistItemId"]


class Media(object):
def __init__(
Expand Down Expand Up @@ -373,3 +376,12 @@ def insert_items(self, items, append: bool = False):
self.queue[0 : self.seq + 1] + items + self.queue[self.seq + 1 :]
)
self.has_next = self.seq < len(self.queue) - 1

def replace_queue(self, sp_items, seq):
"""Update queue for SyncPlay.
Returns None if the video is the same or a new Media if not."""
if self.queue[self.seq]["Id"] == sp_items[seq]["Id"]:
self.queue, self.seq = sp_items, seq
return None
else:
return Media(self.client, sp_items, seq, self.user_id, queue_override=False)
Loading

0 comments on commit 840df54

Please sign in to comment.