Catalog: File Metadata
Introduction
This document specifices the use and Implementation of catalog and related files updates in the context of the use of File Metadata.
Key features & technical changes in v2.8
1. File Type fields
- Feature: enhanced file type management using KFileMetadata extension list.
file_typehas a specific definition in Katalog: see Create#enhanced-file-type-filtering- New database columns:
file_extension,file_type,mime_type,mime_verified,type_mismatch file_extensionandfile_typeare required for Search functionality to work
2. Metadata Fields
- To be populated based on
includeMetadatafield of the tablecatalog. - see settings: None, Media_Basic, Media_Extended, Full_Extended Create#metadata-extraction
- New database columns in
fileandfiletemptables for Media_Basic:
- Image:image_width,image_height,image_orientation
- Video:video_duration_seconds,video_width,video_height,video_codec,video_framerate,video_bitrate
- Audio:audio_duration_seconds,audio_bitrate,audio_sample_rate,audio_artist,audio_album,audio_title,audio_genre,audio_year,audio_track_number - New database columns in
fileandfiletemptables for Media_Extended and Full_Extended:
-metadata_extendedTEXT (JSON) - New database columns in
fileandfiletemptables for overall metadata management: metadata_extraction_dateTEXT (ISO format timestamp)
3. Main user needs
- The User shall be able to transition from Katalog v2.7 (or earlier) to v2.8 without being forced to run long batch process immediately
- The User shall be able to see when Katalog is running specific conversion processes and their progress
- The User shall be able to change a catalog includeMetadata option at any time and to decide when to run the updates
2. Incremental Indexing
- New mechanism limiting metadata extraction processing:
- includeMetadata = "None": Only updates exact file changes (unchanged/deleted/added/modified)
- includeMetadata != "None": also extracts metadata for changed files or files missing
metadata_extraction_date
Database Schema: Metadata Fields
2. Incremental Indexing
- New mechanism limiting metadata extraction processing:
- includeMetadata = "None": Only updates exact file changes (unchanged/deleted/added/modified)
- includeMetadata != "None": also extracts metadata for changed files or files missing
metadata_extraction_date
Catalog Parameters Affecting File Selection
Changes to these 4 fields require catalog update:
fileType(All/Image/Audio/Video/Text/Other/None)includeHidden(boolean)includeMetadata(None/Media_Basic/Media_Extended/Full_Extended)isFullDevice(boolean) - Currently not used
Update Trigger Behavior
- UI prompts user to update immediately after editing these fields
- User can accept (immediate) or decline (postpone)
- The update system is independent: It determines required processing based on current catalog definition and file state
No Force Full Rescan in Regular Updates
- Full rescan is never part of regular update process
- Changes to
fileType/includeHiddenare handled incrementally (delete old files, add new ones matching new criteria) - Full rescan only offered as separate testing/troubleshooting option in Devices/Catalog list view
File Type Conversion Process
When It Runs
Automatically during:
-
Search operation (triggers catalog load)
- Calls
catalog->migrateCatalogFieldsForSearch() - Detects files with NULL/empty
file_extension,file_type, ormime_type - Processes them before search continues
- Calls
-
Catalog Update operation
- Step 8a in
updateCatalogIncremental(): callsmigrateMimeTypesForExistingFiles() - Finds files missing mime_type fields
- Populates from extension
- Step 8a in
-
Catalog Load from .idx file (Memory mode)
- During
loadCatalogFileToTable(), detects v2.6 format (6 columns vs 28) - Converts on-the-fly and saves catalog in v2.8 format
- During
How It Works
- Queries:
WHERE (file_extension IS NULL OR file_extension = '' OR file_type IS NULL OR file_type = '' OR mime_type IS NULL OR mime_type = '') - Extracts extension from
file_nameorfile_full_path - Calls
FileMetadata::getFileTypeFromExtension()andgetMimeTypeFromExtension() - Updates fields in batches (1000 files per batch for efficiency)
- Stoppable: Checks
stopRequestedflag during processing - Resumable: On next operation, queries for remaining NULL fields and continues
Progress Reporting
- Emits
loadProgress(filesProcessed, totalFiles) - Shows: "Converting X/Y files..."
- Updates every 100 files or 1% of total