More rename, more -python2
This commit is contained in:
@@ -15,31 +15,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from future.builtins import next
|
||||
from future.builtins import str
|
||||
from future.builtins import object
|
||||
|
||||
import base64
|
||||
import json
|
||||
|
||||
import jellypy
|
||||
if jellypy.PYTHON2:
|
||||
import common
|
||||
import helpers
|
||||
import http_handler
|
||||
import logger
|
||||
import users
|
||||
import pmsconnect
|
||||
import session
|
||||
else:
|
||||
from jellypy import common
|
||||
from jellypy import helpers
|
||||
from jellypy import http_handler
|
||||
from jellypy import logger
|
||||
from jellypy import users
|
||||
from jellypy import pmsconnect
|
||||
from jellypy import session
|
||||
|
||||
from jellypy import common
|
||||
from jellypy import helpers
|
||||
from jellypy import http_handler
|
||||
from jellypy import logger
|
||||
from jellypy import users
|
||||
from jellypy import pmsconnect
|
||||
from jellypy import session
|
||||
|
||||
|
||||
def get_server_resources(return_presence=False, return_server=False, return_info=False, **kwargs):
|
||||
@@ -212,7 +198,8 @@ class PlexTV(object):
|
||||
if force:
|
||||
logger.debug("Tautulli PlexTV :: Forcing refresh of Plex.tv token.")
|
||||
devices_list = self.get_devices_list()
|
||||
device_id = next((d for d in devices_list if d['device_identifier'] == jellypy.CONFIG.PMS_UUID), {}).get('device_id', None)
|
||||
device_id = next((d for d in devices_list if d['device_identifier'] == jellypy.CONFIG.PMS_UUID), {}).get(
|
||||
'device_id', None)
|
||||
|
||||
if device_id:
|
||||
logger.debug("Tautulli PlexTV :: Removing Tautulli from Plex.tv devices.")
|
||||
@@ -233,7 +220,6 @@ class PlexTV(object):
|
||||
logger.info("Tautulli PlexTV :: Updated Plex.tv token for Tautulli.")
|
||||
return token
|
||||
|
||||
|
||||
def get_server_token(self):
|
||||
servers = self.get_plextv_resources(output_format='xml')
|
||||
server_token = ''
|
||||
@@ -794,7 +780,8 @@ class PlexTV(object):
|
||||
'port': helpers.get_xml_attr(c, 'port'),
|
||||
'uri': helpers.get_xml_attr(c, 'uri'),
|
||||
'local': helpers.get_xml_attr(c, 'local'),
|
||||
'value': helpers.get_xml_attr(c, 'address') + ':' + helpers.get_xml_attr(c, 'port'),
|
||||
'value': helpers.get_xml_attr(c, 'address') + ':' + helpers.get_xml_attr(c,
|
||||
'port'),
|
||||
'is_cloud': is_cloud
|
||||
}
|
||||
clean_servers.append(server)
|
||||
@@ -826,15 +813,17 @@ class PlexTV(object):
|
||||
# Get the updates for the platform
|
||||
pms_platform = common.PMS_PLATFORM_NAME_OVERRIDES.get(jellypy.CONFIG.PMS_PLATFORM, jellypy.CONFIG.PMS_PLATFORM)
|
||||
platform_downloads = available_downloads.get('computer').get(pms_platform) or \
|
||||
available_downloads.get('nas').get(pms_platform)
|
||||
available_downloads.get('nas').get(pms_platform)
|
||||
|
||||
if not platform_downloads:
|
||||
logger.error("Tautulli PlexTV :: Unable to retrieve Plex updates: Could not match server platform: %s."
|
||||
% pms_platform)
|
||||
return {}
|
||||
|
||||
v_old = helpers.cast_to_int("".join(v.zfill(4) for v in jellypy.CONFIG.PMS_VERSION.split('-')[0].split('.')[:4]))
|
||||
v_new = helpers.cast_to_int("".join(v.zfill(4) for v in platform_downloads.get('version', '').split('-')[0].split('.')[:4]))
|
||||
v_old = helpers.cast_to_int(
|
||||
"".join(v.zfill(4) for v in jellypy.CONFIG.PMS_VERSION.split('-')[0].split('.')[:4]))
|
||||
v_new = helpers.cast_to_int(
|
||||
"".join(v.zfill(4) for v in platform_downloads.get('version', '').split('-')[0].split('.')[:4]))
|
||||
|
||||
if not v_old:
|
||||
logger.error("Tautulli PlexTV :: Unable to retrieve Plex updates: Invalid current server version: %s."
|
||||
@@ -983,7 +972,7 @@ class PlexTV(object):
|
||||
"latitude": latitude,
|
||||
"longitude": longitude,
|
||||
"continent": None, # keep for backwards compatibility with GeoLite2
|
||||
"accuracy": None # keep for backwards compatibility with GeoLite2
|
||||
"accuracy": None # keep for backwards compatibility with GeoLite2
|
||||
}
|
||||
|
||||
return geo_info
|
||||
|
||||
Reference in New Issue
Block a user