Add mobile device last seen

This commit is contained in:
JonnyWong16 2017-12-08 22:05:44 -08:00
parent 019787b32d
commit ecd0a199f1
5 changed files with 61 additions and 22 deletions

View file

@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import time
import plexpy
import database
import helpers
@ -121,6 +123,19 @@ def delete_mobile_device(mobile_device_id=None):
return False
def set_last_seen(device_token=None):
db = database.MonitorDatabase()
last_seen = int(time.time())
try:
result = db.action('UPDATE mobile_devices SET last_seen = ? WHERE device_token = ?',
args=[last_seen, device_token])
except Exception as e:
logger.warn(u"PlexPy MobileApp :: Failed to set last_seen time for device: %s." % e)
return
def blacklist_logger():
devices = get_mobile_devices()