mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
Add IP modal to info screen.
Display notice for minimum version of PW database import. Address a bug where a newly added user's watch history would be logged as "Local" until next user list refresh.
This commit is contained in:
parent
c02b7a0079
commit
a393d1a50a
3 changed files with 76 additions and 12 deletions
|
@ -191,6 +191,8 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
<div id="info-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="info-modal">
|
<div id="info-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="info-modal">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal fade" id="ip-info-modal" tabindex="-1" role="dialog" aria-labelledby="ip-info-modal">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
<h4 class="modal-title">Import PlexWatch Database</h4>
|
<h4 class="modal-title">Import PlexWatch Database</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body" id="modal-text">
|
<div class="modal-body" id="modal-text">
|
||||||
|
<p class="help-block">
|
||||||
|
Please ensure your PlexWatch database is at version 0.3.2 or higher.
|
||||||
|
</p>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="db_location">Database Location</label>
|
<label for="db_location">Database Location</label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -308,6 +308,8 @@ class DataFactory(object):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_user_details(self, user=None, user_id=None):
|
def get_user_details(self, user=None, user_id=None):
|
||||||
|
from plexpy import plextv
|
||||||
|
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
|
@ -361,18 +363,75 @@ class DataFactory(object):
|
||||||
}
|
}
|
||||||
return user_details
|
return user_details
|
||||||
else:
|
else:
|
||||||
# If there is no user data we must return something
|
logger.warn(u"PlexPy :: Unable to retrieve user from local database. Requesting user list refresh.")
|
||||||
# Use "Local" user to retain compatibility with PlexWatch database value
|
# Let's first refresh the user list to make sure the user isn't newly added and not in the db yet
|
||||||
return {"user_id": None,
|
if user:
|
||||||
"username": 'Local',
|
# Refresh users
|
||||||
"friendly_name": 'Local',
|
plextv.refresh_users()
|
||||||
"email": '',
|
query = 'SELECT user_id, username, friendly_name, email, ' \
|
||||||
"thumb": '',
|
'thumb, is_home_user, is_allow_sync, is_restricted, do_notify ' \
|
||||||
"is_home_user": 0,
|
'FROM users ' \
|
||||||
"is_allow_sync": 0,
|
'WHERE username = ? ' \
|
||||||
"is_restricted": 0,
|
'UNION ALL ' \
|
||||||
"do_notify": 0
|
'SELECT null, user, null, null, null, null, null, null, null ' \
|
||||||
}
|
'FROM session_history ' \
|
||||||
|
'WHERE user = ? ' \
|
||||||
|
'GROUP BY user ' \
|
||||||
|
'LIMIT 1'
|
||||||
|
result = monitor_db.select(query, args=[user, user])
|
||||||
|
elif user_id:
|
||||||
|
# Refresh users
|
||||||
|
plextv.refresh_users()
|
||||||
|
query = 'SELECT user_id, username, friendly_name, email, ' \
|
||||||
|
'thumb, is_home_user, is_allow_sync, is_restricted, do_notify ' \
|
||||||
|
'FROM users ' \
|
||||||
|
'WHERE user_id = ? ' \
|
||||||
|
'UNION ALL ' \
|
||||||
|
'SELECT user_id, user, null, null, null, null, null, null, null ' \
|
||||||
|
'FROM session_history ' \
|
||||||
|
'WHERE user_id = ? ' \
|
||||||
|
'GROUP BY user ' \
|
||||||
|
'LIMIT 1'
|
||||||
|
result = monitor_db.select(query, args=[user_id, user_id])
|
||||||
|
else:
|
||||||
|
result = None
|
||||||
|
|
||||||
|
if result:
|
||||||
|
user_details = {}
|
||||||
|
for item in result:
|
||||||
|
if not item['friendly_name']:
|
||||||
|
friendly_name = item['username']
|
||||||
|
else:
|
||||||
|
friendly_name = item['friendly_name']
|
||||||
|
if not item['thumb'] or item['thumb'] == '':
|
||||||
|
user_thumb = common.DEFAULT_USER_THUMB
|
||||||
|
else:
|
||||||
|
user_thumb = item['thumb']
|
||||||
|
|
||||||
|
user_details = {"user_id": item['user_id'],
|
||||||
|
"username": item['username'],
|
||||||
|
"friendly_name": friendly_name,
|
||||||
|
"email": item['email'],
|
||||||
|
"thumb": user_thumb,
|
||||||
|
"is_home_user": item['is_home_user'],
|
||||||
|
"is_allow_sync": item['is_allow_sync'],
|
||||||
|
"is_restricted": item['is_restricted'],
|
||||||
|
"do_notify": item['do_notify']
|
||||||
|
}
|
||||||
|
return user_details
|
||||||
|
else:
|
||||||
|
# If there is no user data we must return something
|
||||||
|
# Use "Local" user to retain compatibility with PlexWatch database value
|
||||||
|
return {"user_id": None,
|
||||||
|
"username": 'Local',
|
||||||
|
"friendly_name": 'Local',
|
||||||
|
"email": '',
|
||||||
|
"thumb": '',
|
||||||
|
"is_home_user": 0,
|
||||||
|
"is_allow_sync": 0,
|
||||||
|
"is_restricted": 0,
|
||||||
|
"do_notify": 0
|
||||||
|
}
|
||||||
|
|
||||||
def get_home_stats(self, time_range='30'):
|
def get_home_stats(self, time_range='30'):
|
||||||
monitor_db = database.MonitorDatabase()
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue