Commit Graph

1194 Commits

Author SHA1 Message Date
Manav Rathi
3dbdea472b Add a top level catch handler instead of silent swallows 2024-07-29 20:46:05 +05:30
Manav Rathi
505e1de14c lint 2024-07-29 16:09:33 +05:30
Manav Rathi
d116c5ccb1 Prune false positives for times picked from file names 2024-07-29 15:59:55 +05:30
Manav Rathi
aad7300e4b Take 2 2024-07-29 15:41:44 +05:30
Manav Rathi
0290991e2c DOMParser is not available in web workers
Exif extraction from XMP thus fails with the following console warning

    Warning: DOMParser is not available. It is needed to be able to parse XMP tags

Thus we need to explicitly take a dep on xmldom.
2024-07-29 15:16:33 +05:30
Manav Rathi
9e2e8e4d63 Fix 2024-07-29 14:54:31 +05:30
Manav Rathi
b121daa607 Trace 2024-07-29 14:40:11 +05:30
Manav Rathi
bae717dc69 Prepare for internal users 2024-07-29 14:19:17 +05:30
Manav Rathi
b61e4f4ac6 Integrate exif 2024-07-29 13:55:37 +05:30
Manav Rathi
a7e0c5b61d Use the new server enum 2024-07-29 13:20:25 +05:30
Crowdin Bot
f09a8c4c51 New Crowdin translations by GitHub Action 2024-07-29 00:31:41 +00:00
Manav Rathi
d1a74da4a4 Rely on the lib's formatters 2024-07-27 21:35:43 +05:30
Manav Rathi
08833390bc Retain previous behaviour 2024-07-27 20:24:59 +05:30
Manav Rathi
e1923fdebd Prone to confusion between the object and the type 2024-07-27 20:13:06 +05:30
Manav Rathi
06be08a382 Fix accidental aliasing 2024-07-27 20:08:56 +05:30
Manav Rathi
99066b8fea Use 2024-07-27 20:02:06 +05:30
Manav Rathi
487fd62feb Rearrange 2024-07-27 20:00:34 +05:30
Manav Rathi
26c40ab2ec Test
Chrome, Safari, Firefox, Node.js (macOS)

    const parseMetadataDate = (s) => {
        const timestamp = new Date(s).getTime() * 1000;
        if (isNaN(timestamp)) return undefined;

        let offsetTime;
        let sWithoutOffset;

        const m = s.match(/Z|[+-]\d\d:?\d\d$/);
        if (m?.index) {
            sWithoutOffset = s.substring(0, m.index);
            offsetTime = s.substring(m.index);
        } else {
            sWithoutOffset = s;
        }

        const date = new Date(
            sWithoutOffset + (sWithoutOffset.length <= 10 ? "" : "Z"),
        );
        const dateTime = dropLast(date.toISOString());

        return { dateTime, offsetTime, timestamp };
    };

    const dropLast = (s) => (s ? s.substring(0, s.length - 1) : s);

    const test = () => {
        console.log(parseMetadataDate("2023"));
        console.log(parseMetadataDate("2023-08"));
        console.log(parseMetadataDate("2023-08-23"));
        console.log(parseMetadataDate("2023-08-23T18:03:00"));
        console.log(parseMetadataDate("2023-08-23T18:03:00+05:30"));
        console.log(parseMetadataDate("2023-08-23T18:03:00.000+05:30"));
        console.log(parseMetadataDate("2023-08-23T12:33:00.000Z"));
    };

    test();
2024-07-27 19:45:15 +05:30
Manav Rathi
4deb9c8f13 Impl wip 2024-07-27 19:22:41 +05:30
Manav Rathi
74c5b22927 Outline 2024-07-27 17:42:54 +05:30
Manav Rathi
8b30d52e94 New home 2024-07-27 16:03:29 +05:30
Manav Rathi
c28b6e3a62 Stay within JavaScript
https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums
2024-07-27 10:29:46 +05:30
Manav Rathi
5c0942f2b7 Remove unused 2024-07-27 10:15:41 +05:30
Manav Rathi
1adab703b8 Rename FILE_TYPE 2024-07-27 10:14:19 +05:30
Manav Rathi
9613361151 Outline 2024-07-27 10:04:47 +05:30
Manav Rathi
7f357d0f65 lint 2024-07-26 16:11:06 +05:30
Manav Rathi
6c7f8e5fae Mention we're ignoring NaNs too 2024-07-26 15:25:17 +05:30
Manav Rathi
b637f2fe08 Handle exif subsecs 2024-07-26 15:15:32 +05:30
Manav Rathi
5995730659 Rearrange 2024-07-26 14:54:51 +05:30
Manav Rathi
689d3c4c82 New lib works in more cases than before 2024-07-26 14:46:52 +05:30
Manav Rathi
beace4cbde Parse wip 2024-07-26 11:57:46 +05:30
Manav Rathi
bac49c7058 Ontology wip 2024-07-26 11:03:18 +05:30
Manav Rathi
76faf4c1d7 Use raw exif - wip 1 2024-07-26 09:42:57 +05:30
Manav Rathi
47ded8b302 Dates 2024-07-25 21:07:18 +05:30
Manav Rathi
1501e055a9 Rename 2024-07-25 20:56:25 +05:30
Manav Rathi
2cb9c915aa Narrow down scope: index => extract raw exif 2024-07-25 20:49:36 +05:30
Manav Rathi
b4ea15f00b Tweak the debug logging 2024-07-25 19:02:32 +05:30
Manav Rathi
191f1fd097 creationTime will always be present 2024-07-25 15:51:46 +05:30
Manav Rathi
a4a4b7f941 debug logging 2024-07-25 09:51:50 +05:30
Manav Rathi
218a5ce5f9 Tie together 2024-07-24 20:42:49 +05:30
Manav Rathi
719f056841 Interface 2024-07-24 20:28:03 +05:30
Manav Rathi
c835984e40 Single date 2024-07-24 20:08:08 +05:30
Manav Rathi
5a36e37e93 Fuse 2024-07-24 19:54:39 +05:30
Manav Rathi
16ec4db546 Use 2024-07-24 19:41:31 +05:30
Manav Rathi
ae0b701319 Parse IPTC dates 2024-07-24 19:29:04 +05:30
Manav Rathi
4e29f1e03a Return pairs 2024-07-24 18:44:52 +05:30
Manav Rathi
3da9361271 Make the linter happy 2024-07-24 15:32:18 +05:30
Manav Rathi
65863d1b8f Match the current order 2024-07-24 15:26:30 +05:30
Manav Rathi
7b80c5bf77 Do it as per the XMP spec
This is the format I've seen in all the XMP files I've encountered so far too
(not relying on this evidence, just that it corroborates what the spec says).

The wording in the exiftool spec was confusing, I now think what it means is
that _exiftool_ will use that format, not XMP.
2024-07-24 15:18:40 +05:30
Manav Rathi
1bcf232d25 Split 2024-07-24 14:53:18 +05:30