Add PlexPy update notifications

This commit is contained in:
JonnyWong16 2016-10-09 16:37:01 -07:00 committed by JonnyWong16
parent 5ee986593c
commit 83c304290b
7 changed files with 78 additions and 9 deletions

View file

@ -1333,6 +1333,18 @@
</tr>
</thead>
<tbody>
<tr>
<td><strong>{plexpy_version}</strong></td>
<td>The current version of PlexPy.</td>
</tr>
<tr>
<td><strong>{plexpy_branch}</strong></td>
<td>The current git branch of PlexPy.</td>
</tr>
<tr>
<td><strong>{plexpy_commit}</strong></td>
<td>The current git commit hash of PlexPy.</td>
</tr>
<tr>
<td><strong>{server_name}</strong></td>
<td>The name of your Plex Server.</td>
@ -1727,11 +1739,11 @@
</tr>
<tr>
<td><strong>{update_url}</strong></td>
<td>The available update download URL.</td>
<td>The download URL for the available update.</td>
</tr>
<tr>
<td><strong>{update_release_date}</strong></td>
<td>The release date of the update version.</td>
<td>The release date of the available update.</td>
</tr>
<tr>
<td><strong>{update_channel}</strong></td>
@ -1767,6 +1779,41 @@
</tr>
</tbody>
</table>
<table class="notification-params">
<thead>
<tr>
<th colspan="2">
PlexPy Update Available
</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>{plexpy_update_version}</strong></td>
<td>The available update version for PlexPy.</td>
</tr>
<tr>
<td><strong>{plexpy_update_tar}</strong></td>
<td>The tar download URL for the available update.</td>
</tr>
<tr>
<td><strong>{plexpy_update_zip}</strong></td>
<td>The zip download URL for the available update.</td>
</tr>
<tr>
<td><strong>{plexpy_update_commit}</strong></td>
<td>The commit hash for the available update.</td>
</tr>
<tr>
<td><strong>{plexpy_update_behind}</strong></td>
<td>The number of commits behind for the available update.</td>
</tr>
<tr>
<td><strong>{plexpy_update_changelog}</strong></td>
<td>The changelog for the available update.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer"></div>

View file

@ -503,17 +503,17 @@ def dbcheck():
'on_resume INTEGER DEFAULT 0, on_buffer INTEGER DEFAULT 0, on_watched INTEGER DEFAULT 0, '
'on_created INTEGER DEFAULT 0, on_extdown INTEGER DEFAULT 0, on_intdown INTEGER DEFAULT 0, '
'on_extup INTEGER DEFAULT 0, on_intup INTEGER DEFAULT 0, on_pmsupdate INTEGER DEFAULT 0, '
'on_concurrent INTEGER DEFAULT 0, on_newdevice INTEGER DEFAULT 0, '
'on_concurrent INTEGER DEFAULT 0, on_newdevice INTEGER DEFAULT 0, on_plexpyupdate INTEGER DEFAULT 0, '
'on_play_subject TEXT, on_stop_subject TEXT, on_pause_subject TEXT, '
'on_resume_subject TEXT, on_buffer_subject TEXT, on_watched_subject TEXT, '
'on_created_subject TEXT, on_extdown_subject TEXT, on_intdown_subject TEXT, '
'on_extup_subject TEXT, on_intup_subject TEXT, on_pmsupdate_subject TEXT, '
'on_concurrent_subject TEXT, on_newdevice_subject TEXT, '
'on_concurrent_subject TEXT, on_newdevice_subject TEXT, on_plexpyupdate TEXT, '
'on_play_body TEXT, on_stop_body TEXT, on_pause_body TEXT, '
'on_resume_body TEXT, on_buffer_body TEXT, on_watched_body TEXT, '
'on_created_body TEXT, on_extdown_body TEXT, on_intdown_body TEXT, '
'on_extup_body TEXT, on_intup_body TEXT, on_pmsupdate_body TEXT, '
'on_concurrent_body TEXT, on_newdevice_body TEXT)'
'on_concurrent_body TEXT, on_newdevice_body TEXT, on_plexpyupdate_body TEXT)'
)
# Upgrade sessions table from earlier versions

