Skip to content

Metadata: Extract date from android whats app filenames #1102

Description

@JamesSwift

I've been doing some tests on various photos and I've found that PP gets confused with date extraction sometimes.

For example, this file seems to have no embedded "Date Taken" info:

root@da67aa80bf7b:/photoprism# exiftool "originals/2019/11 November/IMG-20191120-WA0001.jpg"
ExifTool Version Number         : 12.05
File Name                       : IMG-20191120-WA0001.jpg
Directory                       : originals/2019/11 November
File Size                       : 196 kB
File Modification Date/Time     : 2021:02:20 15:33:03+00:00
File Access Date/Time           : 2021:02:27 13:37:34+00:00
File Inode Change Date/Time     : 2021:02:21 20:06:19+00:00
File Permissions                : rwxr-x---
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
Image Width                     : 1600
Image Height                    : 800
Encoding Process                : Progressive DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1600x800
Megapixels                      : 1.3

When importing it, PP sets the right month and year, but sets the date for it (and all the other images from whatsapp) as the 1st:

image

I wondered what source PP is using for date information when the exif data doesn't provide it? Is it running a regex on the filename? Or Possibly on the folder path?

I know that finding dates for photos that lack proper exif data is a can of worms, as they can come in all types and formats. Given that Whatsapp will be a major source of photos for some libraries, and given it seems to strip that info though, I wondered if we can extract it with a regex looking for a few standard date formats in the file name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    releasedAvailable in a stable release

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Release 🌈

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions