From 5479ba2775d7c151bd36870540e75d0030ddf594 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 22 Feb 2020 23:23:14 -0500 Subject: [PATCH] Make commands python 2/3 compatible --- jellyfin_kodi/downloader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/downloader.py b/jellyfin_kodi/downloader.py index 3b734deb..02ca60bb 100644 --- a/jellyfin_kodi/downloader.py +++ b/jellyfin_kodi/downloader.py @@ -15,6 +15,14 @@ from jellyfin import Jellyfin from jellyfin import api from jellyfin.exceptions import HTTPException +# Python 2/3 Compatible things +import sys +if sys.version.startswith('3'): + xrange = range + izip = zip +else: + from itertools import izip + ################################################################################################# LOG = logging.getLogger("JELLYFIN." + __name__) @@ -269,7 +277,6 @@ def _get_items(query, server_id=None): query_params = [get_query_params(params, offset, LIMIT) \ for offset in xrange(params['StartIndex'], items['TotalRecordCount'], LIMIT)] - from itertools import izip # multiprocessing.dummy.Pool completes all requests in multiple threads but has to # complete all tasks before allowing any results to be processed. ThreadPoolExecutor # allows for completed tasks to be processed while other tasks are completed on other