mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Fix isLatest()
and add canInstallUpdate()
(#1263)
* Revert "Update isLatest() (#1253)"
This reverts commit b129fa3757
.
* Add canInstallUpdate method
---------
Co-authored-by: Benjamin Oddou <85166574+BenjaminOddou@users.noreply.github.com>
This commit is contained in:
parent
75fb265800
commit
44fc13f2b5
1 changed files with 11 additions and 3 deletions
|
@ -615,7 +615,8 @@ class PlexServer(PlexObject):
|
|||
return self.checkForUpdate(force=force, download=download)
|
||||
|
||||
def checkForUpdate(self, force=True, download=False):
|
||||
""" Returns a :class:`~plexapi.base.Release` object containing release info.
|
||||
""" Returns a :class:`~plexapi.server.Release` object containing release info
|
||||
if an update is available or None if no update is available.
|
||||
|
||||
Parameters:
|
||||
force (bool): Force server to check for new releases
|
||||
|
@ -629,12 +630,19 @@ class PlexServer(PlexObject):
|
|||
return releases[0]
|
||||
|
||||
def isLatest(self):
|
||||
""" Check if the installed version of PMS is the latest. """
|
||||
""" Returns True if the installed version of Plex Media Server is the latest. """
|
||||
release = self.checkForUpdate(force=True)
|
||||
return release is None
|
||||
|
||||
def canInstallUpdate(self):
|
||||
""" Returns True if the newest version of Plex Media Server can be installed automatically.
|
||||
(e.g. Windows and Mac can install updates automatically, but Docker and NAS devices cannot.)
|
||||
"""
|
||||
release = self.query('/updater/status')
|
||||
return utils.cast(bool, release.get('canInstall'))
|
||||
|
||||
def installUpdate(self):
|
||||
""" Install the newest version of Plex Media Server. """
|
||||
""" Automatically install the newest version of Plex Media Server. """
|
||||
# We can add this but dunno how useful this is since it sometimes
|
||||
# requires user action using a gui.
|
||||
part = '/updater/apply'
|
||||
|
|
Loading…
Reference in a new issue