Skip to content

Commit

Permalink
improved generator-search by disabling libmagic
Browse files Browse the repository at this point in the history
  • Loading branch information
Barakudum committed Feb 4, 2024
1 parent 324c44a commit 61b87c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/jarklin/cache/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def generate_info_file():
for generator in generators:
source = generator.source
dest = generator.dest
logging.info(f"Cache: adding {generator}")
logging.debug(f"Cache: adding {generator}")
if is_deprecated(source=source, dest=dest) or is_incomplete(dest=dest):
logging.info(f"Cache: generating {generator}")
try:
Expand All @@ -128,6 +128,7 @@ def generate_info_file():
generate_info_file()

def find_generators(self) -> t.List[CacheGenerator]:
logging.info("Collecting Generators")
generators: t.List[CacheGenerator] = []

for root, dirnames, filenames in os.walk(self.root):
Expand Down
4 changes: 2 additions & 2 deletions src/jarklin/cache/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
any_number = re.compile(r"\d")


def get_mimetype(fp: PathSource) -> str:
def get_mimetype(fp: PathSource, *, quick: bool = True) -> str:
fp = Path(fp)
if magic:
if magic and not quick:
try:
return magic.from_file(fp, mime=True)
except (IsADirectoryError, FileNotFoundError):
Expand Down

0 comments on commit 61b87c0

Please sign in to comment.