viewer: add stackraw download
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/900/head
parent
4b4e4f2c09
commit
f49b93c561
|
@ -753,7 +753,7 @@ export default defineComponent({
|
|||
*/
|
||||
async downloadSelection(selection: Selection) {
|
||||
if (selection.size >= 100 && !(await utils.dialogs.downloadItems(selection.size))) return;
|
||||
await dav.downloadFilesByPhotos(selection.photosNoDupFileId());
|
||||
await dav.downloadFiles(selection.photosNoDupFileId().map((p) => p.fileid));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,6 +110,18 @@
|
|||
<DownloadIcon :size="24" />
|
||||
</template>
|
||||
</NcActionButton>
|
||||
<NcActionButton
|
||||
v-for="raw of stackedRaw"
|
||||
:aria-label="t('memories', 'Download {ext}', { ext: raw.extension })"
|
||||
@click="downloadByFileId(raw.fileid)"
|
||||
:close-after-click="true"
|
||||
:key="raw.fileid"
|
||||
>
|
||||
{{ t('memories', 'Download {ext}', { ext: raw.extension }) }}
|
||||
<template #icon>
|
||||
<DownloadIcon :size="24" />
|
||||
</template>
|
||||
</NcActionButton>
|
||||
<NcActionButton
|
||||
v-if="!routeIsPublic && !routeIsAlbums && !isLocal"
|
||||
:aria-label="t('memories', 'View in folder')"
|
||||
|
@ -392,6 +404,17 @@ export default defineComponent({
|
|||
canShare(): boolean {
|
||||
return Boolean(this.currentPhoto);
|
||||
},
|
||||
|
||||
/** Stacked RAW photos */
|
||||
stackedRaw(): { extension: string; fileid: number }[] {
|
||||
const photo = this.currentPhoto;
|
||||
if (!photo || !photo.stackraw?.length) return [];
|
||||
|
||||
return photo.stackraw.map((raw) => ({
|
||||
extension: (raw.basename?.split('.').pop() ?? '?').toUpperCase(),
|
||||
fileid: raw.fileid,
|
||||
}));
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
@ -1048,11 +1071,16 @@ export default defineComponent({
|
|||
this.$forceUpdate();
|
||||
},
|
||||
|
||||
/** Download a file by file ID */
|
||||
async downloadByFileId(fileId: number) {
|
||||
dav.downloadFiles([fileId]);
|
||||
},
|
||||
|
||||
/** Download the current photo */
|
||||
async downloadCurrent() {
|
||||
const photo = this.currentPhoto;
|
||||
if (!photo) return;
|
||||
dav.downloadFilesByPhotos([photo]);
|
||||
this.downloadByFileId(photo.fileid);
|
||||
},
|
||||
|
||||
/** Download live part of current video */
|
||||
|
|
|
@ -36,14 +36,6 @@ export function downloadWithHandle(handle: string) {
|
|||
window.location.href = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the files given by the fileIds
|
||||
* @param photos list of photos
|
||||
*/
|
||||
export async function downloadFilesByPhotos(photos: IPhoto[]) {
|
||||
await downloadFiles(photos.map((f) => f.fileid));
|
||||
}
|
||||
|
||||
/** Get URL to download one file (e.g. for video streaming) */
|
||||
export function getDownloadLink(photo: IPhoto) {
|
||||
return API.STREAM_FILE(photo.fileid);
|
||||
|
|
Loading…
Reference in New Issue