Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename server checkForUpdate #666

Merged
merged 2 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions plexapi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,17 +662,3 @@ def updateTimeline(self, time, state='stopped', duration=None):
key %= (self.ratingKey, self.key, time, state, durationStr)
self._server.query(key)
self.reload()


@utils.registerPlexObject
class Release(PlexObject):
TAG = 'Release'
key = '/updater/status'

def _loadData(self, data):
self.download_key = data.attrib.get('key')
self.version = data.attrib.get('version')
self.added = data.attrib.get('added')
self.fixed = data.attrib.get('fixed')
self.downloadURL = data.attrib.get('downloadURL')
self.state = data.attrib.get('state')
24 changes: 21 additions & 3 deletions plexapi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from plexapi.playlist import Playlist
from plexapi.playqueue import PlayQueue
from plexapi.settings import Settings
from plexapi.utils import cast
from plexapi.utils import cast, deprecated
from requests.status_codes import _codes as codes

# Need these imports to populate utils.PLEXOBJECTS
Expand Down Expand Up @@ -374,7 +374,11 @@ def downloadLogs(self, savepath=None, unpack=False):
filepath = utils.download(url, self._token, None, savepath, self._session, unpack=unpack)
return filepath

@deprecated('use "checkForUpdate" instead')
def check_for_update(self, force=True, download=False):
return self.checkForUpdate()

def checkForUpdate(self, force=True, download=False):
""" Returns a :class:`~plexapi.base.Release` object containing release info.

Parameters:
Expand All @@ -390,15 +394,15 @@ def check_for_update(self, force=True, download=False):

def isLatest(self):
""" Check if the installed version of PMS is the latest. """
release = self.check_for_update(force=True)
release = self.checkForUpdate(force=True)
return release is None

def installUpdate(self):
""" 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'
release = self.check_for_update(force=True, download=True)
release = self.checkForUpdate(force=True, download=True)
if release and release.version != self.version:
# figure out what method this is..
return self.query(part, method=self._session.put)
Expand Down Expand Up @@ -787,6 +791,20 @@ def _loadData(self, data):
self.uuid = data.attrib.get('uuid')


@utils.registerPlexObject
class Release(PlexObject):
TAG = 'Release'
key = '/updater/status'

def _loadData(self, data):
self.download_key = data.attrib.get('key')
self.version = data.attrib.get('version')
self.added = data.attrib.get('added')
self.fixed = data.attrib.get('fixed')
self.downloadURL = data.attrib.get('downloadURL')
self.state = data.attrib.get('state')


class SystemAccount(PlexObject):
""" Represents a single system account.

Expand Down