diff options
author | Michiel van Baak <[email protected]> | 2020-02-09 15:37:11 +0100 |
---|---|---|
committer | Michiel van Baak <[email protected]> | 2020-02-09 15:37:11 +0100 |
commit | d4dd3ca4ded4e7dbb55be8797e42a12beaa00879 (patch) | |
tree | 2b7a1aa4991717794baa7eb0c3fa4743cac8e853 /libs/subzero | |
parent | f92fc69231eb64d6fde4d7d2b4e5abfb1db94ad0 (diff) | |
download | bazarr-d4dd3ca4ded4e7dbb55be8797e42a12beaa00879.tar.gz bazarr-d4dd3ca4ded4e7dbb55be8797e42a12beaa00879.zip |
Use native os.scandir when available
Diffstat (limited to 'libs/subzero')
-rw-r--r-- | libs/subzero/lib/io.py | 5 | ||||
-rw-r--r-- | libs/subzero/subtitle_storage.py | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libs/subzero/lib/io.py b/libs/subzero/lib/io.py index bc28a2ffe..ed46af2ee 100644 --- a/libs/subzero/lib/io.py +++ b/libs/subzero/lib/io.py @@ -4,7 +4,10 @@ from __future__ import absolute_import import os import sys -from scandir import scandir as _scandir +try: + from os import scandir as _scandir +except ImportError: + from scandir import scandir as _scandir # thanks @ plex trakt scrobbler: https://github.com/trakt/Plex-Trakt-Scrobbler/blob/master/Trakttv.bundle/Contents/Libraries/Shared/plugin/core/io.py diff --git a/libs/subzero/subtitle_storage.py b/libs/subzero/subtitle_storage.py index 53a31b8f2..3763362d5 100644 --- a/libs/subzero/subtitle_storage.py +++ b/libs/subzero/subtitle_storage.py @@ -13,7 +13,11 @@ import sys from json_tricks.nonp import loads from subzero.lib.json import dumps -from scandir import scandir, scandir_generic as _scandir_generic +try: + from os import scandir + _scandir_generic = scandir +except ImportError: + from scandir import scandir, scandir_generic as _scandir_generic from .constants import mode_map import six |