Add automatic Android app QR scan verification

This commit is contained in:
JonnyWong16 2017-03-30 19:25:45 -07:00
parent ddf671abd1
commit 40060255ee
4 changed files with 103 additions and 13 deletions

47
plexpy/mobile_app.py Normal file
View file

@ -0,0 +1,47 @@
# This file is part of PlexPy.
#
# PlexPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PlexPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PlexPy. If not, see <http://www.gnu.org/licenses/>.
import plexpy
import database
import helpers
import logger
def get_mobile_devices(device_id=None, device_token=None):
where = where_id = where_token = ''
if device_id or device_token:
where = 'WHERE '
if device_id:
where_id += 'device_id = "%s"' % device_id
if device_token:
where_token = 'device_token = "%s"' % device_token
where += ' AND '.join([w for w in [where_id, where_token] if w])
monitor_db = database.MonitorDatabase()
result = monitor_db.select('SELECT * FROM mobile_devices %s' % where)
return result
def delete_mobile_device(device_id=None):
monitor_db = database.MonitorDatabase()
if device_id:
logger.debug(u"PlexPy Notifiers :: Deleting device_id %s from the database." % device_id)
result = monitor_db.action('DELETE FROM mobile_devices WHERE device_id = ?', [device_id])
return True
else:
return False