Database Service¶
SQLite database management for persistent storage.
Overview¶
The database service provides thread-safe SQLite operations for: - Configuration storage - Watch progress tracking - Download queue management - Local library indexing - Virtual library bookmarks
Database Location¶
Tables¶
config: Key-value configurationprogress: Watch progress and timestampssearch_history: Recent searchesdownload_queue: Download queue itemsexternal_drives: External drive pathsanime_index: Local anime indexvirtual_library: Online anime bookmarks
Usage¶
from weeb_cli.services.database import db
# Configuration
db.set_config("key", "value")
value = db.get_config("key")
# Progress
db.save_progress(slug, title, episode, total)
progress = db.get_progress(slug)
# Queue
db.add_to_queue(item)
queue = db.get_queue()
Thread Safety¶
Database uses: - RLock for thread safety - WAL mode for concurrent access - Connection pooling - Automatic retry on busy
Next Steps¶
- API Reference: Full API docs
- Configuration: Config guide