diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index f6d6f2b7..b0d2cb12 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -2437,8 +2437,8 @@ $(document).ready(function() { pms_logs = false; // Checks to see if PMS server version is >= 0.9.14 with automaatically logged IP addresses - var version = "${config['pms_version']}".split('.'); - if (version && (parseInt(version[0]) >= 0 || parseInt(version[0]) == 0 && parseInt(version[1]) >= 9 && parseInt(version[2]) >= 14)) { + var version = parseInt($.map("${config['pms_version']}".split('-')[0].split('.').slice(0,4), function(v) { return ('0000'+v).substring(v.length); }).join("")); + if (version > 900140000) { $("#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("checked", true); diff --git a/plexpy/plextv.py b/plexpy/plextv.py index f39c6b10..22106351 100644 --- a/plexpy/plextv.py +++ b/plexpy/plextv.py @@ -633,32 +633,23 @@ class PlexTV(object): % plexpy.CONFIG.PMS_PLATFORM) return {} - v_old = plexpy.CONFIG.PMS_VERSION.split('-')[0].split('.') - v_new = platform_downloads.get('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 = 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." % plexpy.CONFIG.PMS_VERSION) 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." % platform_downloads.get('version')) 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 releases = platform_downloads.get('releases', [{}]) 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'), 'release_date': platform_downloads.get('release_date'), 'version': platform_downloads.get('version'),