Photo: save path, is-local, content bytes, metadata and EXIF getters (closes #141) #142

Merged
clawbot merged 4 commits from issue-141-photo-getters into next 2026-10-01 17:58:24 +02:00
2 changed files with 13 additions and 7 deletions
Showing only changes of commit af482f8eb4 - Show all commits
+7 -6
View File
@@ -27,12 +27,13 @@ declares one.
- 2026-10-01: A `Photo` has `savePath`, `isLocal`, `content()`, `exif()`,
`modifiedAt`, `hash` and `year` (issue 141). `savePath` is where
`lib.backup()` writes the original under the library's download directory, and
`isLocal` says whether the whole original is there; both look only at the
disk. `content()` returns the original's bytes and `exif()` the common EXIF
fields of a JPEG; both may download the original, and `exif()` downloads no
video. `PhotoRecord` gains `modifiedAt` and `hash`, and the JPEG EXIF scan
moved to `src/exif.ts`.
`lib.backup()` writes the original under the library's download directory; for
a live photo not yet stored, it carries the title's extension, and the backup
may store the image under a different one. `isLocal` says whether the whole
original is there. Both look only at the disk. `content()` returns the
original's bytes and `exif()` the common EXIF fields of a JPEG; both may
download the original, and `exif()` downloads no video. `PhotoRecord` gains
`modifiedAt` and `hash`, and the JPEG EXIF scan moved to `src/exif.ts`.
- 2026-09-29: The "Workflow" list at the top of this file now says to branch
from `next` and open a pull request that targets `next`, that the repository
+6 -1
View File
@@ -108,6 +108,9 @@ export interface ContentOptions {
export interface PhotoContent {
original(fileID: number, opts?: ContentOptions): Promise<ContentResult>;
thumbnail(fileID: number, opts?: ContentOptions): Promise<ContentResult>;
// Where a backup stores the original, whether or not it is there yet. For
// a live photo not yet stored, it carries the title's extension, and the
// backup may store the image under a different one.
savePath(fileID: number): string | undefined;
isLocal(fileID: number): boolean;
}
@@ -439,7 +442,9 @@ export class ContentCache implements PhotoContent, ThumbnailsAPI {
// Where a backup to the download directory stores the file's original,
// whether or not it is there yet: for a live photo already stored, its
// image. Undefined with no download directory.
// image. For a live photo not yet stored, it carries the title's
// extension, and the backup may store the image under a different one.
// Undefined with no download directory.
savePath(fileID: number): string | undefined {
const file = this.getFile(fileID);
if (this.downloadDirectory === undefined || file === undefined)