Add notification for user streaming from a new device

This commit is contained in:
JonnyWong16 2016-07-05 21:30:47 -07:00
parent f4273cafb6
commit 3ccc82f343
9 changed files with 207 additions and 26 deletions

View file

@ -1306,4 +1306,19 @@ class DataFactory(object):
return True
except Exception as e:
logger.warn(u"PlexPy DataFactory :: Unable to execute database query for delete_notification_log: %s." % e)
return False
return False
def get_user_devices(self, user_id=''):
monitor_db = database.MonitorDatabase()
if user_id:
try:
query = 'SELECT machine_id FROM session_history WHERE user_id = ? GROUP BY machine_id'
result = monitor_db.select(query=query, args=[user_id])
except Exception as e:
logger.warn(u"PlexPy DataFactory :: Unable to execute database query for get_user_devices: %s." % e)
return []
else:
return []
return [d['machine_id'] for d in result]