Skip to content

Commit e3b2865

Browse files
committed
Add new option "immich_favorites"
1 parent b633513 commit e3b2865

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

docs/configuration.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ You can set the following configuration parameters for every individual Home Ass
4949
| iframe_load_unchanged | Should an iframe be reloaded once its display time has expired, even if its URL remains the same? | false |
5050
| iframe_interaction | Allow interaction with the iframe content? | false |
5151
| immich_api_key | API key that is used for authentication at the [immich API](media-sources.md#immich-api) | |
52-
| immich_shared_albums | Show images of shared immich albums? | true |
53-
| immich_album_names | Only show images from these immich albums. | [] |
54-
| immich_tag_names | Only show images with this tags. | [] |
55-
| immich_persons | Only show images with this persons. | [] |
56-
| immich_memories | Only show today memories. | false |
57-
| immich_resolution | The resolution to use for loading images from immich (possible values are: `preview` / `original`). | preview |
52+
| immich_shared_albums | Display media from shared Immich albums. | true |
53+
| immich_album_names | Display media only from the specified Immich albums. | [] |
54+
| immich_tag_names | Display media only with the specified tags. | [] |
55+
| immich_persons | Display media only featuring the specified people. | [] |
56+
| immich_memories | Display only today’s memories. | false |
57+
| immich_favorites | Display only media marked as favorite. | false |
58+
| immich_resolution | The resolution to use for loading media from immich (possible values are: `preview` / `original`). | preview |
5859
| exclude_filenames | List of regular expressions for excluding files and directories from media sources. See [Media Sources](media-sources.md#exclude-files) for details. | [] |
5960
| exclude_media_types | List of media types to exlcude media sources. See [Media Sources](media-sources.md#exclude-files) for details. | [] |
6061
| exclude_media_orientation | Media orientation to exlcude. See [Media Sources](media-sources.md#exclude-files) for details. | |

docs/media-sources.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,13 @@ immich_api_key: 0vOb7EZ7YSajUQckMt6Cbnri8Ifzo5dlD9Q5hnnXlc
225225
immich_memories: true
226226
```
227227

228+
Example showing immich favorites:
229+
```yaml
230+
image_url: immich+https://immich.your.domain/api
231+
immich_api_key: 0vOb7EZ7YSajUQckMt6Cbnri8Ifzo5dlD9Q5hnnXlc
232+
immich_favorites: true
233+
```
234+
228235
## Website as iframe
229236
You can also display a website in an iframe.
230237
Just add the prefix `iframe+` to the URL of the website you want to show:

wallpanel-src.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const defaultConfig = {
5656
immich_tag_names: [],
5757
immich_persons: [],
5858
immich_memories: false,
59+
immich_favorites: false,
5960
immich_resolution: "preview",
6061
image_fit_landscape: "cover", // cover / contain
6162
image_fit_portrait: "contain", // cover / contain
@@ -2806,6 +2807,29 @@ function initWallpanel() {
28062807
processAssets(memory.assets);
28072808
})
28082809
);
2810+
} else if (config.immich_favorites) {
2811+
logger.debug("Search for favorites in asset metadata");
2812+
let page = 1;
2813+
while (true) {
2814+
logger.debug(`Fetching asset metadata page ${page}`);
2815+
const searchResults = await wp._immichFetch(`${apiUrl}/search/metadata`, {
2816+
method: "POST",
2817+
body: JSON.stringify({ isFavorite: true, withExif: true, page: page, size: 1000 })
2818+
});
2819+
logger.debug("Got immich API response", searchResults);
2820+
if (!searchResults.assets.count) {
2821+
if (page == 1) {
2822+
const msg = "No favorite media items found in immich";
2823+
logger.error(msg);
2824+
}
2825+
break;
2826+
}
2827+
processAssets(searchResults.assets.items);
2828+
if (!searchResults.assets.nextPage) {
2829+
break;
2830+
}
2831+
page = searchResults.assets.nextPage;
2832+
}
28092833
} else if (config.immich_tag_names && config.immich_tag_names.length) {
28102834
const tagNamesLower = config.immich_tag_names.map((v) => v.toLowerCase());
28112835
logger.debug("Fetching immich tags");

wallpanel.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)