mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-13 00:32:58 -07:00
Better version comparisons
This commit is contained in:
parent
93b8f32f68
commit
65b3d0c0de
2 changed files with 7 additions and 16 deletions
|
@ -2437,8 +2437,8 @@ $(document).ready(function() {
|
||||||
pms_logs = false;
|
pms_logs = false;
|
||||||
|
|
||||||
// Checks to see if PMS server version is >= 0.9.14 with automaatically logged IP addresses
|
// Checks to see if PMS server version is >= 0.9.14 with automaatically logged IP addresses
|
||||||
var version = "${config['pms_version']}".split('.');
|
var version = parseInt($.map("${config['pms_version']}".split('-')[0].split('.').slice(0,4), function(v) { return ('0000'+v).substring(v.length); }).join(""));
|
||||||
if (version && (parseInt(version[0]) >= 0 || parseInt(version[0]) == 0 && parseInt(version[1]) >= 9 && parseInt(version[2]) >= 14)) {
|
if (version > 900140000) {
|
||||||
$("#debugLogCheck").html("IP address is automatically logged for PMS version 0.9.14 and above.");
|
$("#debugLogCheck").html("IP address is automatically logged for PMS version 0.9.14 and above.");
|
||||||
$("#ip_logging_enable").attr("disabled", true);
|
$("#ip_logging_enable").attr("disabled", true);
|
||||||
$("#ip_logging_enable").attr("checked", true);
|
$("#ip_logging_enable").attr("checked", true);
|
||||||
|
|
|
@ -633,32 +633,23 @@ class PlexTV(object):
|
||||||
% plexpy.CONFIG.PMS_PLATFORM)
|
% plexpy.CONFIG.PMS_PLATFORM)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
v_old = plexpy.CONFIG.PMS_VERSION.split('-')[0].split('.')
|
v_old = helpers.cast_to_int("".join(v.zfill(4) for v in plexpy.CONFIG.PMS_VERSION.split('-')[0].split('.')[:4]))
|
||||||
v_new = platform_downloads.get('version', '').split('-')[0].split('.')
|
v_new = helpers.cast_to_int("".join(v.zfill(4) for v in platform_downloads.get('version', '').split('-')[0].split('.')[:4]))
|
||||||
|
|
||||||
if len(v_old) < 4:
|
if not v_old:
|
||||||
logger.error(u"PlexPy PlexTV :: Unable to retrieve Plex updates: Invalid current server version: %s."
|
logger.error(u"PlexPy PlexTV :: Unable to retrieve Plex updates: Invalid current server version: %s."
|
||||||
% plexpy.CONFIG.PMS_VERSION)
|
% plexpy.CONFIG.PMS_VERSION)
|
||||||
return {}
|
return {}
|
||||||
if len(v_new) < 4:
|
if not v_new:
|
||||||
logger.error(u"PlexPy PlexTV :: Unable to retrieve Plex updates: Invalid new server version: %s."
|
logger.error(u"PlexPy PlexTV :: Unable to retrieve Plex updates: Invalid new server version: %s."
|
||||||
% platform_downloads.get('version'))
|
% platform_downloads.get('version'))
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
# Compare versions
|
|
||||||
if v_new[0] > v_old[0] or \
|
|
||||||
v_new[0] == v_old[0] and v_new[1] > v_old[1] or \
|
|
||||||
v_new[0] == v_old[0] and v_new[1] == v_old[1] and v_new[2] > v_old[2] or \
|
|
||||||
v_new[0] == v_old[0] and v_new[1] == v_old[1] and v_new[2] == v_old[2] and v_new[3] > v_old[3]:
|
|
||||||
update_available = True
|
|
||||||
else:
|
|
||||||
update_available = False
|
|
||||||
|
|
||||||
# Get proper download
|
# Get proper download
|
||||||
releases = platform_downloads.get('releases', [{}])
|
releases = platform_downloads.get('releases', [{}])
|
||||||
release = next((r for r in releases if r['build'] == plexpy.CONFIG.PMS_UPDATE_DISTRO_BUILD), releases[0])
|
release = next((r for r in releases if r['build'] == plexpy.CONFIG.PMS_UPDATE_DISTRO_BUILD), releases[0])
|
||||||
|
|
||||||
download_info = {'update_available': update_available,
|
download_info = {'update_available': v_new > v_old,
|
||||||
'platform': platform_downloads.get('name'),
|
'platform': platform_downloads.get('name'),
|
||||||
'release_date': platform_downloads.get('release_date'),
|
'release_date': platform_downloads.get('release_date'),
|
||||||
'version': platform_downloads.get('version'),
|
'version': platform_downloads.get('version'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue