-
-
Notifications
You must be signed in to change notification settings - Fork 617
Feat: Scrollbar Timeline with {Month-Year} Markers for Home page and AI Tagging page. #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
49d1db2
40737fc
6d3392e
c8c4640
022b278
e4c45ee
ce8e385
c033b95
393c0d7
0328f95
0548607
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,10 @@ | ||||||||||||||||||||||||||||||||
| # Standard library imports | ||||||||||||||||||||||||||||||||
| import sqlite3 | ||||||||||||||||||||||||||||||||
| from typing import List, Tuple, TypedDict | ||||||||||||||||||||||||||||||||
| import json | ||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||
| import datetime | ||||||||||||||||||||||||||||||||
| from PIL import Image, ExifTags | ||||||||||||||||||||||||||||||||
| from typing import Any, List, Mapping, Tuple, TypedDict, Union | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # App-specific imports | ||||||||||||||||||||||||||||||||
| from app.config.settings import ( | ||||||||||||||||||||||||||||||||
|
|
@@ -21,15 +25,130 @@ class ImageRecord(TypedDict): | |||||||||||||||||||||||||||||||
| path: ImagePath | ||||||||||||||||||||||||||||||||
| folder_id: FolderId | ||||||||||||||||||||||||||||||||
| thumbnailPath: str | ||||||||||||||||||||||||||||||||
| metadata: str | ||||||||||||||||||||||||||||||||
| metadata: Union[Mapping[str, Any], str] | ||||||||||||||||||||||||||||||||
| isTagged: bool | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| class UntaggedImageRecord(TypedDict): | ||||||||||||||||||||||||||||||||
| """Represents an image record returned for tagging.""" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| id: ImageId | ||||||||||||||||||||||||||||||||
| path: ImagePath | ||||||||||||||||||||||||||||||||
| folder_id: FolderId | ||||||||||||||||||||||||||||||||
| thumbnailPath: str | ||||||||||||||||||||||||||||||||
| metadata: Mapping[str, Any] | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ImageClassPair = Tuple[ImageId, ClassId] | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def db_create_images_table() -> None: | ||||||||||||||||||||||||||||||||
| def _connect() -> sqlite3.Connection: | ||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| # Ensure ON DELETE CASCADE and other FKs are enforced | ||||||||||||||||||||||||||||||||
| conn.execute("PRAGMA foreign_keys = ON") | ||||||||||||||||||||||||||||||||
| return conn | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def extract_image_metadata(image_path: str) -> dict: | ||||||||||||||||||||||||||||||||
| """Extract metadata for a given image file with detailed debug logging.""" | ||||||||||||||||||||||||||||||||
| # print(f"[DEBUG] extract_image_metadata called for: {image_path}") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if not os.path.exists(image_path): | ||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| "name": os.path.basename(image_path), | ||||||||||||||||||||||||||||||||
| "date_created": None, | ||||||||||||||||||||||||||||||||
| "width": 0, | ||||||||||||||||||||||||||||||||
| "height": 0, | ||||||||||||||||||||||||||||||||
| "file_location": image_path, | ||||||||||||||||||||||||||||||||
| "file_size": 0, | ||||||||||||||||||||||||||||||||
| "item_type": "unknown", | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| stats = os.stat(image_path) | ||||||||||||||||||||||||||||||||
| # print(f"[DEBUG] File exists. Size = {stats.st_size} bytes") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| with Image.open(image_path) as img: | ||||||||||||||||||||||||||||||||
| width, height = img.size | ||||||||||||||||||||||||||||||||
| mime_type = Image.MIME.get(img.format, "unknown") | ||||||||||||||||||||||||||||||||
| # print(f"[DEBUG] Pillow opened image: {width}x{height}, type={mime_type}") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Robust EXIF extraction with safe fallback | ||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| exif_data = ( | ||||||||||||||||||||||||||||||||
| img.getexif() | ||||||||||||||||||||||||||||||||
| if hasattr(img, "getexif") | ||||||||||||||||||||||||||||||||
| else getattr(img, "_getexif", lambda: None)() | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||||||||||
| exif_data = None | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| exif = dict(exif_data) if exif_data else {} | ||||||||||||||||||||||||||||||||
| dt_original = None | ||||||||||||||||||||||||||||||||
| for k, v in exif.items(): | ||||||||||||||||||||||||||||||||
| if ExifTags.TAGS.get(k) == "DateTimeOriginal": | ||||||||||||||||||||||||||||||||
| dt_original = ( | ||||||||||||||||||||||||||||||||
| v.decode("utf-8", "ignore") | ||||||||||||||||||||||||||||||||
| if isinstance(v, (bytes, bytearray)) | ||||||||||||||||||||||||||||||||
| else str(v) | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Safe parse; fall back to mtime without losing width/height | ||||||||||||||||||||||||||||||||
| if dt_original: | ||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| date_created = datetime.datetime.strptime( | ||||||||||||||||||||||||||||||||
| dt_original.strip().split("\x00", 1)[0], | ||||||||||||||||||||||||||||||||
| "%Y:%m:%d %H:%M:%S", | ||||||||||||||||||||||||||||||||
| ).isoformat() | ||||||||||||||||||||||||||||||||
| except ValueError: | ||||||||||||||||||||||||||||||||
| date_created = datetime.datetime.fromtimestamp( | ||||||||||||||||||||||||||||||||
| stats.st_mtime | ||||||||||||||||||||||||||||||||
| ).isoformat() | ||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||
| date_created = datetime.datetime.fromtimestamp( | ||||||||||||||||||||||||||||||||
| stats.st_mtime | ||||||||||||||||||||||||||||||||
| ).isoformat() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| "name": os.path.basename(image_path), | ||||||||||||||||||||||||||||||||
| "date_created": date_created, | ||||||||||||||||||||||||||||||||
| "width": width, | ||||||||||||||||||||||||||||||||
| "height": height, | ||||||||||||||||||||||||||||||||
| "file_location": image_path, | ||||||||||||||||||||||||||||||||
| "file_size": stats.st_size, | ||||||||||||||||||||||||||||||||
| "item_type": mime_type, | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||||||||||
| # print(f"[ERROR] Pillow could not open image {image_path} -> {e}") | ||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| "name": os.path.basename(image_path), | ||||||||||||||||||||||||||||||||
| "date_created": datetime.datetime.fromtimestamp( | ||||||||||||||||||||||||||||||||
| stats.st_mtime | ||||||||||||||||||||||||||||||||
| ).isoformat(), | ||||||||||||||||||||||||||||||||
| "file_location": image_path, | ||||||||||||||||||||||||||||||||
| "file_size": stats.st_size, | ||||||||||||||||||||||||||||||||
| "width": 0, | ||||||||||||||||||||||||||||||||
| "height": 0, | ||||||||||||||||||||||||||||||||
| "item_type": "unknown", | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| "name": os.path.basename(image_path), | ||||||||||||||||||||||||||||||||
| "date_created": None, | ||||||||||||||||||||||||||||||||
| "width": 0, | ||||||||||||||||||||||||||||||||
| "height": 0, | ||||||||||||||||||||||||||||||||
| "file_location": image_path, | ||||||||||||||||||||||||||||||||
| "file_size": 0, | ||||||||||||||||||||||||||||||||
| "item_type": "unknown", | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def db_create_images_table() -> None: | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Create new images table with merged fields | ||||||||||||||||||||||||||||||||
|
|
@@ -69,16 +188,49 @@ def db_bulk_insert_images(image_records: List[ImageRecord]) -> bool: | |||||||||||||||||||||||||||||||
| if not image_records: | ||||||||||||||||||||||||||||||||
| return True | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| # Ensure metadata is properly filled and JSON stringified | ||||||||||||||||||||||||||||||||
| prepared_records = [] | ||||||||||||||||||||||||||||||||
| for record in image_records: | ||||||||||||||||||||||||||||||||
| metadata = record.get("metadata") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Normalize: if metadata is a string, try to parse it | ||||||||||||||||||||||||||||||||
| if isinstance(metadata, str): | ||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| metadata = json.loads(metadata) | ||||||||||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||||||||||
| metadata = {} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # print(f"[DEBUG] Incoming metadata for {record['path']}: {metadata} (type={type(metadata)})") | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # If no metadata provided or it's empty, extract it | ||||||||||||||||||||||||||||||||
| if not metadata or metadata == {}: | ||||||||||||||||||||||||||||||||
| metadata = extract_image_metadata(record["path"]) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Make sure it's stored as a JSON string in DB | ||||||||||||||||||||||||||||||||
| record["metadata"] = json.dumps(metadata) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| prepared_records.append(record) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # print("Prepared metadata:", prepared_records[0]["metadata"]) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| cursor.executemany( | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| INSERT OR IGNORE INTO images (id, path, folder_id, thumbnailPath, metadata, isTagged) | ||||||||||||||||||||||||||||||||
| INSERT INTO images (id, path, folder_id, thumbnailPath, metadata, isTagged) | ||||||||||||||||||||||||||||||||
| VALUES (:id, :path, :folder_id, :thumbnailPath, :metadata, :isTagged) | ||||||||||||||||||||||||||||||||
| """, | ||||||||||||||||||||||||||||||||
| image_records, | ||||||||||||||||||||||||||||||||
| ON CONFLICT(path) DO UPDATE SET | ||||||||||||||||||||||||||||||||
| folder_id=excluded.folder_id, | ||||||||||||||||||||||||||||||||
| thumbnailPath=excluded.thumbnailPath, | ||||||||||||||||||||||||||||||||
| metadata=excluded.metadata, | ||||||||||||||||||||||||||||||||
| isTagged=CASE | ||||||||||||||||||||||||||||||||
| WHEN excluded.isTagged THEN 1 | ||||||||||||||||||||||||||||||||
| ELSE images.isTagged | ||||||||||||||||||||||||||||||||
| END | ||||||||||||||||||||||||||||||||
| """, | ||||||||||||||||||||||||||||||||
| prepared_records, | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| conn.commit() | ||||||||||||||||||||||||||||||||
| return True | ||||||||||||||||||||||||||||||||
|
|
@@ -97,7 +249,7 @@ def db_get_all_images() -> List[dict]: | |||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||
| List of dictionaries containing all image data including tags | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
|
|
@@ -132,18 +284,31 @@ def db_get_all_images() -> List[dict]: | |||||||||||||||||||||||||||||||
| tag_name, | ||||||||||||||||||||||||||||||||
| ) in results: | ||||||||||||||||||||||||||||||||
| if image_id not in images_dict: | ||||||||||||||||||||||||||||||||
| # Safely parse metadata JSON -> dict | ||||||||||||||||||||||||||||||||
| metadata_dict = {} | ||||||||||||||||||||||||||||||||
| if metadata: | ||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| parsed = ( | ||||||||||||||||||||||||||||||||
| json.loads(metadata) | ||||||||||||||||||||||||||||||||
| if isinstance(metadata, str) | ||||||||||||||||||||||||||||||||
| else metadata | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| metadata_dict = parsed if isinstance(parsed, dict) else {} | ||||||||||||||||||||||||||||||||
| except (json.JSONDecodeError, TypeError, ValueError): | ||||||||||||||||||||||||||||||||
| metadata_dict = {} | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| images_dict[image_id] = { | ||||||||||||||||||||||||||||||||
| "id": image_id, | ||||||||||||||||||||||||||||||||
| "path": path, | ||||||||||||||||||||||||||||||||
| "folder_id": folder_id, | ||||||||||||||||||||||||||||||||
| "thumbnailPath": thumbnail_path, | ||||||||||||||||||||||||||||||||
| "metadata": metadata, | ||||||||||||||||||||||||||||||||
| "metadata": metadata_dict, | ||||||||||||||||||||||||||||||||
| "isTagged": bool(is_tagged), | ||||||||||||||||||||||||||||||||
|
Comment on lines
300
to
306
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainfolder_id type mismatch between DB (INTEGER) and frontend (string). Cast on return. Frontend types (Media.ts) expect folder_id: string. Backend currently returns int. Cast to str to avoid subtle client bugs. Apply: - "folder_id": folder_id,
+ "folder_id": str(folder_id),- "folder_id": folder_id,
+ "folder_id": str(folder_id),Run to confirm frontend expects string: Also applies to: 373-378 🏁 Script executed: #!/bin/bash
rg -nC2 'folder_id\s*:\s*string' --type=ts --type=tsxLength of output: 27 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Searching for 'folder_id: string' in .ts/.tsx files..."
rg -nC2 "folder_id\s*:\s*string" -g '!**/node_modules/**' -g '**/*.ts' -g '**/*.tsx' || true
echo "Searching for 'folderId: string' in .ts/.tsx files..."
rg -nC2 "folderId\s*:\s*string" -g '!**/node_modules/**' -g '**/*.ts' -g '**/*.tsx' || true
echo "Searching for any occurrence of 'folder_id' or 'folderId' in .ts/.tsx files..."
rg -nC2 "\b(folder_id|folderId)\b" -g '!**/node_modules/**' -g '**/*.ts' -g '**/*.tsx' || true
echo "Searching for interface/type named Media in .ts/.tsx files..."
rg -nC2 "(interface|type)\s+Media" -g '!**/node_modules/**' -g '**/*.ts' -g '**/*.tsx' || trueLength of output: 12108 Cast folder_id to string in image responses Frontend types (frontend/src/types/Media.ts, frontend/src/types/Folder.ts) declare folder_id as string; backend returns integers — cast to string before returning. Location: backend/app/database/images.py lines 300-306 and 373-378. Apply: - "folder_id": folder_id,
+ "folder_id": str(folder_id),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| "tags": [], | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Add tag if it exists | ||||||||||||||||||||||||||||||||
| if tag_name: | ||||||||||||||||||||||||||||||||
| # Add tag if it exists (avoid duplicates) | ||||||||||||||||||||||||||||||||
| if tag_name and tag_name not in images_dict[image_id]["tags"]: | ||||||||||||||||||||||||||||||||
| images_dict[image_id]["tags"].append(tag_name) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Convert to list and set tags to None if empty | ||||||||||||||||||||||||||||||||
|
|
@@ -165,7 +330,7 @@ def db_get_all_images() -> List[dict]: | |||||||||||||||||||||||||||||||
| conn.close() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| def db_get_untagged_images() -> List[ImageRecord]: | ||||||||||||||||||||||||||||||||
| def db_get_untagged_images() -> List[UntaggedImageRecord]: | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| Find all images that need AI tagging. | ||||||||||||||||||||||||||||||||
| Returns images where: | ||||||||||||||||||||||||||||||||
|
|
@@ -175,7 +340,7 @@ def db_get_untagged_images() -> List[ImageRecord]: | |||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||
| List of dictionaries containing image data: id, path, folder_id, thumbnailPath, metadata | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
|
|
@@ -193,13 +358,23 @@ def db_get_untagged_images() -> List[ImageRecord]: | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| untagged_images = [] | ||||||||||||||||||||||||||||||||
| for image_id, path, folder_id, thumbnail_path, metadata in results: | ||||||||||||||||||||||||||||||||
| md: dict = {} | ||||||||||||||||||||||||||||||||
| if metadata: | ||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
| md = ( | ||||||||||||||||||||||||||||||||
| json.loads(metadata) | ||||||||||||||||||||||||||||||||
| if isinstance(metadata, str) | ||||||||||||||||||||||||||||||||
| else (metadata or {}) | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| except Exception: | ||||||||||||||||||||||||||||||||
| md = {} | ||||||||||||||||||||||||||||||||
| untagged_images.append( | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| "id": image_id, | ||||||||||||||||||||||||||||||||
| "path": path, | ||||||||||||||||||||||||||||||||
| "folder_id": folder_id, | ||||||||||||||||||||||||||||||||
| "thumbnailPath": thumbnail_path, | ||||||||||||||||||||||||||||||||
| "metadata": metadata, | ||||||||||||||||||||||||||||||||
| "metadata": md, | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -220,7 +395,7 @@ def db_update_image_tagged_status(image_id: ImageId, is_tagged: bool = True) -> | |||||||||||||||||||||||||||||||
| Returns: | ||||||||||||||||||||||||||||||||
| True if update was successful, False otherwise | ||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
|
|
@@ -251,7 +426,7 @@ def db_insert_image_classes_batch(image_class_pairs: List[ImageClassPair]) -> bo | |||||||||||||||||||||||||||||||
| if not image_class_pairs: | ||||||||||||||||||||||||||||||||
| return True | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
|
|
@@ -287,7 +462,7 @@ def db_get_images_by_folder_ids( | |||||||||||||||||||||||||||||||
| if not folder_ids: | ||||||||||||||||||||||||||||||||
| return [] | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
|
|
@@ -323,7 +498,7 @@ def db_delete_images_by_ids(image_ids: List[ImageId]) -> bool: | |||||||||||||||||||||||||||||||
| if not image_ids: | ||||||||||||||||||||||||||||||||
| return True | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| conn = sqlite3.connect(DATABASE_PATH) | ||||||||||||||||||||||||||||||||
| conn = _connect() | ||||||||||||||||||||||||||||||||
| cursor = conn.cursor() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.