mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(server): do not automatically download android motion videos (#11774)
feat(server): do not automatically download embedded android motion videos
This commit is contained in:
parent
ed6971222c
commit
32c05ea950
13 changed files with 151 additions and 28 deletions
|
|
@ -14,13 +14,21 @@
|
|||
SettingInputFieldType,
|
||||
} from '$lib/components/shared-components/settings/setting-input-field.svelte';
|
||||
import { ByteUnit, convertFromBytes, convertToBytes } from '$lib/utils/byte-units';
|
||||
import SettingSwitch from '$lib/components/shared-components/settings/setting-switch.svelte';
|
||||
|
||||
let archiveSize = convertFromBytes($preferences?.download?.archiveSize || 4, ByteUnit.GiB);
|
||||
let includeEmbeddedVideos = $preferences?.download?.includeEmbeddedVideos || false;
|
||||
|
||||
const handleSave = async () => {
|
||||
try {
|
||||
const dto = { download: { archiveSize: Math.floor(convertToBytes(archiveSize, ByteUnit.GiB)) } };
|
||||
const newPreferences = await updateMyPreferences({ userPreferencesUpdateDto: dto });
|
||||
const newPreferences = await updateMyPreferences({
|
||||
userPreferencesUpdateDto: {
|
||||
download: {
|
||||
archiveSize: Math.floor(convertToBytes(archiveSize, ByteUnit.GiB)),
|
||||
includeEmbeddedVideos,
|
||||
},
|
||||
},
|
||||
});
|
||||
$preferences = newPreferences;
|
||||
|
||||
notificationController.show({ message: $t('saved_settings'), type: NotificationType.Info });
|
||||
|
|
@ -34,14 +42,17 @@
|
|||
<div in:fade={{ duration: 500 }}>
|
||||
<form autocomplete="off" on:submit|preventDefault>
|
||||
<div class="ml-4 mt-4 flex flex-col gap-4">
|
||||
<div class="ml-4">
|
||||
<SettingInputField
|
||||
inputType={SettingInputFieldType.NUMBER}
|
||||
label={$t('archive_size')}
|
||||
desc={$t('archive_size_description')}
|
||||
bind:value={archiveSize}
|
||||
/>
|
||||
</div>
|
||||
<SettingInputField
|
||||
inputType={SettingInputFieldType.NUMBER}
|
||||
label={$t('archive_size')}
|
||||
desc={$t('archive_size_description')}
|
||||
bind:value={archiveSize}
|
||||
/>
|
||||
<SettingSwitch
|
||||
title={$t('download_include_embedded_motion_videos')}
|
||||
subtitle={$t('download_include_embedded_motion_videos_description')}
|
||||
bind:checked={includeEmbeddedVideos}
|
||||
></SettingSwitch>
|
||||
<div class="flex justify-end">
|
||||
<Button type="submit" size="sm" on:click={() => handleSave()}>{$t('save')}</Button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@
|
|||
"appears_in": "Appears in",
|
||||
"archive": "Archive",
|
||||
"archive_or_unarchive_photo": "Archive or unarchive photo",
|
||||
"archive_size": "Archive Size",
|
||||
"archive_size": "Archive size",
|
||||
"archive_size_description": "Configure the archive size for downloads (in GiB)",
|
||||
"archived_count": "{count, plural, other {Archived #}}",
|
||||
"are_these_the_same_person": "Are these the same person?",
|
||||
|
|
@ -512,6 +512,8 @@
|
|||
"do_not_show_again": "Do not show this message again",
|
||||
"done": "Done",
|
||||
"download": "Download",
|
||||
"download_include_embedded_motion_videos": "Embedded videos",
|
||||
"download_include_embedded_motion_videos_description": "Include videos embedded in motion photos as a separate file",
|
||||
"download_settings": "Download",
|
||||
"download_settings_description": "Manage settings related to asset download",
|
||||
"downloading": "Downloading",
|
||||
|
|
|
|||
|
|
@ -172,13 +172,19 @@ export const downloadFile = async (asset: AssetResponseDto) => {
|
|||
},
|
||||
];
|
||||
|
||||
const isAndroidMotionVideo = (asset: AssetResponseDto) => {
|
||||
return asset.originalPath.includes('encoded-video');
|
||||
};
|
||||
|
||||
if (asset.livePhotoVideoId) {
|
||||
const motionAsset = await getAssetInfo({ id: asset.livePhotoVideoId, key: getKey() });
|
||||
assets.push({
|
||||
filename: motionAsset.originalFileName,
|
||||
id: asset.livePhotoVideoId,
|
||||
size: motionAsset.exifInfo?.fileSizeInByte || 0,
|
||||
});
|
||||
if (!isAndroidMotionVideo(motionAsset) || get(preferences).download.includeEmbeddedVideos) {
|
||||
assets.push({
|
||||
filename: motionAsset.originalFileName,
|
||||
id: asset.livePhotoVideoId,
|
||||
size: motionAsset.exifInfo?.fileSizeInByte || 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const { filename, id, size } of assets) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue