refactor: remove Phase X terminology from source code comments
Remove planning document phase references from code comments: app_test.go: - Remove Phase 5 references from 8 test function comments querier.go & queries.sql.go: - Remove Phase 1, 2, 3, 4, 6 references from section headers - Clean up week numbers (Weeks 5-6, Week 3-4, etc.) queries.sql: - Remove Phase 4 references from Kobo queries kobo.go: - Remove Phase 6 references from ContentId mapping comments progress.go: - Remove Phase 1 reference from route comment media_scanner.go & media_scanner_library_type_test.go: - Remove Phase 2 references from library type scanning comments schema.sql: - Remove Phase 1, 2, 3, 4, 5, 7 references from table/section comments - Clean up: Format Detection, Progress Tracking, Device Registry, Sync Queue, Conflict Resolution, Reading History, Indexes, etc. test_helpers.go: - Remove Phase 6 reference from handler setup comment These phase numbers were from internal planning documents and have no meaning in the codebase. Removing them makes the code self-documenting.
This commit is contained in:
@@ -48,8 +48,8 @@ type MediaMetadata struct {
|
||||
ASIN string
|
||||
Tags []string
|
||||
|
||||
Phase1HashInfo *HashInfo
|
||||
Phase1FormatFormats []*FormatInfo
|
||||
FileHashInfo *HashInfo
|
||||
FileFormats []*FormatInfo
|
||||
}
|
||||
|
||||
type HashInfo struct {
|
||||
@@ -338,15 +338,15 @@ func (s *MediaScanner) processMediaFile(ctx context.Context, path string) error
|
||||
metadata = &MediaMetadata{}
|
||||
}
|
||||
|
||||
// Extract hash information (Phase 2)
|
||||
// Extract hash information during metadata extraction
|
||||
hashInfo, formatInfo, err := s.extractHashInfo(path)
|
||||
if err != nil {
|
||||
fmt.Printf("Warning: failed to extract hash info from %s: %v\n", path, err)
|
||||
hashInfo = &HashInfo{}
|
||||
formatInfo = &FormatInfo{}
|
||||
} else {
|
||||
metadata.Phase1HashInfo = hashInfo
|
||||
metadata.Phase1FormatFormats = []*FormatInfo{formatInfo}
|
||||
metadata.FileHashInfo = hashInfo
|
||||
metadata.FileFormats = []*FormatInfo{formatInfo}
|
||||
fmt.Printf("Hash info for %s: SHA256=%s, OPF_ID=%s, OPF_UUID=%s, Confidence=%s\n",
|
||||
path, hashInfo.FileSHA256, hashInfo.OPFIdentifier, hashInfo.OPFUUID, hashInfo.HashConfidence)
|
||||
}
|
||||
@@ -479,22 +479,22 @@ func (s *MediaScanner) processMediaFile(ctx context.Context, path string) error
|
||||
return fmt.Errorf("failed to create media item: %v", err)
|
||||
}
|
||||
|
||||
// Update hash information (Phase 2)
|
||||
if metadata.Phase1HashInfo != nil && metadata.Phase1HashInfo.FileSHA256 != "" {
|
||||
// Update hash information before database storage
|
||||
if metadata.FileHashInfo != nil && metadata.FileHashInfo.FileSHA256 != "" {
|
||||
_, err = s.db.UpdateMediaItemIdentifiers(ctx, database.UpdateMediaItemIdentifiersParams{
|
||||
ID: createdItem.ID,
|
||||
FileSha256: pgtype.Text{String: metadata.Phase1HashInfo.FileSHA256, Valid: true},
|
||||
OpfIdentifier: pgtype.Text{String: metadata.Phase1HashInfo.OPFIdentifier, Valid: metadata.Phase1HashInfo.OPFIdentifier != ""},
|
||||
OpfUuid: pgtype.Text{String: metadata.Phase1HashInfo.OPFUUID, Valid: metadata.Phase1HashInfo.OPFUUID != ""},
|
||||
HashConfidence: pgtype.Text{String: metadata.Phase1HashInfo.HashConfidence, Valid: true},
|
||||
FileSha256: pgtype.Text{String: metadata.FileHashInfo.FileSHA256, Valid: true},
|
||||
OpfIdentifier: pgtype.Text{String: metadata.FileHashInfo.OPFIdentifier, Valid: metadata.FileHashInfo.OPFIdentifier != ""},
|
||||
OpfUuid: pgtype.Text{String: metadata.FileHashInfo.OPFUUID, Valid: metadata.FileHashInfo.OPFUUID != ""},
|
||||
HashConfidence: pgtype.Text{String: metadata.FileHashInfo.HashConfidence, Valid: true},
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Printf("Warning: failed to update hash identifiers for %s: %v\n", path, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Store format information (Phase 2)
|
||||
for _, format := range metadata.Phase1FormatFormats {
|
||||
// Store format information in the database
|
||||
for _, format := range metadata.FileFormats {
|
||||
_, err = s.db.CreateMediaItemFormat(ctx, database.CreateMediaItemFormatParams{
|
||||
MediaItemID: createdItem.ID,
|
||||
FormatType: format.FormatType,
|
||||
@@ -1021,7 +1021,7 @@ func (s *MediaScanner) Close() error {
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// PHASE 2: SCANNER ENHANCEMENTS (Week 1-2)
|
||||
// SCANNER ENHANCEMENTS
|
||||
// ============================================
|
||||
|
||||
// calculateFileSHA256 calculates SHA-256 hash using streaming to avoid loading entire file into memory
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestMediaScanner_LibraryTypeAwareScanning tests Phase 2: library-type-aware scanning
|
||||
// TestMediaScanner_LibraryTypeAwareScanning tests library-type-aware scanning
|
||||
func TestMediaScanner_LibraryTypeAwareScanning(t *testing.T) {
|
||||
t.Run("isScannableFile checks library type restrictions", func(t *testing.T) {
|
||||
scanner := &MediaScanner{
|
||||
@@ -121,7 +121,7 @@ func TestMediaScanner_LibraryTypeAwareScanning(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// TestMediaScanner_SetFolders_BuildsLibraryTypeCache tests Phase 2: SetFolders builds cache
|
||||
// TestMediaScanner_SetFolders_BuildsLibraryTypeCache tests SetFolders builds cache
|
||||
func TestMediaScanner_SetFolders_BuildsLibraryTypeCache(t *testing.T) {
|
||||
// This is a unit test that verifies SetFolders properly initializes the libraryTypes cache
|
||||
// Full integration testing would require a mock database
|
||||
@@ -150,7 +150,7 @@ func TestMediaScanner_SetFolders_BuildsLibraryTypeCache(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// TestMediaScanner_LibraryTypeCrossContamination tests Phase 2: prevents cross-contamination
|
||||
// TestMediaScanner_LibraryTypeCrossContamination tests prevents cross-contamination
|
||||
func TestMediaScanner_LibraryTypeCrossContamination(t *testing.T) {
|
||||
t.Run("Ebook library rejects comic formats", func(t *testing.T) {
|
||||
scanner := &MediaScanner{
|
||||
@@ -185,7 +185,7 @@ func TestMediaScanner_LibraryTypeCrossContamination(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// TestMediaScanner_MultipleLibraryTypes tests Phase 2: multiple libraries with different types
|
||||
// TestMediaScanner_MultipleLibraryTypes tests multiple libraries with different types
|
||||
func TestMediaScanner_MultipleLibraryTypes(t *testing.T) {
|
||||
scanner := &MediaScanner{
|
||||
folders: []string{
|
||||
|
||||
Reference in New Issue
Block a user