2021-08-18 00:01:11 +02:00
|
|
|
<template>
|
2022-08-04 01:27:38 +02:00
|
|
|
<div id="match-wrapper" class="w-full h-full overflow-hidden px-2 md:px-4 py-4 md:py-6 relative">
|
2021-08-21 16:15:44 +02:00
|
|
|
<form @submit.prevent="submitSearch">
|
2022-08-04 01:27:38 +02:00
|
|
|
<div class="flex flex-wrap md:flex-nowrap items-center justify-start -mx-1">
|
|
|
|
<div class="w-36 px-1">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-dropdown v-model="provider" :items="providers" :label="$strings.LabelProvider" small />
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-08-04 01:27:38 +02:00
|
|
|
<div class="flex-grow md:w-72 px-1">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="searchTitle" :label="searchTitleLabel" :placeholder="$strings.PlaceholderSearch" />
|
2021-08-21 16:15:44 +02:00
|
|
|
</div>
|
2022-08-04 01:27:38 +02:00
|
|
|
<div v-show="provider != 'itunes'" class="w-60 md:w-72 px-1">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="searchAuthor" :label="$strings.LabelAuthor" />
|
2021-08-21 16:15:44 +02:00
|
|
|
</div>
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-btn class="mt-5 ml-1" type="submit">{{ $strings.ButtonSearch }}</ui-btn>
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
2021-08-21 16:15:44 +02:00
|
|
|
</form>
|
2021-08-18 00:01:11 +02:00
|
|
|
<div v-show="processing" class="flex h-full items-center justify-center">
|
2022-11-08 01:27:17 +01:00
|
|
|
<p>{{ $strings.MessageLoading }}</p>
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
2021-08-21 23:23:35 +02:00
|
|
|
<div v-show="!processing && !searchResults.length && hasSearched" class="flex h-full items-center justify-center">
|
2022-11-08 01:27:17 +01:00
|
|
|
<p>{{ $strings.MessageNoResults }}</p>
|
2021-08-18 13:50:24 +02:00
|
|
|
</div>
|
2022-08-04 01:27:38 +02:00
|
|
|
<div v-show="!processing" class="w-full max-h-full overflow-y-auto overflow-x-hidden matchListWrapper mt-4">
|
2021-08-18 00:01:11 +02:00
|
|
|
<template v-for="(res, index) in searchResults">
|
2023-10-04 00:16:49 +02:00
|
|
|
<cards-book-match-card :key="index" :book="res" :current-book-duration="currentBookDuration" :is-podcast="isPodcast" :book-cover-aspect-ratio="bookCoverAspectRatio" @select="selectMatch" />
|
2021-08-18 00:01:11 +02:00
|
|
|
</template>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig" class="absolute top-0 left-0 w-full bg-bg h-full px-2 py-6 md:p-8 max-h-full overflow-y-auto overflow-x-hidden">
|
2022-08-16 01:00:11 +02:00
|
|
|
<div class="flex mb-4">
|
2022-10-01 23:51:22 +02:00
|
|
|
<div class="w-8 h-8 rounded-full hover:bg-white hover:bg-opacity-10 flex items-center justify-center cursor-pointer" @click="clearSelectedMatch">
|
2021-10-28 21:41:42 +02:00
|
|
|
<span class="material-icons text-3xl">arrow_back</span>
|
|
|
|
</div>
|
2022-11-08 01:27:17 +01:00
|
|
|
<p class="text-xl pl-3">{{ $strings.HeaderUpdateDetails }}</p>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2024-05-05 19:27:45 +02:00
|
|
|
<ui-checkbox v-model="selectAll" :label="$strings.LabelSelectAll" checkbox-bg="bg" @input="selectAllToggled" />
|
2021-10-28 21:41:42 +02:00
|
|
|
<form @submit.prevent="submitMatchUpdate">
|
2023-04-01 01:00:45 +02:00
|
|
|
<div v-if="selectedMatchOrig.cover" class="flex flex-wrap md:flex-nowrap items-center justify-center">
|
|
|
|
<div class="flex flex-grow items-center py-2">
|
|
|
|
<ui-checkbox v-model="selectedMatchUsage.cover" checkbox-bg="bg" @input="checkboxToggled" />
|
|
|
|
<ui-text-input-with-label v-model="selectedMatch.cover" :disabled="!selectedMatchUsage.cover" readonly :label="$strings.LabelCover" class="flex-grow mx-4" />
|
|
|
|
</div>
|
|
|
|
|
2024-05-06 00:04:41 +02:00
|
|
|
<div class="flex py-2">
|
2023-04-01 01:00:45 +02:00
|
|
|
<div>
|
2024-05-14 00:25:01 +02:00
|
|
|
<p class="text-center text-gray-200">{{ $strings.LabelNew }}</p>
|
2023-04-01 01:00:45 +02:00
|
|
|
<a :href="selectedMatch.cover" target="_blank" class="bg-primary">
|
|
|
|
<covers-preview-cover :src="selectedMatch.cover" :width="100" :book-cover-aspect-ratio="bookCoverAspectRatio" />
|
|
|
|
</a>
|
|
|
|
</div>
|
2024-05-06 00:04:41 +02:00
|
|
|
<div v-if="media.coverPath" class="ml-0.5">
|
2024-05-14 00:25:01 +02:00
|
|
|
<p class="text-center text-gray-200">{{ $strings.LabelCurrent }}</p>
|
2024-03-01 10:55:53 +01:00
|
|
|
<a :href="$store.getters['globals/getLibraryItemCoverSrc'](libraryItem, null, true)" target="_blank" class="bg-primary">
|
|
|
|
<covers-preview-cover :src="$store.getters['globals/getLibraryItemCoverSrc'](libraryItem, null, true)" :width="100" :book-cover-aspect-ratio="bookCoverAspectRatio" />
|
2023-04-01 01:00:45 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
2022-08-16 00:44:58 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.title" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.title" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.title" :disabled="!selectedMatchUsage.title" :label="$strings.LabelTitle" />
|
|
|
|
<p v-if="mediaMetadata.title" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.title || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.subtitle" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.subtitle" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.subtitle" :disabled="!selectedMatchUsage.subtitle" :label="$strings.LabelSubtitle" />
|
|
|
|
<p v-if="mediaMetadata.subtitle" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.subtitle || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.author" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.author" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.author" :disabled="!selectedMatchUsage.author" :label="$strings.LabelAuthor" />
|
|
|
|
<p v-if="mediaMetadata.authorName" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.authorName || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.narrator" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.narrator" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2024-05-26 14:08:07 +02:00
|
|
|
<ui-multi-select v-model="selectedMatch.narrator" :items="narrators" :disabled="!selectedMatchUsage.narrator" :label="$strings.LabelNarrators" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.narratorName" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.narratorName || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-11-21 19:59:32 +01:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.description" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.description" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-09-27 23:49:14 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-textarea-with-label v-model="selectedMatch.description" :rows="3" :disabled="!selectedMatchUsage.description" :label="$strings.LabelDescription" />
|
|
|
|
<p v-if="mediaMetadata.description" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.description.substr(0, 100) + (mediaMetadata.description.length > 100 ? '...' : '') }}</p>
|
2022-09-27 23:49:14 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.publisher" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.publisher" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.publisher" :disabled="!selectedMatchUsage.publisher" :label="$strings.LabelPublisher" />
|
|
|
|
<p v-if="mediaMetadata.publisher" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.publisher || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.publishedYear" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.publishedYear" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.publishedYear" :disabled="!selectedMatchUsage.publishedYear" :label="$strings.LabelPublishYear" />
|
|
|
|
<p v-if="mediaMetadata.publishedYear" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.publishedYear || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
2022-01-10 01:37:16 +01:00
|
|
|
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.series" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.series" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-10-02 00:15:21 +02:00
|
|
|
<widgets-series-input-widget v-model="selectedMatch.series" :disabled="!selectedMatchUsage.series" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.seriesName" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.seriesName || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2021-11-21 19:59:32 +01:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.genres && selectedMatchOrig.genres.length" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.genres" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-05-23 04:56:51 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2023-04-18 03:09:59 +02:00
|
|
|
<ui-multi-select v-model="selectedMatch.genres" :items="genres" :disabled="!selectedMatchUsage.genres" :label="$strings.LabelGenres" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.genres" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.genres.join(', ') }}</p>
|
2022-05-23 04:56:51 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.tags" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.tags" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-05-23 04:56:51 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2024-05-26 14:08:07 +02:00
|
|
|
<ui-multi-select v-model="selectedMatch.tags" :items="tags" :disabled="!selectedMatchUsage.tags" :label="$strings.LabelTags" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="media.tags" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ media.tags.join(', ') }}</p>
|
2022-05-23 04:56:51 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.language" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.language" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-05-23 04:56:51 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.language" :disabled="!selectedMatchUsage.language" :label="$strings.LabelLanguage" />
|
|
|
|
<p v-if="mediaMetadata.language" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.language || '' }}</p>
|
2022-05-23 04:56:51 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.isbn" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.isbn" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
|
|
|
<ui-text-input-with-label v-model="selectedMatch.isbn" :disabled="!selectedMatchUsage.isbn" label="ISBN" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.isbn" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.isbn || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2022-01-10 01:37:16 +01:00
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.asin" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.asin" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-01 00:10:02 +02:00
|
|
|
<div class="flex-grow ml-4">
|
|
|
|
<ui-text-input-with-label v-model="selectedMatch.asin" :disabled="!selectedMatchUsage.asin" label="ASIN" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.asin" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.asin || '' }}</p>
|
2022-04-01 00:10:02 +02:00
|
|
|
</div>
|
2022-01-10 01:37:16 +01:00
|
|
|
</div>
|
2022-04-14 01:13:39 +02:00
|
|
|
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.itunesId" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.itunesId" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-14 01:13:39 +02:00
|
|
|
<div class="flex-grow ml-4">
|
|
|
|
<ui-text-input-with-label v-model="selectedMatch.itunesId" type="number" :disabled="!selectedMatchUsage.itunesId" label="iTunes ID" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.itunesId" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.itunesId || '' }}</p>
|
2022-04-14 01:13:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.feedUrl" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.feedUrl" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-14 01:13:39 +02:00
|
|
|
<div class="flex-grow ml-4">
|
|
|
|
<ui-text-input-with-label v-model="selectedMatch.feedUrl" :disabled="!selectedMatchUsage.feedUrl" label="RSS Feed URL" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.feedUrl" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.feedUrl || '' }}</p>
|
2022-04-14 01:13:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.itunesPageUrl" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.itunesPageUrl" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-14 01:13:39 +02:00
|
|
|
<div class="flex-grow ml-4">
|
|
|
|
<ui-text-input-with-label v-model="selectedMatch.itunesPageUrl" :disabled="!selectedMatchUsage.itunesPageUrl" label="iTunes Page URL" />
|
2022-11-08 01:27:17 +01:00
|
|
|
<p v-if="mediaMetadata.itunesPageUrl" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.itunesPageUrl || '' }}</p>
|
2022-04-14 01:13:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-01 23:51:22 +02:00
|
|
|
<div v-if="selectedMatchOrig.releaseDate" class="flex items-center py-2">
|
2022-08-16 01:00:11 +02:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.releaseDate" checkbox-bg="bg" @input="checkboxToggled" />
|
2022-04-14 01:13:39 +02:00
|
|
|
<div class="flex-grow ml-4">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-text-input-with-label v-model="selectedMatch.releaseDate" :disabled="!selectedMatchUsage.releaseDate" :label="$strings.LabelReleaseDate" />
|
|
|
|
<p v-if="mediaMetadata.releaseDate" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.releaseDate || '' }}</p>
|
2022-04-14 01:13:39 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-03-23 00:05:43 +01:00
|
|
|
<div v-if="selectedMatchOrig.explicit != null" class="flex items-center pb-2" :class="{ 'pt-2': mediaMetadata.explicit == null }">
|
2023-02-22 13:48:12 +01:00
|
|
|
<ui-checkbox v-model="selectedMatchUsage.explicit" checkbox-bg="bg" @input="checkboxToggled" />
|
2023-03-23 00:05:43 +01:00
|
|
|
<div class="flex-grow ml-4" :class="{ 'pt-4': mediaMetadata.explicit != null }">
|
|
|
|
<ui-checkbox v-model="selectedMatch.explicit" :label="$strings.LabelExplicit" :disabled="!selectedMatchUsage.explicit" :checkbox-bg="!selectedMatchUsage.explicit ? 'bg' : 'primary'" border-color="gray-600" label-class="pl-2 text-base font-semibold" />
|
2024-05-14 00:25:01 +02:00
|
|
|
<p v-if="mediaMetadata.explicit != null" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.explicit ? $strings.LabelExplicitChecked : $strings.LabelExplicitUnchecked }}</p>
|
2023-02-22 13:48:12 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-03-23 00:05:43 +01:00
|
|
|
<div v-if="selectedMatchOrig.abridged != null" class="flex items-center pb-2" :class="{ 'pt-2': mediaMetadata.abridged == null }">
|
|
|
|
<ui-checkbox v-model="selectedMatchUsage.abridged" checkbox-bg="bg" @input="checkboxToggled" />
|
|
|
|
<div class="flex-grow ml-4" :class="{ 'pt-4': mediaMetadata.abridged != null }">
|
|
|
|
<ui-checkbox v-model="selectedMatch.abridged" :label="$strings.LabelAbridged" :disabled="!selectedMatchUsage.abridged" :checkbox-bg="!selectedMatchUsage.abridged ? 'bg' : 'primary'" border-color="gray-600" label-class="pl-2 text-base font-semibold" />
|
2024-05-14 00:25:01 +02:00
|
|
|
<p v-if="mediaMetadata.abridged != null" class="text-xs ml-1 text-white text-opacity-60">{{ $strings.LabelCurrently }} {{ mediaMetadata.abridged ? $strings.LabelAbridgedChecked : $strings.LabelAbridgedUnchecked }}</p>
|
2023-03-23 00:05:43 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-04-14 01:13:39 +02:00
|
|
|
|
2021-10-28 21:41:42 +02:00
|
|
|
<div class="flex items-center justify-end py-2">
|
2022-11-08 01:27:17 +01:00
|
|
|
<ui-btn color="success" type="submit">{{ $strings.ButtonSubmit }}</ui-btn>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
2021-08-18 00:01:11 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2021-08-18 13:50:24 +02:00
|
|
|
processing: Boolean,
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItem: {
|
2021-08-18 00:01:11 +02:00
|
|
|
type: Object,
|
2023-10-04 00:16:49 +02:00
|
|
|
default: () => {}
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItemId: null,
|
2021-08-21 16:15:44 +02:00
|
|
|
searchTitle: null,
|
|
|
|
searchAuthor: null,
|
2021-08-18 00:01:11 +02:00
|
|
|
lastSearch: null,
|
2021-10-28 21:41:42 +02:00
|
|
|
provider: 'google',
|
2021-08-21 23:23:35 +02:00
|
|
|
searchResults: [],
|
2021-10-28 21:41:42 +02:00
|
|
|
hasSearched: false,
|
|
|
|
selectedMatch: null,
|
2022-10-01 23:51:22 +02:00
|
|
|
selectedMatchOrig: null,
|
2021-10-28 21:41:42 +02:00
|
|
|
selectedMatchUsage: {
|
|
|
|
title: true,
|
|
|
|
subtitle: true,
|
|
|
|
cover: true,
|
|
|
|
author: true,
|
2021-11-21 19:59:32 +01:00
|
|
|
narrator: true,
|
2021-10-28 21:41:42 +02:00
|
|
|
description: true,
|
|
|
|
publisher: true,
|
2022-03-14 01:34:31 +01:00
|
|
|
publishedYear: true,
|
2021-11-21 19:59:32 +01:00
|
|
|
series: true,
|
2022-05-28 22:54:04 +02:00
|
|
|
genres: true,
|
|
|
|
tags: true,
|
|
|
|
language: true,
|
2022-05-23 04:56:51 +02:00
|
|
|
explicit: true,
|
2022-01-10 01:37:16 +01:00
|
|
|
asin: true,
|
2022-04-14 01:13:39 +02:00
|
|
|
isbn: true,
|
2023-03-23 00:05:43 +01:00
|
|
|
abridged: true,
|
2022-04-14 01:13:39 +02:00
|
|
|
// Podcast specific
|
|
|
|
itunesPageUrl: true,
|
|
|
|
itunesId: true,
|
|
|
|
feedUrl: true,
|
|
|
|
releaseDate: true
|
2022-08-16 01:00:11 +02:00
|
|
|
},
|
|
|
|
selectAll: true
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItem: {
|
2021-08-18 00:01:11 +02:00
|
|
|
immediate: true,
|
|
|
|
handler(newVal) {
|
|
|
|
if (newVal) this.init()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-08-18 13:50:24 +02:00
|
|
|
computed: {
|
|
|
|
isProcessing: {
|
|
|
|
get() {
|
|
|
|
return this.processing
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('update:processing', val)
|
|
|
|
}
|
2021-12-03 02:40:42 +01:00
|
|
|
},
|
2022-05-23 04:56:51 +02:00
|
|
|
seriesItems: {
|
|
|
|
get() {
|
|
|
|
return this.selectedMatch.series.map((se) => {
|
|
|
|
return {
|
2022-05-28 22:54:04 +02:00
|
|
|
id: `new-${Math.floor(Math.random() * 10000)}`,
|
2022-10-02 00:01:22 +02:00
|
|
|
displayName: se.sequence ? `${se.series} #${se.sequence}` : se.series,
|
2022-05-28 22:54:04 +02:00
|
|
|
name: se.series,
|
2022-10-02 00:01:22 +02:00
|
|
|
sequence: se.sequence || ''
|
2022-05-23 04:56:51 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.selectedMatch.series = val
|
|
|
|
}
|
|
|
|
},
|
2021-12-03 02:40:42 +01:00
|
|
|
bookCoverAspectRatio() {
|
2022-08-13 20:56:37 +02:00
|
|
|
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
2022-01-09 00:03:33 +01:00
|
|
|
},
|
2024-05-26 14:08:07 +02:00
|
|
|
filterData() {
|
|
|
|
return this.$store.state.libraries.filterData
|
|
|
|
},
|
2022-01-09 00:03:33 +01:00
|
|
|
providers() {
|
2022-04-14 01:13:39 +02:00
|
|
|
if (this.isPodcast) return this.$store.state.scanners.podcastProviders
|
2022-01-09 00:03:33 +01:00
|
|
|
return this.$store.state.scanners.providers
|
2022-03-07 00:26:35 +01:00
|
|
|
},
|
|
|
|
searchTitleLabel() {
|
2022-11-08 01:27:17 +01:00
|
|
|
if (this.provider.startsWith('audible')) return this.$strings.LabelSearchTitleOrASIN
|
|
|
|
else if (this.provider == 'itunes') return this.$strings.LabelSearchTerm
|
|
|
|
return this.$strings.LabelSearchTitle
|
2022-04-01 00:10:02 +02:00
|
|
|
},
|
|
|
|
media() {
|
2023-10-04 00:16:49 +02:00
|
|
|
return this.libraryItem?.media || {}
|
2022-04-01 00:10:02 +02:00
|
|
|
},
|
|
|
|
mediaMetadata() {
|
|
|
|
return this.media.metadata || {}
|
2022-04-14 01:13:39 +02:00
|
|
|
},
|
2023-10-04 00:16:49 +02:00
|
|
|
currentBookDuration() {
|
|
|
|
if (this.isPodcast) return 0
|
|
|
|
return this.media.duration || 0
|
|
|
|
},
|
2022-04-14 01:13:39 +02:00
|
|
|
mediaType() {
|
2023-10-04 00:16:49 +02:00
|
|
|
return this.libraryItem?.mediaType || null
|
2022-04-14 01:13:39 +02:00
|
|
|
},
|
|
|
|
isPodcast() {
|
|
|
|
return this.mediaType == 'podcast'
|
2023-04-18 03:09:59 +02:00
|
|
|
},
|
2024-05-26 14:08:07 +02:00
|
|
|
narrators() {
|
|
|
|
return this.filterData.narrators || []
|
|
|
|
},
|
2023-04-18 03:09:59 +02:00
|
|
|
genres() {
|
2024-05-26 14:08:07 +02:00
|
|
|
const currentGenres = this.filterData.genres || []
|
2023-04-18 03:09:59 +02:00
|
|
|
const selectedMatchGenres = this.selectedMatch.genres || []
|
2023-09-20 13:25:21 +02:00
|
|
|
return [...new Set([...currentGenres, ...selectedMatchGenres])]
|
2024-05-26 14:08:07 +02:00
|
|
|
},
|
|
|
|
tags() {
|
|
|
|
return this.filterData.tags || []
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
methods: {
|
2022-08-16 01:00:11 +02:00
|
|
|
selectAllToggled(val) {
|
|
|
|
for (const key in this.selectedMatchUsage) {
|
|
|
|
this.selectedMatchUsage[key] = val
|
|
|
|
}
|
|
|
|
},
|
|
|
|
checkboxToggled() {
|
|
|
|
this.selectAll = Object.values(this.selectedMatchUsage).findIndex((v) => v == false) < 0
|
|
|
|
},
|
2021-12-08 01:42:56 +01:00
|
|
|
persistProvider() {
|
|
|
|
try {
|
|
|
|
localStorage.setItem('book-provider', this.provider)
|
|
|
|
} catch (error) {
|
|
|
|
console.error('PersistProvider', error)
|
|
|
|
}
|
|
|
|
},
|
2024-02-11 23:48:16 +01:00
|
|
|
getDefaultBookProvider() {
|
|
|
|
let provider = localStorage.getItem('book-provider')
|
|
|
|
if (!provider) return 'google'
|
|
|
|
// Validate book provider
|
|
|
|
if (!this.$store.getters['scanners/checkBookProviderExists'](provider)) {
|
|
|
|
console.error('Stored book provider does not exist', provider)
|
|
|
|
localStorage.removeItem('book-provider')
|
|
|
|
return 'google'
|
|
|
|
}
|
|
|
|
return provider
|
|
|
|
},
|
2021-08-21 16:15:44 +02:00
|
|
|
getSearchQuery() {
|
2023-09-20 13:25:21 +02:00
|
|
|
if (this.isPodcast) return `term=${encodeURIComponent(this.searchTitle)}`
|
|
|
|
var searchQuery = `provider=${this.provider}&fallbackTitleOnly=1&title=${encodeURIComponent(this.searchTitle)}`
|
|
|
|
if (this.searchAuthor) searchQuery += `&author=${encodeURIComponent(this.searchAuthor)}`
|
2023-12-08 23:33:06 +01:00
|
|
|
if (this.libraryItemId) searchQuery += `&id=${this.libraryItemId}`
|
2021-08-21 16:15:44 +02:00
|
|
|
return searchQuery
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
submitSearch() {
|
2021-08-21 16:15:44 +02:00
|
|
|
if (!this.searchTitle) {
|
|
|
|
this.$toast.warning('Search title is required')
|
|
|
|
return
|
|
|
|
}
|
2021-12-08 01:42:56 +01:00
|
|
|
this.persistProvider()
|
2021-08-18 00:01:11 +02:00
|
|
|
this.runSearch()
|
|
|
|
},
|
|
|
|
async runSearch() {
|
2022-12-13 00:45:51 +01:00
|
|
|
const searchQuery = this.getSearchQuery()
|
2021-08-21 16:15:44 +02:00
|
|
|
if (this.lastSearch === searchQuery) return
|
2021-08-18 00:01:11 +02:00
|
|
|
this.searchResults = []
|
2021-08-21 01:29:10 +02:00
|
|
|
this.isProcessing = true
|
2021-08-21 16:15:44 +02:00
|
|
|
this.lastSearch = searchQuery
|
2022-12-13 00:45:51 +01:00
|
|
|
const searchEntity = this.isPodcast ? 'podcast' : 'books'
|
|
|
|
let results = await this.$axios.$get(`/api/search/${searchEntity}?${searchQuery}`, { timeout: 20000 }).catch((error) => {
|
2021-08-18 13:50:24 +02:00
|
|
|
console.error('Failed', error)
|
|
|
|
return []
|
|
|
|
})
|
2022-04-14 01:13:39 +02:00
|
|
|
// console.log('Got search results', results)
|
|
|
|
results = (results || []).filter((res) => {
|
2021-08-18 13:50:24 +02:00
|
|
|
return !!res.title
|
|
|
|
})
|
2022-04-14 01:13:39 +02:00
|
|
|
|
|
|
|
if (this.isPodcast) {
|
|
|
|
// Map to match PodcastMetadata keys
|
|
|
|
results = results.map((res) => {
|
|
|
|
res.itunesPageUrl = res.pageUrl || null
|
|
|
|
res.itunesId = res.id || null
|
|
|
|
res.author = res.artistName || null
|
2023-02-22 13:48:12 +01:00
|
|
|
res.explicit = res.explicit || false
|
2022-04-14 01:13:39 +02:00
|
|
|
return res
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
this.searchResults = results || []
|
2021-08-21 01:29:10 +02:00
|
|
|
this.isProcessing = false
|
2021-08-21 23:23:35 +02:00
|
|
|
this.hasSearched = true
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
2022-12-17 17:27:27 +01:00
|
|
|
initSelectedMatchUsage() {
|
2021-10-28 21:41:42 +02:00
|
|
|
this.selectedMatchUsage = {
|
|
|
|
title: true,
|
|
|
|
subtitle: true,
|
|
|
|
cover: true,
|
|
|
|
author: true,
|
2021-11-21 19:59:32 +01:00
|
|
|
narrator: true,
|
2021-10-28 21:41:42 +02:00
|
|
|
description: true,
|
|
|
|
publisher: true,
|
2022-03-14 01:34:31 +01:00
|
|
|
publishedYear: true,
|
2021-11-21 19:59:32 +01:00
|
|
|
series: true,
|
2022-05-28 22:54:04 +02:00
|
|
|
genres: true,
|
|
|
|
tags: true,
|
|
|
|
language: true,
|
2022-05-23 04:56:51 +02:00
|
|
|
explicit: true,
|
2022-01-10 01:37:16 +01:00
|
|
|
asin: true,
|
2022-04-14 01:13:39 +02:00
|
|
|
isbn: true,
|
2023-03-23 00:05:43 +01:00
|
|
|
abridged: true,
|
2022-04-14 01:13:39 +02:00
|
|
|
// Podcast specific
|
|
|
|
itunesPageUrl: true,
|
|
|
|
itunesId: true,
|
|
|
|
feedUrl: true,
|
|
|
|
releaseDate: true
|
2021-10-28 21:41:42 +02:00
|
|
|
}
|
|
|
|
|
2022-12-17 17:27:27 +01:00
|
|
|
// Load saved selected match from local storage
|
|
|
|
try {
|
|
|
|
let savedSelectedMatchUsage = localStorage.getItem('selectedMatchUsage')
|
|
|
|
if (!savedSelectedMatchUsage) return
|
|
|
|
savedSelectedMatchUsage = JSON.parse(savedSelectedMatchUsage)
|
|
|
|
|
|
|
|
for (const key in savedSelectedMatchUsage) {
|
|
|
|
if (this.selectedMatchUsage[key] !== undefined) {
|
|
|
|
this.selectedMatchUsage[key] = !!savedSelectedMatchUsage[key]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.error('Failed to load saved selectedMatchUsage', error)
|
|
|
|
}
|
|
|
|
|
|
|
|
this.checkboxToggled()
|
|
|
|
},
|
|
|
|
init() {
|
|
|
|
this.clearSelectedMatch()
|
|
|
|
this.initSelectedMatchUsage()
|
|
|
|
|
2022-03-11 01:45:02 +01:00
|
|
|
if (this.libraryItem.id !== this.libraryItemId) {
|
2021-08-21 23:23:35 +02:00
|
|
|
this.searchResults = []
|
|
|
|
this.hasSearched = false
|
2022-03-11 01:45:02 +01:00
|
|
|
this.libraryItemId = this.libraryItem.id
|
2021-08-21 23:23:35 +02:00
|
|
|
}
|
|
|
|
|
2022-03-11 01:45:02 +01:00
|
|
|
if (!this.libraryItem.media || !this.libraryItem.media.metadata.title) {
|
2021-08-21 16:15:44 +02:00
|
|
|
this.searchTitle = null
|
2021-08-21 23:23:35 +02:00
|
|
|
this.searchAuthor = null
|
2021-08-18 00:01:11 +02:00
|
|
|
return
|
|
|
|
}
|
2022-03-11 01:45:02 +01:00
|
|
|
this.searchTitle = this.libraryItem.media.metadata.title
|
|
|
|
this.searchAuthor = this.libraryItem.media.metadata.authorName || ''
|
2022-04-14 01:13:39 +02:00
|
|
|
if (this.isPodcast) this.provider = 'itunes'
|
2024-02-11 23:48:16 +01:00
|
|
|
else {
|
|
|
|
this.provider = this.getDefaultBookProvider()
|
|
|
|
}
|
2022-08-04 00:53:19 +02:00
|
|
|
|
2023-01-07 23:22:59 +01:00
|
|
|
// Prefer using ASIN if set and using audible provider
|
|
|
|
if (this.provider.startsWith('audible') && this.libraryItem.media.metadata.asin) {
|
|
|
|
this.searchTitle = this.libraryItem.media.metadata.asin
|
|
|
|
this.searchAuthor = ''
|
|
|
|
}
|
|
|
|
|
2022-08-04 00:53:19 +02:00
|
|
|
if (this.searchTitle) {
|
|
|
|
this.submitSearch()
|
|
|
|
}
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
2021-10-28 21:41:42 +02:00
|
|
|
selectMatch(match) {
|
2022-06-10 00:56:16 +02:00
|
|
|
if (match) {
|
|
|
|
if (match.series) {
|
|
|
|
if (!match.series.length) {
|
|
|
|
delete match.series
|
|
|
|
} else {
|
|
|
|
match.series = match.series.map((se) => {
|
|
|
|
return {
|
|
|
|
id: `new-${Math.floor(Math.random() * 10000)}`,
|
2022-10-02 00:01:22 +02:00
|
|
|
displayName: se.sequence ? `${se.series} #${se.sequence}` : se.series,
|
2022-06-10 00:56:16 +02:00
|
|
|
name: se.series,
|
2022-10-02 00:01:22 +02:00
|
|
|
sequence: se.sequence || ''
|
2022-06-10 00:56:16 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2022-10-01 23:51:22 +02:00
|
|
|
if (match.genres && !Array.isArray(match.genres)) {
|
|
|
|
// match.genres = match.genres.join(',')
|
|
|
|
match.genres = match.genres.split(',').map((g) => g.trim())
|
2022-06-04 02:21:31 +02:00
|
|
|
}
|
2024-05-26 14:08:07 +02:00
|
|
|
if (match.tags && !Array.isArray(match.tags)) {
|
|
|
|
match.tags = match.tags.split(',').map((g) => g.trim())
|
|
|
|
}
|
|
|
|
if (match.narrator && !Array.isArray(match.narrator)) {
|
|
|
|
match.narrator = match.narrator.split(',').map((g) => g.trim())
|
|
|
|
}
|
2022-05-28 22:54:04 +02:00
|
|
|
}
|
|
|
|
|
2022-06-10 00:56:16 +02:00
|
|
|
console.log('Select Match', match)
|
2021-10-28 21:41:42 +02:00
|
|
|
this.selectedMatch = match
|
2022-10-01 23:51:22 +02:00
|
|
|
this.selectedMatchOrig = JSON.parse(JSON.stringify(match))
|
2021-10-28 21:41:42 +02:00
|
|
|
},
|
|
|
|
buildMatchUpdatePayload() {
|
|
|
|
var updatePayload = {}
|
2022-05-23 04:56:51 +02:00
|
|
|
updatePayload.metadata = {}
|
2022-03-14 14:12:28 +01:00
|
|
|
|
2021-10-28 21:41:42 +02:00
|
|
|
for (const key in this.selectedMatchUsage) {
|
|
|
|
if (this.selectedMatchUsage[key] && this.selectedMatch[key]) {
|
2022-03-14 14:12:28 +01:00
|
|
|
if (key === 'series') {
|
2022-05-28 22:54:04 +02:00
|
|
|
if (!Array.isArray(this.selectedMatch[key])) {
|
2022-10-02 00:01:22 +02:00
|
|
|
console.error('Invalid series in selectedMatch', this.selectedMatch[key])
|
2022-05-28 22:54:04 +02:00
|
|
|
} else {
|
2022-10-02 00:01:22 +02:00
|
|
|
var seriesPayload = []
|
2022-05-28 22:54:04 +02:00
|
|
|
this.selectedMatch[key].forEach((seriesItem) =>
|
|
|
|
seriesPayload.push({
|
|
|
|
id: seriesItem.id,
|
|
|
|
name: seriesItem.name,
|
|
|
|
sequence: seriesItem.sequence
|
|
|
|
})
|
|
|
|
)
|
2022-10-02 00:01:22 +02:00
|
|
|
updatePayload.metadata.series = seriesPayload
|
2022-05-28 22:54:04 +02:00
|
|
|
}
|
2022-04-14 01:13:39 +02:00
|
|
|
} else if (key === 'author' && !this.isPodcast) {
|
2022-06-10 00:56:16 +02:00
|
|
|
var authors = this.selectedMatch[key]
|
|
|
|
if (!Array.isArray(authors)) {
|
2024-03-28 23:00:07 +01:00
|
|
|
authors = authors
|
|
|
|
.split(',')
|
|
|
|
.map((au) => au.trim())
|
|
|
|
.filter((au) => !!au)
|
2022-06-04 02:21:31 +02:00
|
|
|
}
|
2022-05-23 04:56:51 +02:00
|
|
|
var authorPayload = []
|
2022-06-10 00:56:16 +02:00
|
|
|
authors.forEach((authorName) =>
|
2022-05-28 22:54:04 +02:00
|
|
|
authorPayload.push({
|
|
|
|
id: `new-${Math.floor(Math.random() * 10000)}`,
|
|
|
|
name: authorName
|
|
|
|
})
|
|
|
|
)
|
2022-05-23 04:56:51 +02:00
|
|
|
updatePayload.metadata.authors = authorPayload
|
2022-03-14 14:12:28 +01:00
|
|
|
} else if (key === 'narrator') {
|
2024-05-26 14:08:07 +02:00
|
|
|
updatePayload.metadata.narrators = this.selectedMatch[key]
|
2022-05-23 04:56:51 +02:00
|
|
|
} else if (key === 'genres') {
|
2022-10-01 23:51:22 +02:00
|
|
|
updatePayload.metadata.genres = [...this.selectedMatch[key]]
|
2022-05-23 04:56:51 +02:00
|
|
|
} else if (key === 'tags') {
|
2024-05-26 14:08:07 +02:00
|
|
|
updatePayload.tags = this.selectedMatch[key]
|
2022-04-14 01:13:39 +02:00
|
|
|
} else if (key === 'itunesId') {
|
2022-05-23 04:56:51 +02:00
|
|
|
updatePayload.metadata.itunesId = Number(this.selectedMatch[key])
|
|
|
|
} else {
|
|
|
|
updatePayload.metadata[key] = this.selectedMatch[key]
|
2022-03-14 14:12:28 +01:00
|
|
|
}
|
2021-10-28 21:41:42 +02:00
|
|
|
}
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
2022-05-28 22:54:04 +02:00
|
|
|
|
2021-10-28 21:41:42 +02:00
|
|
|
return updatePayload
|
|
|
|
},
|
|
|
|
async submitMatchUpdate() {
|
|
|
|
var updatePayload = this.buildMatchUpdatePayload()
|
|
|
|
if (!Object.keys(updatePayload).length) {
|
|
|
|
return
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
2022-06-10 00:56:16 +02:00
|
|
|
|
|
|
|
console.log('Match payload', updatePayload)
|
2021-10-28 21:41:42 +02:00
|
|
|
this.isProcessing = true
|
|
|
|
|
2022-12-17 17:27:27 +01:00
|
|
|
// Persist in local storage
|
|
|
|
localStorage.setItem('selectedMatchUsage', JSON.stringify(this.selectedMatchUsage))
|
|
|
|
|
2021-10-28 21:41:42 +02:00
|
|
|
if (Object.keys(updatePayload).length) {
|
2024-02-01 11:03:12 +01:00
|
|
|
if (updatePayload.metadata.cover) {
|
|
|
|
updatePayload.url = updatePayload.metadata.cover
|
|
|
|
delete updatePayload.metadata.cover
|
|
|
|
}
|
2022-12-17 17:27:27 +01:00
|
|
|
const mediaUpdatePayload = updatePayload
|
|
|
|
const updateResult = await this.$axios.$patch(`/api/items/${this.libraryItemId}/media`, mediaUpdatePayload).catch((error) => {
|
2021-10-28 21:41:42 +02:00
|
|
|
console.error('Failed to update', error)
|
|
|
|
return false
|
|
|
|
})
|
2022-03-14 14:12:28 +01:00
|
|
|
if (updateResult) {
|
|
|
|
if (updateResult.updated) {
|
2022-11-09 00:10:08 +01:00
|
|
|
this.$toast.success(this.$strings.ToastItemDetailsUpdateSuccess)
|
2022-03-14 14:12:28 +01:00
|
|
|
} else {
|
2022-11-09 00:10:08 +01:00
|
|
|
this.$toast.info(this.$strings.ToastItemDetailsUpdateUnneeded)
|
2022-03-14 14:12:28 +01:00
|
|
|
}
|
2022-10-01 23:51:22 +02:00
|
|
|
this.clearSelectedMatch()
|
2021-10-28 21:41:42 +02:00
|
|
|
this.$emit('selectTab', 'details')
|
|
|
|
} else {
|
2022-11-09 00:10:08 +01:00
|
|
|
this.$toast.error(this.$strings.ToastItemDetailsUpdateFailed)
|
2021-10-28 21:41:42 +02:00
|
|
|
}
|
|
|
|
} else {
|
2022-10-01 23:51:22 +02:00
|
|
|
this.clearSelectedMatch()
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
2022-12-17 17:27:27 +01:00
|
|
|
|
2021-08-18 13:50:24 +02:00
|
|
|
this.isProcessing = false
|
2022-10-01 23:51:22 +02:00
|
|
|
},
|
|
|
|
clearSelectedMatch() {
|
|
|
|
this.selectedMatch = null
|
|
|
|
this.selectedMatchOrig = null
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
}
|
2021-08-21 16:15:44 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.matchListWrapper {
|
2022-08-04 01:27:38 +02:00
|
|
|
height: calc(100% - 124px);
|
|
|
|
}
|
2023-09-20 13:25:21 +02:00
|
|
|
|
2022-08-04 01:27:38 +02:00
|
|
|
@media (min-width: 768px) {
|
|
|
|
.matchListWrapper {
|
|
|
|
height: calc(100% - 80px);
|
|
|
|
}
|
2021-08-21 16:15:44 +02:00
|
|
|
}
|
2022-04-03 00:37:44 +02:00
|
|
|
</style>
|