View file

@ -23,12 +23,12 @@ import platform
import version
# Identify Our Application
USER_AGENT = 'PlexPy/-' + version.PLEXPY_VERSION + ' v' + version.PLEXPY_RELEASE_VERSION + ' (' + platform.system() + \
USER_AGENT = 'PlexPy/-' + version.PLEXPY_BRANCH + ' v' + version.PLEXPY_RELEASE_VERSION + ' (' + platform.system() + \
' ' + platform.release() + ')'
PLATFORM = platform.system()
PLATFORM_VERSION = platform.release()
BRANCH = version.PLEXPY_VERSION
BRANCH = version.PLEXPY_BRANCH
VERSION_NUMBER = version.PLEXPY_RELEASE_VERSION
DEFAULT_USER_THUMB = "interfaces/default/images/gravatar-default-80x80.png"

View file

@ -25,6 +25,7 @@ import time
import plexpy
import activity_processor
import common
import database
import datafactory
import libraries
@ -451,6 +452,9 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, *
pass
available_params = {# Global paramaters
'plexpy_version': common.VERSION_NUMBER,
'plexpy_branch': plexpy.CONFIG.GIT_BRANCH,
'plexpy_commit': plexpy.CURRENT_VERSION,
'server_name': server_name,
'server_uptime': server_uptime,
'server_version': server_times.get('version',''),
@ -563,6 +567,7 @@ def build_server_notify_params(notify_action=None, **kwargs):
server_times = plex_tv.get_server_times()
pms_download_info = kwargs.pop('pms_download_info', {})
plexpy_download_info = kwargs.pop('plexpy_download_info', {})
if server_times:
updated_at = server_times['updated_at']
@ -572,6 +577,9 @@ def build_server_notify_params(notify_action=None, **kwargs):
server_uptime = 'N/A'
available_params = {# Global paramaters
'plexpy_version': common.VERSION_NUMBER,
'plexpy_branch': plexpy.CONFIG.GIT_BRANCH,
'plexpy_commit': plexpy.CURRENT_VERSION,
'server_name': server_name,
'server_uptime': server_uptime,
'server_version': server_times.get('version',''),
@ -591,6 +599,13 @@ def build_server_notify_params(notify_action=None, **kwargs):
'update_extra_info': pms_download_info.get('extra_info',''),
'update_changelog_added': pms_download_info.get('changelog_added',''),
'update_changelog_fixed': pms_download_info.get('changelog_fixed',''),
# PlexPy update parameters
'plexpy_update_version': plexpy_download_info.get('tag_name', ''),
'plexpy_update_tar': plexpy_download_info.get('tarball_url', ''),
'plexpy_update_zip': plexpy_download_info.get('zipball_url', ''),
'plexpy_update_commit': kwargs.pop('plexpy_update_commit', ''),
'plexpy_update_behind': kwargs.pop('plexpy_update_behind', ''),
'plexpy_update_changelog': plexpy_download_info.get('body', '')
}
return available_params, None

View file

@ -256,6 +256,13 @@ def available_notification_actions():
'subject': 'PlexPy ({server_name})',
'body': 'An update is available for the Plex Media Server (version {update_version}).',
'icon': 'fa-refresh'
},
{'label': 'PlexPy Update Available',
'name': 'on_plexpyupdate',
'description': 'Trigger a notification when an update for the PlexPy is available.',
'subject': 'PlexPy ({server_name})',
'body': 'An update is available for PlexPy (version {plexpy_update_version}).',
'icon': 'fa-refresh'
}
]

View file

@ -1,2 +1,2 @@
PLEXPY_VERSION = "master"
PLEXPY_BRANCH = "master"
PLEXPY_RELEASE_VERSION = "1.4.15"

View file

@ -65,7 +65,7 @@ def runGit(args):
def getVersion():
if version.PLEXPY_VERSION.startswith('win32build'):
if version.PLEXPY_BRANCH.startswith('win32build'):
plexpy.INSTALL_TYPE = 'win'
# Don't have a way to update exe yet, but don't want to set VERSION to None