Skip to content

Commit 44fc13f

Browse files
Fix isLatest() and add canInstallUpdate() (#1263)
* Revert "Update isLatest() (#1253)" This reverts commit b129fa3. * Add canInstallUpdate method --------- Co-authored-by: Benjamin Oddou <85166574+BenjaminOddou@users.noreply.github.com>
1 parent 75fb265 commit 44fc13f

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

plexapi/server.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ def check_for_update(self, force=True, download=False):
615615
return self.checkForUpdate(force=force, download=download)
616616

617617
def checkForUpdate(self, force=True, download=False):
618-
""" Returns a :class:`~plexapi.base.Release` object containing release info.
618+
""" Returns a :class:`~plexapi.server.Release` object containing release info
619+
if an update is available or None if no update is available.
619620
620621
Parameters:
621622
force (bool): Force server to check for new releases
@@ -629,12 +630,19 @@ def checkForUpdate(self, force=True, download=False):
629630
return releases[0]
630631

631632
def isLatest(self):
632-
""" Check if the installed version of PMS is the latest. """
633+
""" Returns True if the installed version of Plex Media Server is the latest. """
634+
release = self.checkForUpdate(force=True)
635+
return release is None
636+
637+
def canInstallUpdate(self):
638+
""" Returns True if the newest version of Plex Media Server can be installed automatically.
639+
(e.g. Windows and Mac can install updates automatically, but Docker and NAS devices cannot.)
640+
"""
633641
release = self.query('/updater/status')
634642
return utils.cast(bool, release.get('canInstall'))
635643

636644
def installUpdate(self):
637-
""" Install the newest version of Plex Media Server. """
645+
""" Automatically install the newest version of Plex Media Server. """
638646
# We can add this but dunno how useful this is since it sometimes
639647
# requires user action using a gui.
640648
part = '/updater/apply'

0 commit comments

Comments
 (0)