mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Refactor some code
This commit is contained in:
parent
ab34a74210
commit
754fd24421
9 changed files with 24 additions and 24 deletions
|
@ -47,7 +47,7 @@
|
|||
You are running an unknown version of Tautulli.<br />
|
||||
<a href="update">Update</a> or <a href="#" id="updateDismiss">Dismiss</a>
|
||||
</div>
|
||||
% elif plexpy.CONFIG.CHECK_GITHUB and plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and plexpy.common.VERSION_NUMBER != plexpy.LATEST_RELEASE:
|
||||
% elif plexpy.CONFIG.CHECK_GITHUB and plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
|
||||
<div id="updatebar" style="display: none;">
|
||||
A <a href="${anon_url('https://github.com/%s/%s/releases/tag/%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, plexpy.LATEST_RELEASE))}" target="_blank">
|
||||
new release (${plexpy.LATEST_RELEASE})</a> of Tautulli is available!<br />
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
<%def name="modalIncludes()">
|
||||
|
||||
% if _session['user_group'] == 'admin' and config['update_show_changelog']:
|
||||
<% from plexpy.common import VERSION_NUMBER %>
|
||||
<% from plexpy.common import RELEASE %>
|
||||
<div id="changelog-modal" class="modal fade wide" tabindex="-1" role="dialog" aria-labelledby="changelog-modal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
|
@ -60,9 +60,9 @@
|
|||
<input type="hidden" id="show_advanced_settings" name="show_advanced_settings" value="${config['show_advanced_settings']}" required>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="tabs-help_info">
|
||||
% if common.VERSION_NUMBER:
|
||||
% if common.RELEASE:
|
||||
<div class="padded-header">
|
||||
<h3>Version ${common.VERSION_NUMBER} <small><a id="changelog-modal-link" href="#"><i class="fa fa-info-circle"></i> Changelog</a></small></h3>
|
||||
<h3>Version ${common.RELEASE} <small><a id="changelog-modal-link" href="#"><i class="fa fa-info-circle"></i> Changelog</a></small></h3>
|
||||
</div>
|
||||
% endif
|
||||
<div class="padded-header">
|
||||
|
|
|
@ -240,7 +240,7 @@ def initialize(config_file):
|
|||
|
||||
# Get the previous release from the file
|
||||
release_file = os.path.join(DATA_DIR, "release.lock")
|
||||
PREV_RELEASE = common.VERSION_NUMBER
|
||||
PREV_RELEASE = common.RELEASE
|
||||
if os.path.isfile(release_file):
|
||||
try:
|
||||
with open(release_file, "r") as fp:
|
||||
|
@ -252,7 +252,7 @@ def initialize(config_file):
|
|||
PREV_RELEASE = 'v1.4.25'
|
||||
|
||||
# Check if the release was updated
|
||||
if common.VERSION_NUMBER != PREV_RELEASE:
|
||||
if common.RELEASE != PREV_RELEASE:
|
||||
CONFIG.UPDATE_SHOW_CHANGELOG = 1
|
||||
CONFIG.write()
|
||||
_UPDATE = True
|
||||
|
@ -260,7 +260,7 @@ def initialize(config_file):
|
|||
# Write current release version to file for update checking
|
||||
try:
|
||||
with open(release_file, "w") as fp:
|
||||
fp.write(common.VERSION_NUMBER)
|
||||
fp.write(common.RELEASE)
|
||||
except IOError as e:
|
||||
logger.error(u"Unable to write current release to file '%s': %s" %
|
||||
(release_file, e))
|
||||
|
@ -1693,7 +1693,7 @@ def initialize_tracker():
|
|||
data = {
|
||||
'dataSource': 'server',
|
||||
'appName': 'Tautulli',
|
||||
'appVersion': common.VERSION_NUMBER,
|
||||
'appVersion': common.RELEASE,
|
||||
'appId': plexpy.INSTALL_TYPE,
|
||||
'appInstallerId': plexpy.CONFIG.GIT_BRANCH,
|
||||
'dimension1': '{} {}'.format(common.PLATFORM, common.PLATFORM_VERSION), # App Platform
|
||||
|
@ -1702,7 +1702,8 @@ def initialize_tracker():
|
|||
'noninteractive': True
|
||||
}
|
||||
|
||||
tracker = Tracker.create('UA-111522699-2', client_id=CONFIG.PMS_UUID, hash_client_id=True)
|
||||
tracker = Tracker.create('UA-111522699-2', client_id=CONFIG.PMS_UUID, hash_client_id=True,
|
||||
user_agent=common.USER_AGENT)
|
||||
tracker.set(data)
|
||||
|
||||
return tracker
|
||||
|
|
|
@ -19,13 +19,12 @@ from collections import OrderedDict
|
|||
import version
|
||||
|
||||
# Identify Our Application
|
||||
USER_AGENT = 'Tautulli/-' + version.PLEXPY_BRANCH + ' v' + version.PLEXPY_RELEASE_VERSION + ' (' + platform.system() + \
|
||||
' ' + platform.release() + ')'
|
||||
|
||||
PLATFORM = platform.system()
|
||||
PLATFORM_VERSION = platform.release()
|
||||
BRANCH = version.PLEXPY_BRANCH
|
||||
VERSION_NUMBER = version.PLEXPY_RELEASE_VERSION
|
||||
RELEASE = version.PLEXPY_RELEASE_VERSION
|
||||
|
||||
USER_AGENT = 'Tautulli/{} ({} {})'.format(RELEASE, PLATFORM, PLATFORM_VERSION)
|
||||
|
||||
DEFAULT_USER_THUMB = "interfaces/default/images/gravatar-default-80x80.png"
|
||||
DEFAULT_POSTER_THUMB = "interfaces/default/images/poster.png"
|
||||
|
|
|
@ -41,7 +41,7 @@ class HTTPHandler(object):
|
|||
|
||||
self.headers = {'X-Plex-Device-Name': 'Tautulli',
|
||||
'X-Plex-Product': 'Tautulli',
|
||||
'X-Plex-Version': plexpy.common.VERSION_NUMBER,
|
||||
'X-Plex-Version': plexpy.common.RELEASE,
|
||||
'X-Plex-Platform': plexpy.common.PLATFORM,
|
||||
'X-Plex-Platform-Version': plexpy.common.PLATFORM_VERSION,
|
||||
'X-Plex-Client-Identifier': plexpy.CONFIG.PMS_UUID,
|
||||
|
|
|
@ -677,7 +677,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
|
|||
|
||||
available_params = {
|
||||
# Global paramaters
|
||||
'tautulli_version': common.VERSION_NUMBER,
|
||||
'tautulli_version': common.RELEASE,
|
||||
'tautulli_remote': plexpy.CONFIG.GIT_REMOTE,
|
||||
'tautulli_branch': plexpy.CONFIG.GIT_BRANCH,
|
||||
'tautulli_commit': plexpy.CURRENT_VERSION,
|
||||
|
@ -877,7 +877,7 @@ def build_server_notify_params(notify_action=None, **kwargs):
|
|||
|
||||
available_params = {
|
||||
# Global paramaters
|
||||
'tautulli_version': common.VERSION_NUMBER,
|
||||
'tautulli_version': common.RELEASE,
|
||||
'tautulli_remote': plexpy.CONFIG.GIT_REMOTE,
|
||||
'tautulli_branch': plexpy.CONFIG.GIT_BRANCH,
|
||||
'tautulli_commit': plexpy.CURRENT_VERSION,
|
||||
|
|
|
@ -20,9 +20,9 @@ import subprocess
|
|||
import tarfile
|
||||
|
||||
import plexpy
|
||||
import common
|
||||
import logger
|
||||
import request
|
||||
import version
|
||||
|
||||
|
||||
def runGit(args):
|
||||
|
@ -65,7 +65,7 @@ def runGit(args):
|
|||
|
||||
def getVersion():
|
||||
|
||||
if version.PLEXPY_BRANCH.startswith('win32build'):
|
||||
if common.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
|
||||
|
@ -120,15 +120,15 @@ def getVersion():
|
|||
version_file = os.path.join(plexpy.PROG_DIR, 'version.txt')
|
||||
|
||||
if not os.path.isfile(version_file):
|
||||
return None, 'origin', 'master'
|
||||
return None, 'origin', common.BRANCH
|
||||
|
||||
with open(version_file, 'r') as f:
|
||||
current_version = f.read().strip(' \n\r')
|
||||
|
||||
if current_version:
|
||||
return current_version, plexpy.CONFIG.GIT_REMOTE, plexpy.CONFIG.GIT_BRANCH
|
||||
return current_version, 'origin', common.BRANCH
|
||||
else:
|
||||
return None, 'origin', 'master'
|
||||
return None, 'origin', common.BRANCH
|
||||
|
||||
|
||||
def checkGithub(auto_update=False):
|
||||
|
|
|
@ -63,7 +63,7 @@ def serve_template(templatename, **kwargs):
|
|||
|
||||
http_root = plexpy.HTTP_ROOT
|
||||
server_name = plexpy.CONFIG.PMS_NAME
|
||||
cache_param = '?' + (plexpy.CURRENT_VERSION or common.VERSION_NUMBER)
|
||||
cache_param = '?' + (plexpy.CURRENT_VERSION or common.RELEASE)
|
||||
|
||||
_session = get_session_info()
|
||||
|
||||
|
@ -3581,7 +3581,7 @@ class WebInterface(object):
|
|||
}
|
||||
|
||||
elif plexpy.COMMITS_BEHIND > 0 and plexpy.common.BRANCH in ('master', 'beta') and \
|
||||
plexpy.common.VERSION_NUMBER != plexpy.LATEST_RELEASE:
|
||||
plexpy.common.RELEASE != plexpy.LATEST_RELEASE:
|
||||
return {'result': 'success',
|
||||
'update': True,
|
||||
'release': True,
|
||||
|
@ -3668,7 +3668,7 @@ class WebInterface(object):
|
|||
latest_only = (latest_only == 'true')
|
||||
since_prev_release = (since_prev_release == 'true')
|
||||
|
||||
if since_prev_release and plexpy.PREV_RELEASE == common.VERSION_NUMBER:
|
||||
if since_prev_release and plexpy.PREV_RELEASE == common.RELEASE:
|
||||
latest_only = True
|
||||
since_prev_release = False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue