Add support for incremental updates in gallery generation

- Introduced `source_to_update` parameter to selectively regenerate specific sources.
- Updated documentation to reflect new behavior for `clean_first` and `source_to_update`.
- Modified CLI and legacy CLI to handle source overrides appropriately.
This commit is contained in:
Kylian Schmidt
2026-04-23 13:09:26 +02:00
parent a30149e5da
commit 6f0cf4521b
3 changed files with 52 additions and 13 deletions
+10 -6
View File
@@ -68,7 +68,9 @@ Examples:
config = GalleryConfig.from_yaml(args.config)
# Handle source override
source_to_update = None
if args.source:
from gallery.config import GallerySource
source_path = Path(args.source).resolve()
# Check if source is in config
@@ -80,24 +82,26 @@ Examples:
# If not in config, create a temporary source entry
if matching_source is None:
from gallery.config import GallerySource
source_name = source_path.name
config.sources = [
GallerySource(name=source_name, path=source_path)
]
source_to_update = GallerySource(
name=source_name,
path=source_path
)
config.sources.append(source_to_update)
if args.verbose:
print(
f"Source {args.source} not in config. "
f"Adding temporarily as '{source_name}'"
)
else:
config.sources = [matching_source]
source_to_update = matching_source
# Generate gallery
success = generate(
config=config,
clean_first=args.clean,
verbose=args.verbose
verbose=args.verbose,
source_to_update=source_to_update
)
sys.exit(0 if success else 1)