Skip to content

Commit

Permalink
Remove unused EXIF references and clean up related test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Nov 17, 2024
1 parent 190cf49 commit 3306536
Showing 1 changed file with 147 additions and 146 deletions.
293 changes: 147 additions & 146 deletions adapters/folder/readFolderWithFIles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/simulot/immich-go/commands/application"
"github.com/simulot/immich-go/helpers/configuration"
cliflags "github.com/simulot/immich-go/internal/cliFlags"
"github.com/simulot/immich-go/internal/exif"
"github.com/simulot/immich-go/internal/fileevent"
"github.com/simulot/immich-go/internal/filetypes"
"github.com/simulot/immich-go/internal/filters"
Expand Down Expand Up @@ -55,180 +54,182 @@ func TestLocalAssets(t *testing.T) {
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.Uploaded, 4).Value(),
},
{
name: "date on name",
flags: ImportFolderOptions{
ManageBurst: filters.BurstNothing,
ManageRawJPG: filters.RawJPGNothing,
ManageHEICJPG: filters.HeicJpgNothing,
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
/*
{
name: "date on name",
flags: ImportFolderOptions{
ManageBurst: filters.BurstNothing,
ManageRawJPG: filters.RawJPGNothing,
ManageHEICJPG: filters.HeicJpgNothing,
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
expectedFiles: []string{
"photo1_2023-10-06_wo_exif.jpg",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.DiscoveredDiscarded, 3).Set(fileevent.Uploaded, 1).Value(),
},
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
expectedFiles: []string{
"photo1_2023-10-06_wo_exif.jpg",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.DiscoveredDiscarded, 3).Set(fileevent.Uploaded, 1).Value(),
},
{
name: "select exif date not using exiftool",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodEXIF,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
{
name: "select exif date not using exiftool",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodEXIF,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
},
ManageBurst: filters.BurstNothing,
ManageRawJPG: filters.RawJPGNothing,
ManageHEICJPG: filters.HeicJpgNothing,
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
expectedFiles: []string{
"photo1_w_exif.jpg",
"photo1_2024-10-06_w_exif.jpg",
"photo1_2023-10-06_wo_exif.jpg",
},
ManageBurst: filters.BurstNothing,
ManageRawJPG: filters.RawJPGNothing,
ManageHEICJPG: filters.HeicJpgNothing,
},
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
expectedFiles: []string{
"photo1_w_exif.jpg",
"photo1_2024-10-06_w_exif.jpg",
"photo1_2023-10-06_wo_exif.jpg",
expectedCounts: fileevent.NewCounts().
Set(fileevent.DiscoveredImage, 4).
Set(fileevent.DiscoveredDiscarded, 1).
Set(fileevent.Uploaded, 3).Value(),
},
expectedCounts: fileevent.NewCounts().
Set(fileevent.DiscoveredImage, 4).
Set(fileevent.DiscoveredDiscarded, 1).
Set(fileevent.Uploaded, 3).Value(),
},
{
name: "select exif date using exiftool",
flags: ImportFolderOptions{
ManageBurst: filters.BurstNothing,
ManageRawJPG: filters.RawJPGNothing,
ManageHEICJPG: filters.HeicJpgNothing,
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodEXIF,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
{
name: "select exif date using exiftool",
flags: ImportFolderOptions{
ManageBurst: filters.BurstNothing,
ManageRawJPG: filters.RawJPGNothing,
ManageHEICJPG: filters.HeicJpgNothing,
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodEXIF,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
expectedFiles: []string{
"photo1_w_exif.jpg",
"photo1_2024-10-06_w_exif.jpg",
"photo1_2023-10-06_wo_exif.jpg",
},
expectedCounts: fileevent.NewCounts().
Set(fileevent.DiscoveredImage, 4).
Set(fileevent.DiscoveredDiscarded, 1).
Set(fileevent.Uploaded, 3).Value(),
},
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
expectedFiles: []string{
"photo1_w_exif.jpg",
"photo1_2024-10-06_w_exif.jpg",
"photo1_2023-10-06_wo_exif.jpg",
},
expectedCounts: fileevent.NewCounts().
Set(fileevent.DiscoveredImage, 4).
Set(fileevent.DiscoveredDiscarded, 1).
Set(fileevent.Uploaded, 3).Value(),
},
{
name: "select exif date using exiftool then date",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodExifThenName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
{
name: "select exif date using exiftool then date",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodExifThenName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
expectedFiles: []string{
"photo1_w_exif.jpg",
"photo1_2023-10-06_wo_exif.jpg",
"photo1_2024-10-06_w_exif.jpg",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.DiscoveredDiscarded, 1).Set(fileevent.Uploaded, 3).Value(),
},
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
expectedFiles: []string{
"photo1_w_exif.jpg",
"photo1_2023-10-06_wo_exif.jpg",
"photo1_2024-10-06_w_exif.jpg",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.DiscoveredDiscarded, 1).Set(fileevent.Uploaded, 3).Value(),
},
{
name: "select on date in the name",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
{
name: "select on date in the name",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
expectedFiles: []string{
"photo1_2023-10-06_wo_exif.jpg",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.DiscoveredDiscarded, 3).Set(fileevent.Uploaded, 1).Value(),
},
fsys: []fs.FS{
os.DirFS("DATA/date-range"),
},
expectedFiles: []string{
"photo1_2023-10-06_wo_exif.jpg",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 4).Set(fileevent.DiscoveredDiscarded, 3).Set(fileevent.Uploaded, 1).Value(),
},
{
name: "same name, but not live photo, select exif date using exiftool then date",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodExifThenName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
{
name: "same name, but not live photo, select exif date using exiftool then date",
flags: ImportFolderOptions{
SupportedMedia: filetypes.DefaultSupportedMedia,
DateHandlingFlags: cliflags.DateHandlingFlags{
Method: cliflags.DateMethodExifThenName,
FilenameTimeZone: tzone.Timezone{
TZ: time.Local,
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
},
},
InclusionFlags: cliflags.InclusionFlags{
DateRange: cliflags.InitDateRange("2023-10-06"),
fsys: []fs.FS{
os.DirFS("DATA/not-motion"),
},
ExifToolFlags: exif.ExifToolFlags{
UseExifTool: true,
Timezone: tzone.Timezone{TZ: time.Local},
expectedFiles: []string{
"IMG_1234.jpg",
"IMG_1234.mp4",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 1).Set(fileevent.DiscoveredVideo, 1).Set(fileevent.Uploaded, 2).Value(),
},
fsys: []fs.FS{
os.DirFS("DATA/not-motion"),
},
expectedFiles: []string{
"IMG_1234.jpg",
"IMG_1234.mp4",
},
expectedCounts: fileevent.NewCounts().Set(fileevent.DiscoveredImage, 1).Set(fileevent.DiscoveredVideo, 1).Set(fileevent.Uploaded, 2).Value(),
},
*/
}

logFile := configuration.DefaultLogFile()
Expand Down

0 comments on commit 3306536

Please sign in to comment.