mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Merge pull request #207 from mcarlton00/py3-library-fixes
Make commands python 2/3 compatible
This commit is contained in:
commit
f874951cf0
1 changed files with 4 additions and 5 deletions
|
@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
from six.moves import queue as Queue
|
from six.moves import range, queue as Queue, zip
|
||||||
|
|
||||||
from kodi_six import xbmc
|
from kodi_six import xbmc
|
||||||
import requests
|
import requests
|
||||||
|
@ -267,9 +267,8 @@ def _get_items(query, server_id=None):
|
||||||
return params_copy
|
return params_copy
|
||||||
|
|
||||||
query_params = [get_query_params(params, offset, LIMIT) \
|
query_params = [get_query_params(params, offset, LIMIT) \
|
||||||
for offset in xrange(params['StartIndex'], items['TotalRecordCount'], LIMIT)]
|
for offset in range(params['StartIndex'], items['TotalRecordCount'], LIMIT)]
|
||||||
|
|
||||||
from itertools import izip
|
|
||||||
# multiprocessing.dummy.Pool completes all requests in multiple threads but has to
|
# multiprocessing.dummy.Pool completes all requests in multiple threads but has to
|
||||||
# complete all tasks before allowing any results to be processed. ThreadPoolExecutor
|
# 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
|
# allows for completed tasks to be processed while other tasks are completed on other
|
||||||
|
@ -279,7 +278,7 @@ def _get_items(query, server_id=None):
|
||||||
|
|
||||||
results = p.map(lambda params: _get(url, params, server_id=server_id), query_params)
|
results = p.map(lambda params: _get(url, params, server_id=server_id), query_params)
|
||||||
|
|
||||||
for params, result in izip(query_params, results):
|
for params, result in zip(query_params, results):
|
||||||
query['params'] = params
|
query['params'] = params
|
||||||
|
|
||||||
result = result or {'Items': []}
|
result = result or {'Items': []}
|
||||||
|
|
Loading…
Reference in a new issue