From 10e32d8db94a6a4f9e791ee75b9aecc082daf28a Mon Sep 17 00:00:00 2001 From: Roland Date: Fri, 16 Dec 2022 09:41:25 -0700 Subject: [PATCH] Removing special indexer handler in favor of overwriting mimetype with more specific mimetype. --- wrolpi/files/indexers.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/wrolpi/files/indexers.py b/wrolpi/files/indexers.py index 7533ab4f..9b9e5374 100644 --- a/wrolpi/files/indexers.py +++ b/wrolpi/files/indexers.py @@ -34,10 +34,6 @@ class Indexer(object): a = cls.get_title(file) return a, None, None, None - @classmethod - def detect_special_indexer(cls, file): - return cls - class DefaultIndexer(Indexer, ABC): """If this Indexer is used, it is because we could not match the file to a more specific Indexer.""" @@ -59,8 +55,6 @@ def find_indexer(file) -> Type[Indexer]: # Use the broad indexer. indexer = indexer_map[file.mimetype.split('/')[0]] - indexer = indexer.detect_special_indexer(file) - return indexer @@ -110,8 +104,6 @@ class TextIndexer(Indexer, ABC): Detects VTT (caption) files and forwards them on.""" - _ignored_suffixes = ('.json', '.vtt', '.srt', '.csv', '.hgt', '.scad') - @classmethod def create_index(cls, file): path = file.path.path if hasattr(file.path, 'path') else file.path @@ -127,13 +119,6 @@ class TextIndexer(Indexer, ABC): words = WORD_SPLITTER.findall(contents) return words - @classmethod - def detect_special_indexer(cls, file): - if any(file.path.name.endswith(i) for i in cls._ignored_suffixes): - # Some text files aren't for humans. - return DefaultIndexer - return cls - @register_indexer('application/pdf') class PDFIndexer(Indexer, ABC):