mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-10 14:09:43 +08:00
fix: backend parser error.
search add button function.
This commit is contained in:
@@ -14,9 +14,13 @@ logger = logging.getLogger(__name__)
|
||||
class RSSAnalyser(TitleParser):
|
||||
def official_title_parser(self, bangumi: Bangumi, rss: RSSItem, torrent: Torrent):
|
||||
if rss.parser == "mikan":
|
||||
bangumi.poster_link, bangumi.official_title = self.mikan_parser(
|
||||
torrent.homepage
|
||||
)
|
||||
try:
|
||||
bangumi.poster_link, bangumi.official_title = self.mikan_parser(
|
||||
torrent.homepage
|
||||
)
|
||||
except AttributeError:
|
||||
logger.warning("[Parser] Mikan torrent has no homepage info.")
|
||||
pass
|
||||
elif rss.parser == "tmdb":
|
||||
tmdb_title, season, year, poster_link = self.tmdb_parser(
|
||||
bangumi.official_title, bangumi.season, settings.rss_parser.language
|
||||
|
||||
@@ -13,8 +13,8 @@ const message = useMessage();
|
||||
const { getAll } = useBangumiStore();
|
||||
|
||||
const rss = ref<RSS>(rssTemplate);
|
||||
const searchRule = defineModel<BangumiRule>('searchRule', { default: null });
|
||||
const rule = ref<BangumiRule>(ruleTemplate);
|
||||
|
||||
const parserType = ['mikan', 'tmdb', 'parser'];
|
||||
|
||||
const window = reactive({
|
||||
@@ -33,6 +33,10 @@ watch(show, (val) => {
|
||||
setTimeout(() => {
|
||||
window.next = false;
|
||||
}, 300);
|
||||
} else if (val || searchRule.value) {
|
||||
window.next = true;
|
||||
window.rule = true;
|
||||
rule.value = searchRule.value;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,9 +63,6 @@ async function addRss() {
|
||||
window.loading = true;
|
||||
const data = await apiDownload.analysis(rss.value);
|
||||
window.loading = false;
|
||||
const response = await apiRSS.add(rss.value);
|
||||
message.success(response.msg_en);
|
||||
console.log('rss', response);
|
||||
rule.value = data;
|
||||
window.next = true;
|
||||
window.rule = true;
|
||||
|
||||
@@ -10,6 +10,7 @@ const {
|
||||
provider,
|
||||
loading,
|
||||
onSearch,
|
||||
clearSearch,
|
||||
inputValue,
|
||||
bangumiList,
|
||||
} = useSearchStore();
|
||||
@@ -63,9 +64,11 @@ function onSelect(site: string) {
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
abs top-84px left-192px space-y-12px z-8
|
||||
v-on-click-outside="clearSearch"
|
||||
abs top-84px left-192px z-8
|
||||
>
|
||||
<TransitionGroup name="search-result">
|
||||
<TransitionGroup name="result" tag="ab-bangumi-card" space-y-12px>
|
||||
<!-- TODO: Transition Effect to fix. -->
|
||||
<ab-bangumi-card
|
||||
v-for="bangumi in bangumiList"
|
||||
:key="bangumi.id"
|
||||
@@ -81,7 +84,7 @@ function onSelect(site: string) {
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search-result-enter-active, .search-result-leave-active {
|
||||
.result-enter-active {
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,14 @@ import {
|
||||
Power,
|
||||
Refresh,
|
||||
} from '@icon-park/vue-next';
|
||||
import type {BangumiRule} from "#/bangumi";
|
||||
|
||||
const {t, changeLocale} = useMyI18n();
|
||||
const {running, onUpdate, offUpdate} = useAppInfo();
|
||||
|
||||
const show = ref(false);
|
||||
const showAccount = ref(false);
|
||||
const showAdd = ref(false);
|
||||
const searchRule = ref<BangumiRule>()
|
||||
|
||||
const {start, pause, shutdown, restart, resetRule} = useProgramStore();
|
||||
|
||||
@@ -52,13 +54,19 @@ const items = [
|
||||
label: () => t('topbar.profile.title'),
|
||||
icon: Me,
|
||||
handle: () => {
|
||||
show.value = true;
|
||||
showAccount.value = true;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const onSearchFocus = ref(false);
|
||||
|
||||
function addSearchResult(bangumi: BangumiRule) {
|
||||
showAdd.value = true;
|
||||
searchRule.value = bangumi;
|
||||
console.log('searchRule', searchRule.value);
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
onUpdate();
|
||||
});
|
||||
@@ -76,7 +84,7 @@ onUnmounted(() => {
|
||||
<img v-show="onSearchFocus === false" src="/images/AutoBangumi.svg" alt="AutoBangumi" h-24px rel top-2px/>
|
||||
</div>
|
||||
|
||||
<ab-search-bar/>
|
||||
<ab-search-bar @add-bangumi="addSearchResult"/>
|
||||
</div>
|
||||
|
||||
<div ml-auto>
|
||||
@@ -88,8 +96,8 @@ onUnmounted(() => {
|
||||
></ab-status-bar>
|
||||
</div>
|
||||
|
||||
<ab-change-account v-model:show="show"></ab-change-account>
|
||||
<ab-change-account v-model:show="showAccount"></ab-change-account>
|
||||
|
||||
<ab-add-bangumi v-model:show="showAdd"></ab-add-bangumi>
|
||||
<ab-add-bangumi v-model:show="showAdd" v-model:searchRule="searchRule"></ab-add-bangumi>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -14,8 +14,11 @@ definePage({
|
||||
|
||||
<template>
|
||||
<div overflow-auto mt-12px flex-grow>
|
||||
<div flex="~ wrap" gap-y-12px gap-x-32px>
|
||||
<transition-group name="fade">
|
||||
<div>
|
||||
<TransitionGroup
|
||||
name="bangumi" tag="div"
|
||||
flex="~ wrap" gap-y-12px gap-x-32px>
|
||||
<!-- TODO: Transition Effect to fix. -->
|
||||
<ab-bangumi-card
|
||||
v-for="i in bangumi"
|
||||
:key="i.id"
|
||||
@@ -24,7 +27,7 @@ definePage({
|
||||
type="primary"
|
||||
@click="() => openEditPopup(i)"
|
||||
></ab-bangumi-card>
|
||||
</transition-group>
|
||||
</TransitionGroup>
|
||||
|
||||
<ab-edit-rule
|
||||
v-model:show="editRule.show"
|
||||
@@ -40,7 +43,7 @@ definePage({
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
.bangumi-enter-active, .bangumi-leave-active {
|
||||
transition: opacity .3s;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,8 +3,7 @@ import {
|
||||
EMPTY,
|
||||
Subject,
|
||||
debounceTime,
|
||||
switchMap,
|
||||
tap,
|
||||
switchMap, tap,
|
||||
} from "rxjs";
|
||||
import type {BangumiRule} from "#/bangumi";
|
||||
|
||||
@@ -16,12 +15,13 @@ export function useSearchStore() {
|
||||
const providers = ref<string[]>(['mikan', 'dmhy', 'nyaa']);
|
||||
const provider = ref<string>(providers.value[0]);
|
||||
|
||||
const loading = ref<boolean>(true);
|
||||
const loading = ref<boolean>(false);
|
||||
|
||||
const input$ = new Subject<string>();
|
||||
|
||||
watch(inputValue, input => {
|
||||
input$.next(input);
|
||||
loading.value = !!input;
|
||||
})
|
||||
|
||||
const {execute: getProviders, onResult: onGetProvidersResult} = useApi(
|
||||
@@ -50,15 +50,16 @@ export function useSearchStore() {
|
||||
}),
|
||||
tap((bangumi: BangumiRule) => {
|
||||
bangumiList.value.push(bangumi);
|
||||
|
||||
}),
|
||||
).subscribe()
|
||||
|
||||
function onSearch() {
|
||||
console.log(inputValue.value, 'onSearch');
|
||||
loading.value = true;
|
||||
input$.next(inputValue.value);
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
function clearSearch() {
|
||||
inputValue.value = '';
|
||||
bangumiList.value = [];
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -66,6 +67,7 @@ export function useSearchStore() {
|
||||
bangumiInfo$,
|
||||
inputValue,
|
||||
onSearch,
|
||||
clearSearch,
|
||||
loading,
|
||||
provider,
|
||||
getProviders,
|
||||
|
||||
Reference in New Issue
Block a user