@@ -817,7 +818,7 @@
$.ajax({
url: 'get_changelog',
data: {
- latest_only: true,
+ since_prev_release: true,
update_shown: true
},
cache: false,
diff --git a/plexpy/__init__.py b/plexpy/__init__.py
index d4c44f14..4e25479d 100644
--- a/plexpy/__init__.py
+++ b/plexpy/__init__.py
@@ -34,7 +34,7 @@ from apscheduler.triggers.interval import IntervalTrigger
import activity_handler
import activity_pinger
-import config
+import common
import database
import libraries
import logger
@@ -42,7 +42,6 @@ import mobile_app
import notification_handler
import notifiers
import plextv
-import pmsconnect
import users
import versioncheck
import plexpy.config
@@ -83,6 +82,7 @@ INSTALL_TYPE = None
CURRENT_VERSION = None
LATEST_VERSION = None
COMMITS_BEHIND = None
+PREV_RELEASE = None
UMASK = None
@@ -102,7 +102,9 @@ def initialize(config_file):
global _INITIALIZED
global CURRENT_VERSION
global LATEST_VERSION
+ global PREV_RELEASE
global UMASK
+
CONFIG = plexpy.config.Config(config_file)
CONFIG_FILE = config_file
@@ -190,6 +192,17 @@ def initialize(config_file):
CONFIG.JWT_SECRET = generate_uuid()
CONFIG.write()
+ # Get the previous version from the file
+ version_lock_file = os.path.join(DATA_DIR, "version.lock")
+ prev_version = None
+ if os.path.isfile(version_lock_file):
+ try:
+ with open(version_lock_file, "r") as fp:
+ prev_version = fp.read()
+ except IOError as e:
+ logger.error(u"Unable to read previous version from file '%s': %s" %
+ (version_lock_file, e))
+
# Get the currently installed version. Returns None, 'win32' or the git
# hash.
CURRENT_VERSION, CONFIG.GIT_REMOTE, CONFIG.GIT_BRANCH = versioncheck.getVersion()
@@ -198,8 +211,6 @@ def initialize(config_file):
# This allowes one to restore to that version. The idea is that if we
# arrive here, most parts of Tautulli seem to work.
if CURRENT_VERSION:
- version_lock_file = os.path.join(DATA_DIR, "version.lock")
-
try:
with open(version_lock_file, "w") as fp:
fp.write(CURRENT_VERSION)
@@ -217,6 +228,32 @@ def initialize(config_file):
else:
LATEST_VERSION = CURRENT_VERSION
+ # Get the previous release from the file
+ release_file = os.path.join(DATA_DIR, "release.lock")
+ PREV_RELEASE = common.VERSION_NUMBER
+ if os.path.isfile(release_file):
+ try:
+ with open(release_file, "r") as fp:
+ PREV_RELEASE = fp.read()
+ except IOError as e:
+ logger.error(u"Unable to read previous release from file '%s': %s" %
+ (release_file, e))
+ elif prev_version == 'cfd30996264b7e9fe4ef87f02d1cc52d1ae8bfca': # Commit hash for v1.4.25
+ PREV_RELEASE = 'v1.4.25'
+
+ # Check if the release was updated
+ if common.VERSION_NUMBER != PREV_RELEASE:
+ CONFIG.UPDATE_SHOW_CHANGELOG = 1
+ CONFIG.write()
+
+ # Write current release version to file for update checking
+ try:
+ with open(release_file, "w") as fp:
+ fp.write(common.VERSION_NUMBER)
+ except IOError as e:
+ logger.error(u"Unable to write current release to file '%s': %s" %
+ (release_file, e))
+
# Get the real PMS urls for SSL and remote access
if CONFIG.PMS_TOKEN and CONFIG.PMS_IP and CONFIG.PMS_PORT:
plextv.get_server_resources()
diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py
index 7a38e008..4259ccc3 100644
--- a/plexpy/versioncheck.py
+++ b/plexpy/versioncheck.py
@@ -298,14 +298,14 @@ def checkout_git_branch():
logger.info('Output: ' + str(output))
-def read_changelog(latest_only=False):
+def read_changelog(latest_only=False, since_prev_release=False):
changelog_file = os.path.join(plexpy.PROG_DIR, 'CHANGELOG.md')
if not os.path.isfile(changelog_file):
return '
Missing changelog file
'
try:
- output = ''
+ output = ['']
prev_level = 0
latest_version_found = False
@@ -329,27 +329,34 @@ def read_changelog(latest_only=False):
break
elif latest_only:
latest_version_found = True
+ # Add a space to the end of the release to match tags
+ elif since_prev_release and str(plexpy.PREV_RELEASE) + ' ' in header_text:
+ break
- output += '
' + header_text + ''
+ output[-1] += '
' + header_text + ''
elif line_list_match:
line_level = len(line_list_match.group(1)) / 2
line_text = line_list_match.group(2)
if line_level > prev_level:
- output += '
' * (line_level - prev_level) + '- ' + line_text + '
'
+ output[-1] += '' * (line_level - prev_level) + '- ' + line_text + '
'
elif line_level < prev_level:
- output += '
' * (prev_level - line_level) + '- ' + line_text + '
'
+ output[-1] += '
' * (prev_level - line_level) + '
' + line_text + ''
else:
- output += '
' + line_text + ''
+ output[-1] += '
' + line_text + ''
prev_level = line_level
elif line.strip() == '' and prev_level:
- output += '' * (prev_level)
+ output[-1] += '' * (prev_level)
+ output.append('')
prev_level = 0
- return output
+ if since_prev_release:
+ output.reverse()
+
+ return ''.join(output)
except IOError as e:
logger.error('Tautulli Version Checker :: Unable to open changelog file. %s' % e)
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index e4aa3e7c..dfdefe8d 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -3545,13 +3545,20 @@ class WebInterface(object):
@cherrypy.expose
@requireAuth(member_of("admin"))
- def get_changelog(self, latest_only=False, update_shown=False, **kwargs):
- latest_only = True if latest_only == 'true' else False
+ def get_changelog(self, latest_only=False, since_prev_release=False, update_shown=False, **kwargs):
+ latest_only = (latest_only == 'true')
+ since_prev_release = (since_prev_release == 'true')
+
+ if since_prev_release and plexpy.PREV_RELEASE == common.VERSION_NUMBER:
+ latest_only = True
+ since_prev_release = False
+
# Set update changelog shown status
if update_shown == 'true':
plexpy.CONFIG.__setattr__('UPDATE_SHOW_CHANGELOG', 0)
plexpy.CONFIG.write()
- return versioncheck.read_changelog(latest_only=latest_only)
+
+ return versioncheck.read_changelog(latest_only=latest_only, since_prev_release=since_prev_release)
##### Info #####