aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/indexer/enrich.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/indexer/enrich.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/indexer/enrich.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/indexer/enrich.py b/packages/meshbay-node/src/meshbay_node/indexer/enrich.py
index 9881298..53f1b27 100644
--- a/packages/meshbay-node/src/meshbay_node/indexer/enrich.py
+++ b/packages/meshbay-node/src/meshbay_node/indexer/enrich.py
@@ -13,14 +13,16 @@ the rest asynchronously and hands the result back via a callback.
import asyncio
import logging
+import os
from collections.abc import Awaitable, Callable
from pathlib import Path
import blake3
+from meshbay_common.paths import long_path
from meshbay_common.protocol import IndexEntry
from meshbay_node.indexer import title_parse
-from meshbay_node.indexer.indexer import MEDIA_EXTENSIONS
+from meshbay_node.indexer.indexer import MEDIA_EXTENSIONS, walk_files
from meshbay_node.media_cache import MediaCache
from meshbay_node.media_probe import probe_video
@@ -102,7 +104,8 @@ def _title_from_siblings(file_path: Path) -> str | None:
from another Special just like this one.
"""
try:
- names = sorted(p.name for p in file_path.parent.iterdir() if p.is_file())
+ with os.scandir(long_path(file_path.parent)) as listing:
+ names = sorted(e.name for e in listing if e.is_file())
except OSError:
return None
checked = 0
@@ -142,8 +145,8 @@ def _synthetic_episode_number(file_path: Path, show_root: Path, season: int) ->
"""
try:
candidates = sorted(
- (p for p in show_root.rglob("*")
- if p.is_file() and p.suffix.lower() in MEDIA_EXTENSIONS["video"]),
+ (p for p in walk_files(show_root)
+ if p.suffix.lower() in MEDIA_EXTENSIONS["video"]),
key=lambda p: (str(p.parent), p.name),
)
except OSError: