mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
fix #397
This commit is contained in:
@@ -6,10 +6,20 @@ import type { DownloaderConf, MediaInfo, TorrentInfo, TransferDirectoryConf } fr
|
|||||||
import { formatFileSize } from '@/@core/utils/formatters'
|
import { formatFileSize } from '@/@core/utils/formatters'
|
||||||
import { VCardTitle, VChip } from 'vuetify/lib/components/index.mjs'
|
import { VCardTitle, VChip } from 'vuetify/lib/components/index.mjs'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import MediaIdSelector from '../misc/MediaIdSelector.vue'
|
||||||
|
import { numberValidator } from '@/@validators'
|
||||||
|
import { useGlobalSettingsStore } from '@/stores'
|
||||||
|
|
||||||
// 多语言支持
|
// 多语言支持
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
// 从 provide 中获取全局设置
|
||||||
|
const globalSettingsStore = useGlobalSettingsStore()
|
||||||
|
const globalSettings = globalSettingsStore.globalSettings
|
||||||
|
|
||||||
|
// 当前识别类型
|
||||||
|
const mediaSource = ref(globalSettings.RECOGNIZE_SOURCE || 'themoviedb')
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: String,
|
title: String,
|
||||||
@@ -38,6 +48,18 @@ const directories = ref<TransferDirectoryConf[]>([])
|
|||||||
// 是否正在加载
|
// 是否正在加载
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
|
// 是否显示高级选项
|
||||||
|
const showAdvancedOptions = ref(false)
|
||||||
|
|
||||||
|
// TMDB ID
|
||||||
|
const tmdbid = ref<number | undefined>(undefined)
|
||||||
|
|
||||||
|
// 豆瓣ID
|
||||||
|
const doubanId = ref<string | undefined>(undefined)
|
||||||
|
|
||||||
|
// TMDB选择对话框
|
||||||
|
const mediaSelectorDialog = ref(false)
|
||||||
|
|
||||||
// 计算按钮图标
|
// 计算按钮图标
|
||||||
const icon = computed(() => (loading.value ? 'mdi-progress-download' : 'mdi-download'))
|
const icon = computed(() => (loading.value ? 'mdi-progress-download' : 'mdi-download'))
|
||||||
|
|
||||||
@@ -96,6 +118,14 @@ async function addDownload() {
|
|||||||
payload.media_in = props.media
|
payload.media_in = props.media
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加媒体ID辅助识别
|
||||||
|
if (tmdbid.value) {
|
||||||
|
payload.tmdbid = tmdbid.value
|
||||||
|
}
|
||||||
|
if (doubanId.value) {
|
||||||
|
payload.doubanid = doubanId.value
|
||||||
|
}
|
||||||
|
|
||||||
const endpoint = props.media ? 'download/' : 'download/add'
|
const endpoint = props.media ? 'download/' : 'download/add'
|
||||||
|
|
||||||
result = await api.post(endpoint, payload)
|
result = await api.post(endpoint, payload)
|
||||||
@@ -202,6 +232,56 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
|
<VRow class="px-5 mt-2">
|
||||||
|
<VCol cols="12">
|
||||||
|
<VBtn
|
||||||
|
variant="text"
|
||||||
|
size="small"
|
||||||
|
:prepend-icon="showAdvancedOptions ? 'mdi-chevron-up' : 'mdi-chevron-down'"
|
||||||
|
@click="showAdvancedOptions = !showAdvancedOptions"
|
||||||
|
>
|
||||||
|
{{
|
||||||
|
showAdvancedOptions
|
||||||
|
? t('dialog.addDownload.hideAdvancedOptions')
|
||||||
|
: t('dialog.addDownload.showAdvancedOptions')
|
||||||
|
}}
|
||||||
|
</VBtn>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
|
<VRow v-show="showAdvancedOptions" class="px-5">
|
||||||
|
<VCol cols="12">
|
||||||
|
<VTextField
|
||||||
|
v-if="mediaSource === 'themoviedb'"
|
||||||
|
v-model="tmdbid"
|
||||||
|
:label="t('dialog.reorganize.tmdbId')"
|
||||||
|
:placeholder="t('dialog.reorganize.mediaIdPlaceholder')"
|
||||||
|
:rules="[numberValidator]"
|
||||||
|
append-inner-icon="mdi-magnify"
|
||||||
|
:hint="t('dialog.reorganize.mediaIdHint')"
|
||||||
|
persistent-hint
|
||||||
|
prepend-inner-icon="mdi-identifier"
|
||||||
|
size="small"
|
||||||
|
variant="underlined"
|
||||||
|
density="comfortable"
|
||||||
|
@click:append-inner="mediaSelectorDialog = true"
|
||||||
|
/>
|
||||||
|
<VTextField
|
||||||
|
v-else
|
||||||
|
v-model="doubanId"
|
||||||
|
:label="t('dialog.reorganize.doubanId')"
|
||||||
|
:placeholder="t('dialog.reorganize.mediaIdPlaceholder')"
|
||||||
|
:rules="[numberValidator]"
|
||||||
|
append-inner-icon="mdi-magnify"
|
||||||
|
:hint="t('dialog.reorganize.mediaIdHint')"
|
||||||
|
persistent-hint
|
||||||
|
prepend-inner-icon="mdi-identifier"
|
||||||
|
size="small"
|
||||||
|
variant="underlined"
|
||||||
|
density="comfortable"
|
||||||
|
@click:append-inner="mediaSelectorDialog = true"
|
||||||
|
/>
|
||||||
|
</VCol>
|
||||||
|
</VRow>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
<VCardText class="text-center">
|
<VCardText class="text-center">
|
||||||
<VBtn variant="elevated" :disabled="loading" @click="addDownload" :prepend-icon="icon" class="px-5">
|
<VBtn variant="elevated" :disabled="loading" @click="addDownload" :prepend-icon="icon" class="px-5">
|
||||||
@@ -209,5 +289,15 @@ onMounted(() => {
|
|||||||
</VBtn>
|
</VBtn>
|
||||||
</VCardText>
|
</VCardText>
|
||||||
</VCard>
|
</VCard>
|
||||||
|
<!-- 媒体ID选择器 -->
|
||||||
|
<VDialog v-model="mediaSelectorDialog" width="40rem" scrollable max-height="85vh">
|
||||||
|
<MediaIdSelector
|
||||||
|
v-if="mediaSource === 'themoviedb'"
|
||||||
|
v-model="tmdbid"
|
||||||
|
@close="mediaSelectorDialog = false"
|
||||||
|
:type="mediaSource"
|
||||||
|
/>
|
||||||
|
<MediaIdSelector v-else v-model="doubanId" @close="mediaSelectorDialog = false" :type="mediaSource" />
|
||||||
|
</VDialog>
|
||||||
</VDialog>
|
</VDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1914,6 +1914,8 @@ export default {
|
|||||||
startDownload: 'Start Download',
|
startDownload: 'Start Download',
|
||||||
downloadSuccess: '{site} {title} downloaded successfully!',
|
downloadSuccess: '{site} {title} downloaded successfully!',
|
||||||
downloadFailed: '{site} {title} download failed: {message}!',
|
downloadFailed: '{site} {title} download failed: {message}!',
|
||||||
|
showAdvancedOptions: 'Show Advanced Options',
|
||||||
|
hideAdvancedOptions: 'Hide Advanced Options',
|
||||||
},
|
},
|
||||||
subscribeShare: {
|
subscribeShare: {
|
||||||
shareSubscription: 'Share Subscription',
|
shareSubscription: 'Share Subscription',
|
||||||
|
|||||||
@@ -1890,6 +1890,8 @@ export default {
|
|||||||
startDownload: '开始下载',
|
startDownload: '开始下载',
|
||||||
downloadSuccess: '{site} {title} 下载成功!',
|
downloadSuccess: '{site} {title} 下载成功!',
|
||||||
downloadFailed: '{site} {title} 下载失败:{message}!',
|
downloadFailed: '{site} {title} 下载失败:{message}!',
|
||||||
|
showAdvancedOptions: '显示高级选项',
|
||||||
|
hideAdvancedOptions: '隐藏高级选项',
|
||||||
},
|
},
|
||||||
subscribeShare: {
|
subscribeShare: {
|
||||||
shareSubscription: '分享订阅',
|
shareSubscription: '分享订阅',
|
||||||
|
|||||||
@@ -1876,6 +1876,8 @@ export default {
|
|||||||
startDownload: '開始下載',
|
startDownload: '開始下載',
|
||||||
downloadSuccess: '{site} {title} 下載成功!',
|
downloadSuccess: '{site} {title} 下載成功!',
|
||||||
downloadFailed: '{site} {title} 下載失敗:{message}!',
|
downloadFailed: '{site} {title} 下載失敗:{message}!',
|
||||||
|
showAdvancedOptions: '顯示高級選項',
|
||||||
|
hideAdvancedOptions: '隱藏高級選項',
|
||||||
},
|
},
|
||||||
subscribeShare: {
|
subscribeShare: {
|
||||||
shareSubscription: '分享訂閱',
|
shareSubscription: '分享訂閱',
|
||||||
|
|||||||
Reference in New Issue
Block a user