mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-07 03:35:24 +00:00
feat: add memosignore
This commit is contained in:
parent
9d64dbc69b
commit
a4a3387bdc
@ -17,6 +17,7 @@ from magika import Magika
|
|||||||
from .config import settings
|
from .config import settings
|
||||||
from .models import init_database
|
from .models import init_database
|
||||||
from .initialize_typesense import init_typesense
|
from .initialize_typesense import init_typesense
|
||||||
|
import pathspec
|
||||||
|
|
||||||
IS_THUMBNAIL = "is_thumbnail"
|
IS_THUMBNAIL = "is_thumbnail"
|
||||||
|
|
||||||
@ -141,6 +142,13 @@ def show(library_id: int):
|
|||||||
|
|
||||||
|
|
||||||
async def loop_files(library_id, folder, folder_path, force, plugins):
|
async def loop_files(library_id, folder, folder_path, force, plugins):
|
||||||
|
# Read .memosignore file
|
||||||
|
ignore_spec = None
|
||||||
|
memosignore_path = Path(folder_path) / '.memosignore'
|
||||||
|
if memosignore_path.exists():
|
||||||
|
with open(memosignore_path, 'r') as ignore_file:
|
||||||
|
ignore_spec = pathspec.PathSpec.from_lines('gitwildmatch', ignore_file)
|
||||||
|
|
||||||
updated_file_count = 0
|
updated_file_count = 0
|
||||||
added_file_count = 0
|
added_file_count = 0
|
||||||
scanned_files = set()
|
scanned_files = set()
|
||||||
@ -155,7 +163,9 @@ async def loop_files(library_id, folder, folder_path, force, plugins):
|
|||||||
for file in files:
|
for file in files:
|
||||||
file_path = Path(root) / file
|
file_path = Path(root) / file
|
||||||
absolute_file_path = file_path.resolve() # Get absolute path
|
absolute_file_path = file_path.resolve() # Get absolute path
|
||||||
if file in ignore_files:
|
relative_path = absolute_file_path.relative_to(folder_path)
|
||||||
|
|
||||||
|
if file in ignore_files or (ignore_spec and ignore_spec.match_file(str(relative_path))):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
scanned_files.add(str(absolute_file_path))
|
scanned_files.add(str(absolute_file_path))
|
||||||
|
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "memos"
|
name = "memos"
|
||||||
version = "0.6.11"
|
version = "0.6.12"
|
||||||
description = "A package for memos"
|
description = "A package for memos"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "arkohut" }]
|
authors = [{ name = "arkohut" }]
|
||||||
@ -43,6 +43,7 @@ dependencies = [
|
|||||||
"einops",
|
"einops",
|
||||||
"modelscope",
|
"modelscope",
|
||||||
"mss",
|
"mss",
|
||||||
|
"pathspec",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user