cache files are now stored in user dir

This commit is contained in:
Christoph Stahl 2024-09-22 18:58:21 +02:00
parent 0a36f657e2
commit 3f68f657bf
2 changed files with 5 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import asyncio
import os import os
from typing import Any, Optional from typing import Any, Optional
from typing import Tuple from typing import Tuple
from platformdirs import user_cache_dir
from ..entry import Entry from ..entry import Entry
from .source import available_sources from .source import available_sources
@ -20,7 +21,7 @@ class FilesSource(FileBasedSource):
source_name = "files" source_name = "files"
config_schema = FileBasedSource.config_schema | { config_schema = FileBasedSource.config_schema | {
"dir": (str, "Directory to index", "."), "dir": (str, "Directory to index", "."),
"index_file": (str, "Index file", "files-index"), "index_file": (str, "Index file", os.path.join(user_cache_dir("syng"), "files-index")),
} }
def __init__(self, config: dict[str, Any]): def __init__(self, config: dict[str, Any]):

View file

@ -9,6 +9,8 @@ import os
from json import dump, load from json import dump, load
from typing import TYPE_CHECKING, Any, Optional, Tuple, cast from typing import TYPE_CHECKING, Any, Optional, Tuple, cast
from platformdirs import user_cache_dir
try: try:
from minio import Minio from minio import Minio
@ -44,7 +46,7 @@ class S3Source(FileBasedSource):
"secure": (bool, "Use SSL", True), "secure": (bool, "Use SSL", True),
"bucket": (str, "Bucket of the s3", ""), "bucket": (str, "Bucket of the s3", ""),
"tmp_dir": (str, "Folder for\ntemporary download", "/tmp/syng"), "tmp_dir": (str, "Folder for\ntemporary download", "/tmp/syng"),
"index_file": (str, "Index file", "s3-index"), "index_file": (str, "Index file", os.path.join(user_cache_dir("syng"), "s3-index")),
} }
def __init__(self, config: dict[str, Any]): def __init__(self, config: dict[str, Any]):