mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Fix IP address logging
This commit is contained in:
parent
fac47ee68b
commit
908ce1ff8d
1 changed files with 5 additions and 7 deletions
|
@ -39,7 +39,6 @@ class ActivityProcessor(object):
|
||||||
'parent_title': session['parent_title'],
|
'parent_title': session['parent_title'],
|
||||||
'grandparent_title': session['grandparent_title'],
|
'grandparent_title': session['grandparent_title'],
|
||||||
'friendly_name': session['friendly_name'],
|
'friendly_name': session['friendly_name'],
|
||||||
'ip_address': session['ip_address'],
|
|
||||||
'player': session['player'],
|
'player': session['player'],
|
||||||
'platform': session['platform'],
|
'platform': session['platform'],
|
||||||
'parent_rating_key': session['parent_rating_key'],
|
'parent_rating_key': session['parent_rating_key'],
|
||||||
|
@ -78,20 +77,19 @@ class ActivityProcessor(object):
|
||||||
threading.Thread(target=notification_handler.notify,
|
threading.Thread(target=notification_handler.notify,
|
||||||
kwargs=dict(stream_data=values, notify_action='play')).start()
|
kwargs=dict(stream_data=values, notify_action='play')).start()
|
||||||
|
|
||||||
|
# If it's our first write then time stamp it.
|
||||||
started = int(time.time())
|
started = int(time.time())
|
||||||
timestamp = {'started': started}
|
timestamp = {'started': started}
|
||||||
|
self.db.upsert('sessions', timestamp, keys)
|
||||||
|
|
||||||
|
ip_address = {'ip_address': session['ip_address']}
|
||||||
# Try and grab IP address from logs (fallback if not on PMS 0.9.14 and above)
|
# Try and grab IP address from logs (fallback if not on PMS 0.9.14 and above)
|
||||||
if not session['ip_address']:
|
if not session['ip_address']:
|
||||||
if plexpy.CONFIG.IP_LOGGING_ENABLE and plexpy.CONFIG.PMS_LOGS_FOLDER:
|
if plexpy.CONFIG.IP_LOGGING_ENABLE and plexpy.CONFIG.PMS_LOGS_FOLDER:
|
||||||
ip_address = self.find_session_ip(rating_key=session['rating_key'],
|
ip_address = self.find_session_ip(rating_key=session['rating_key'],
|
||||||
machine_id=session['machine_id'])
|
machine_id=session['machine_id'])
|
||||||
timestamp.update({'ip_address': ip_address})
|
ip_address = {'ip_address': ip_address}
|
||||||
else:
|
self.db.upsert('sessions', ip_address, keys)
|
||||||
timestamp.update({'ip_address': None})
|
|
||||||
|
|
||||||
# If it's our first write then time stamp it.
|
|
||||||
self.db.upsert('sessions', timestamp, keys)
|
|
||||||
|
|
||||||
def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0):
|
def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0):
|
||||||
from plexpy import users
|
from plexpy import users
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue