This commit is contained in:
jxxghp
2023-07-06 22:23:43 +08:00
parent e09de5abcf
commit f81c0c83a0
+13 -15
View File
@@ -18,6 +18,9 @@ const $toast = useToast();
// 图片加载状态 // 图片加载状态
const isImageLoaded = ref(false); const isImageLoaded = ref(false);
// TMDB识别标志
const tmdbFlag = ref(true);
// 当前订阅状态 // 当前订阅状态
const isSubscribed = ref(false); const isSubscribed = ref(false);
@@ -61,6 +64,9 @@ const handleAddSubscribe = async () => {
} }
// 检查各季的缺失状态 // 检查各季的缺失状态
await checkSeasonsNotExists(); await checkSeasonsNotExists();
if (!tmdbFlag.value) {
return;
}
if (seasonInfos.value.length == 1) { if (seasonInfos.value.length == 1) {
// 只有1季 // 只有1季
if (!seasonsNotExisted.value[1]) { if (!seasonsNotExisted.value[1]) {
@@ -79,6 +85,9 @@ const handleAddSubscribe = async () => {
let season = props.media?.season || 1; let season = props.media?.season || 1;
// 检查缺失情况 // 检查缺失情况
await checkSeasonsNotExists(); await checkSeasonsNotExists();
if (!tmdbFlag.value) {
return;
}
if (!seasonsNotExisted.value[season]) { if (!seasonsNotExisted.value[season]) {
// 已存在 // 已存在
$toast.warning(`${props.media?.title} 媒体库中已存在!`); $toast.warning(`${props.media?.title} 媒体库中已存在!`);
@@ -208,13 +217,7 @@ const checkSeasonsNotExists = async () => {
// 开始处理 // 开始处理
startNProgress(); startNProgress();
try { try {
const result: NotExistMediaInfo[] = await api.post(`download/notexists`, { const result: NotExistMediaInfo[] = await api.post(`download/notexists`, props.media);
title: props.media?.title,
type: props.media?.type,
tmdb_id: props.media?.tmdb_id,
year: props.media?.year,
doubanid: props.media?.douban_id,
});
if (result) { if (result) {
result.forEach((item) => { result.forEach((item) => {
// 0-已存在 1-部分缺失 2-全部缺失 // 0-已存在 1-部分缺失 2-全部缺失
@@ -228,7 +231,8 @@ const checkSeasonsNotExists = async () => {
}); });
} }
} catch (error) { } catch (error) {
console.error(error); $toast.error(`${props.media?.title}无法识别到themoviedb媒体信息!`);
tmdbFlag.value = false;
} }
// 处理完成 // 处理完成
doneNProgress(); doneNProgress();
@@ -237,13 +241,7 @@ const checkSeasonsNotExists = async () => {
// 检查电影是否存在 // 检查电影是否存在
const checkMovieExists = async () => { const checkMovieExists = async () => {
try { try {
const result: NotExistMediaInfo[] = await api.post(`download/notexists`, { const result: NotExistMediaInfo[] = await api.post(`download/notexists`, props.media);
title: props.media?.title,
type: props.media?.type,
tmdb_id: props.media?.tmdb_id,
year: props.media?.year,
doubanid: props.media?.douban_id,
});
if (!result || result.length === 0) { if (!result || result.length === 0) {
// 没有缺失的就是存在 // 没有缺失的就是存在
return true; return true;