Merge pull request #1664 from croneter/py3-drop-multiprocessing
Lost patience with Kodi 19: drop use of Python multiprocessing entirely
This commit is contained in:
commit
58e800b9d9
2 changed files with 3 additions and 36 deletions
|
@ -247,12 +247,10 @@ def show_listing(xml, plex_type=None, section_id=None, synched=True, key=None):
|
||||||
widgets.KEY = key
|
widgets.KEY = key
|
||||||
# Process all items to show
|
# Process all items to show
|
||||||
all_items = mass_api(xml)
|
all_items = mass_api(xml)
|
||||||
all_items = utils.process_method_on_list(widgets.generate_item, all_items)
|
all_items = [widgets.generate_item(api) for api in all_items]
|
||||||
all_items = utils.process_method_on_list(widgets.prepare_listitem,
|
all_items = [widgets.prepare_listitem(item) for item in all_items]
|
||||||
all_items)
|
|
||||||
# fill that listing...
|
# fill that listing...
|
||||||
all_items = utils.process_method_on_list(widgets.create_listitem,
|
all_items = [widgets.create_listitem(item) for item in all_items]
|
||||||
all_items)
|
|
||||||
xbmcplugin.addDirectoryItems(int(sys.argv[1]), all_items, len(all_items))
|
xbmcplugin.addDirectoryItems(int(sys.argv[1]), all_items, len(all_items))
|
||||||
# end directory listing
|
# end directory listing
|
||||||
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED)
|
xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED)
|
||||||
|
|
|
@ -21,17 +21,6 @@ import xml.etree.ElementTree as undefused_etree
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
import re
|
import re
|
||||||
import gc
|
import gc
|
||||||
try:
|
|
||||||
from multiprocessing.pool import ThreadPool
|
|
||||||
# Annyoing Kodi bug on Android, introduced with
|
|
||||||
# https://github.com/xbmc/xbmc/pull/20034
|
|
||||||
# See https://github.com/croneter/PlexKodiConnect/issues/1641
|
|
||||||
with ThreadPool():
|
|
||||||
pass
|
|
||||||
SUPPORTS_POOL = True
|
|
||||||
except Exception:
|
|
||||||
SUPPORTS_POOL = False
|
|
||||||
|
|
||||||
|
|
||||||
import xbmc
|
import xbmc
|
||||||
import xbmcaddon
|
import xbmcaddon
|
||||||
|
@ -864,26 +853,6 @@ class XmlKodiSetting(object):
|
||||||
return element
|
return element
|
||||||
|
|
||||||
|
|
||||||
def process_method_on_list(method_to_run, items):
|
|
||||||
"""
|
|
||||||
helper method that processes a method on each item with pooling if the
|
|
||||||
system supports it
|
|
||||||
"""
|
|
||||||
all_items = []
|
|
||||||
if SUPPORTS_POOL:
|
|
||||||
pool = ThreadPool()
|
|
||||||
with ThreadPool() as pool:
|
|
||||||
try:
|
|
||||||
all_items = pool.map(method_to_run, items)
|
|
||||||
except Exception:
|
|
||||||
# catch exception to prevent threadpool running forever
|
|
||||||
ERROR(notify=True)
|
|
||||||
else:
|
|
||||||
all_items = [method_to_run(item) for item in items]
|
|
||||||
all_items = [_f for _f in all_items if _f]
|
|
||||||
return all_items
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# WRAPPERS
|
# WRAPPERS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue