[object Object]

← back to Whatsmystyle

fix(extract): drop the 'X-ish' year math (used file mtime, not EXIF)

028ad300f289ab647b37a91f9512c7df68526803 · 2026-05-12 00:05:53 -0700 · Steve Abrams

The auto-title 'From your N-ish photo' was computing years off file mtime,
which is the DOWNLOAD time when the photo came from Drive — yielded
nonsense like '0-ish photo'.

Now: parse a 4-digit year out of the source filename (e.g.
steve-2009-bday.jpg → 'From your 2009 photo'); otherwise just
'From your past wardrobe'. Proper EXIF parsing deferred until a richer
catalog needs it.

E2E test of Studio + extractor (cost: 0¢, no FASHN calls):
  1. /api/health                         ok
  2. /api/studio/photos                  fresh user → 0 photos as expected
  3. /api/studio/history                 fresh source → 0 rows
  4. POST /api/studio/extract-garment    item #26 created, image streamed
  5. Visual verification of crop         clean sweater isolated correctly
  6. node scripts/e2e.js                 26/26 still green

Smoke-confirmed the full Studio API + extractor are wired correctly.

Files touched

Diff

commit 028ad300f289ab647b37a91f9512c7df68526803
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 12 00:05:53 2026 -0700

    fix(extract): drop the 'X-ish' year math (used file mtime, not EXIF)
    
    The auto-title 'From your N-ish photo' was computing years off file mtime,
    which is the DOWNLOAD time when the photo came from Drive — yielded
    nonsense like '0-ish photo'.
    
    Now: parse a 4-digit year out of the source filename (e.g.
    steve-2009-bday.jpg → 'From your 2009 photo'); otherwise just
    'From your past wardrobe'. Proper EXIF parsing deferred until a richer
    catalog needs it.
    
    E2E test of Studio + extractor (cost: 0¢, no FASHN calls):
      1. /api/health                         ok
      2. /api/studio/photos                  fresh user → 0 photos as expected
      3. /api/studio/history                 fresh source → 0 rows
      4. POST /api/studio/extract-garment    item #26 created, image streamed
      5. Visual verification of crop         clean sweater isolated correctly
      6. node scripts/e2e.js                 26/26 still green
    
    Smoke-confirmed the full Studio API + extractor are wired correctly.
---
 data/waitlist.csv        |   1 +
 data/whatsmystyle.db-shm | Bin 32768 -> 32768 bytes
 data/whatsmystyle.db-wal | Bin 3802792 -> 4120032 bytes
 server.js                |   7 ++++++-
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/data/waitlist.csv b/data/waitlist.csv
index 603c69d..536a86a 100644
--- a/data/waitlist.csv
+++ b/data/waitlist.csv
@@ -15,3 +15,4 @@ e2e-1778564947982@example.com,e2e,2026-05-12T05:49:07.984Z
 e2e-1778566724793@example.com,e2e,2026-05-12T06:18:44.794Z
 e2e-1778569083894@example.com,e2e,2026-05-12T06:58:03.895Z
 e2e-1778569258754@example.com,e2e,2026-05-12T07:00:58.755Z
+e2e-1778569432594@example.com,e2e,2026-05-12T07:03:52.597Z
diff --git a/data/whatsmystyle.db-shm b/data/whatsmystyle.db-shm
index 3e6b2d1..f5d891e 100644
Binary files a/data/whatsmystyle.db-shm and b/data/whatsmystyle.db-shm differ
diff --git a/data/whatsmystyle.db-wal b/data/whatsmystyle.db-wal
index 0016fd0..2d5cd01 100644
Binary files a/data/whatsmystyle.db-wal and b/data/whatsmystyle.db-wal differ
diff --git a/server.js b/server.js
index c1d8eab..8e782ce 100644
--- a/server.js
+++ b/server.js
@@ -808,7 +808,12 @@ app.post('/api/studio/extract-garment', express.json({ limit: '32kb' }), async (
 
   // Register as a virtual catalog item
   const cat = category || 'top';
-  const title = `From your ${new Date().getFullYear() - new Date(fs.statSync(source_photo).mtimeMs).getFullYear()}-ish photo · ${cat}`;
+  // Year hint pulled from the source filename when it has a 4-digit year
+  // (e.g. steve-2009-bday.jpg); otherwise just "your past wardrobe".
+  const yearMatch = path.basename(source_photo).match(/(19|20)\d{2}/);
+  const title = yearMatch
+    ? `From your ${yearMatch[0]} photo · ${cat}`
+    : `From your past wardrobe · ${cat}`;
   const itemRow = db.prepare(`INSERT INTO items (source, external_id, title, brand, category, image_url, product_url)
     VALUES ('extracted', ?, ?, ?, ?, ?, ?) RETURNING id;`)
     .get(`extract-${Date.now()}`, title, brand_hint || 'Your past wardrobe', cat,

← 47423bd feat: garment extractor — pull a piece out of an old photo  ·  back to Whatsmystyle  ·  video: 16s FASHN carousel — you in cashmere, trench, denim cf853c0 →