Check for IPv4 mapped IPv6 address in PMS logs
This commit is contained in:
@@ -279,6 +279,13 @@ class ActivityProcessor(object):
|
|||||||
if ipv4:
|
if ipv4:
|
||||||
# The logged IP will always be the first match and we don't want localhost entries
|
# The logged IP will always be the first match and we don't want localhost entries
|
||||||
if ipv4[0] != '127.0.0.1':
|
if ipv4[0] != '127.0.0.1':
|
||||||
|
# check if IPv4 mapped IPv6 address (::ffff:xxx.xxx.xxx.xxx)
|
||||||
|
if '::ffff:' + ipv4[0] in line:
|
||||||
|
logger.debug(u"PlexPy ActivityProcessor :: Matched IP address (%s) for stream ratingKey %s "
|
||||||
|
u"and machineIdentifier %s."
|
||||||
|
% ('::ffff:' + ipv4[0], rating_key, machine_id))
|
||||||
|
return '::ffff:' + ipv4[0]
|
||||||
|
else:
|
||||||
logger.debug(u"PlexPy ActivityProcessor :: Matched IP address (%s) for stream ratingKey %s "
|
logger.debug(u"PlexPy ActivityProcessor :: Matched IP address (%s) for stream ratingKey %s "
|
||||||
u"and machineIdentifier %s."
|
u"and machineIdentifier %s."
|
||||||
% (ipv4[0], rating_key, machine_id))
|
% (ipv4[0], rating_key, machine_id))
|
||||||
@@ -302,6 +309,11 @@ class ActivityProcessor(object):
|
|||||||
if ipv4:
|
if ipv4:
|
||||||
# The logged IP will always be the first match and we don't want localhost entries
|
# The logged IP will always be the first match and we don't want localhost entries
|
||||||
if ipv4[0] != '127.0.0.1':
|
if ipv4[0] != '127.0.0.1':
|
||||||
|
if '::ffff:' + ipv4[0] in line:
|
||||||
|
logger.debug(u"PlexPy ActivityProcessor :: Matched IP address (%s) for stream ratingKey %s." %
|
||||||
|
('::ffff:' + ipv4[0], rating_key))
|
||||||
|
return '::ffff:' + ipv4[0]
|
||||||
|
else:
|
||||||
logger.debug(u"PlexPy ActivityProcessor :: Matched IP address (%s) for stream ratingKey %s." %
|
logger.debug(u"PlexPy ActivityProcessor :: Matched IP address (%s) for stream ratingKey %s." %
|
||||||
(ipv4[0], rating_key))
|
(ipv4[0], rating_key))
|
||||||
return ipv4[0]
|
return ipv4[0]
|
||||||
|
Reference in New Issue
Block a user