Skip to content

Commit

Permalink
Merge pull request #570 from EstrellaXD/3.1-dev
Browse files Browse the repository at this point in the history
3.1.10
  • Loading branch information
EstrellaXD authored Oct 14, 2023
2 parents a544ef1 + a81d93f commit 6a8aa0a
Show file tree
Hide file tree
Showing 8 changed files with 249 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ jobs:
run: |
echo ${{ needs.version-info.outputs.version }}
echo "VERSION='${{ needs.version-info.outputs.version }}'" >> module/__version__.py
- name: Copy requirements.txt
working-directory: ./backend
run:
cp requirements.txt src/requirements.txt

- name: Zip app
run: |
Expand All @@ -262,6 +267,7 @@ jobs:
echo "version=🌟${{ needs.version-info.outputs.version }}" >> $GITHUB_OUTPUT
echo "pre_release=false" >> $GITHUB_OUTPUT
fi
- name: Release
id: release
uses: softprops/action-gh-release@v1
Expand Down
10 changes: 10 additions & 0 deletions backend/src/module/api/bangumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ async def refresh_poster():
resp = manager.refresh_poster()
return u_response(resp)

@router.get(
path="/refresh/poster/{bangumi_id}",
response_model=APIResponse,
dependencies=[Depends(get_current_user)],
)
async def refresh_poster(bangumi_id: int):
with TorrentManager() as manager:
resp = manager.refind_poster(bangumi_id)
return u_response(resp)


@router.get(
"/reset/all", response_model=APIResponse, dependencies=[Depends(get_current_user)]
Expand Down
11 changes: 11 additions & 0 deletions backend/src/module/manager/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,17 @@ def refresh_poster(self):
msg_zh="刷新海报链接成功。",
)

def refind_poster(self, bangumi_id: int):
bangumi = self.bangumi.search_id(bangumi_id)
TitleParser().tmdb_poster_parser(bangumi)
self.bangumi.update(bangumi)
return ResponseModel(
status_code=200,
status=True,
msg_en="Refresh poster link successfully.",
msg_zh="刷新海报链接成功。",
)

def search_all_bangumi(self):
datas = self.bangumi.search_all()
if not datas:
Expand Down
2 changes: 1 addition & 1 deletion backend/src/module/parser/analyser/mikan_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def mikan_parser(homepage: str):
official_title = soup.select_one(
'p.bangumi-title a[href^="/Home/Bangumi/"]'
).text
official_title = re.sub(r"第.*季", "", official_title)
official_title = re.sub(r"第.*季", "", official_title).strip()
if poster_div:
poster_path = poster_div.split("url('")[1].split("')")[0]
img = req.get_content(f"https://{root_path}{poster_path}")
Expand Down
72 changes: 38 additions & 34 deletions webui/src/components/ab-edit-rule.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<script lang="ts" setup>
import type { BangumiRule } from '#/bangumi';
import type {BangumiRule} from '#/bangumi';
const emit = defineEmits<{
(e: 'apply', rule: BangumiRule): void;
(e: 'enable', id: number): void;
(
e: 'deleteFile',
type: 'disable' | 'delete',
opts: { id: number; deleteFile: boolean }
e: 'deleteFile',
type: 'disable' | 'delete',
opts: { id: number; deleteFile: boolean }
): void;
}>();
const { t } = useMyI18n();
const {t} = useMyI18n();
const show = defineModel('show', { default: false });
const show = defineModel('show', {default: false});
const rule = defineModel<BangumiRule>('rule', {
required: true,
});
Expand All @@ -31,9 +31,13 @@ watch(show, (val) => {
}
});
function showDeleteFileDialog(type: 'disable' | 'delete') {
function showDeleteFileDialog(type: String) {
deleteFileDialog.show = true;
deleteFileDialog.type = type;
if (type === 'disable' || type === '禁用') {
deleteFileDialog.type = 'disable';
} else {
deleteFileDialog.type = 'delete';
}
}
const close = () => (show.value = false);
Expand All @@ -44,6 +48,7 @@ function emitdeleteFile(deleteFile: boolean) {
deleteFile,
});
}
function emitApply() {
emit('apply', rule.value);
}
Expand Down Expand Up @@ -78,53 +83,52 @@ const boxSize = computed(() => {

<div fx-cer justify-center space-x-10px>
<ab-button size="small" type="warn" @click="() => emitEnable()">{{
$t('homepage.rule.yes_btn')
}}</ab-button>
$t('homepage.rule.yes_btn')
}}
</ab-button>
<ab-button size="small" @click="() => close()">{{
$t('homepage.rule.no_btn')
}}</ab-button>
$t('homepage.rule.no_btn')
}}
</ab-button>
</div>
</div>

<div v-else space-y-12px>
<ab-rule v-model:rule="rule"></ab-rule>

<div fx-cer justify-end space-x-10px>
<ab-button
size="small"
type="warn"
@click="() => showDeleteFileDialog('disable')"
>{{ $t('homepage.rule.disable') }}</ab-button
>
<ab-button
size="small"
type="warn"
@click="() => showDeleteFileDialog('delete')"
>{{ $t('homepage.rule.delete') }}</ab-button
>
<ab-button-multi
size="small"
type="warn"
:selections="[t('homepage.rule.delete'), t('homepage.rule.disable')]"
@click="showDeleteFileDialog"
/>
<ab-button size="small" @click="emitApply">{{
$t('homepage.rule.apply')
}}</ab-button>
$t('homepage.rule.apply')
}}
</ab-button>
</div>
</div>

<ab-popup
v-model:show="deleteFileDialog.show"
:title="$t('homepage.rule.delete')"
v-model:show="deleteFileDialog.show"
:title="$t('homepage.rule.delete')"
>
<div>{{ $t('homepage.rule.delete_hit') }}</div>
<div line my-8px></div>

<div fx-cer justify-center space-x-10px>
<ab-button
size="small"
type="warn"
@click="() => emitdeleteFile(true)"
>{{ $t('homepage.rule.yes_btn') }}</ab-button
size="small"
type="warn"
@click="() => emitdeleteFile(true)"
>{{ $t('homepage.rule.yes_btn') }}
</ab-button
>
<ab-button size="small" @click="() => emitdeleteFile(false)">{{
$t('homepage.rule.no_btn')
}}</ab-button>
$t('homepage.rule.no_btn')
}}
</ab-button>
</div>
</ab-popup>
</ab-popup>
Expand Down
32 changes: 32 additions & 0 deletions webui/src/components/basic/ab-button-multi.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type {Meta, StoryObj} from '@storybook/vue3';

import AbButtonMulti from './ab-button-multi.vue';

const meta: Meta<typeof AbButtonMulti> = {
title: 'basic/ab-button-multi',
component: AbButtonMulti,
tags: ['autodocs'],
argTypes: {
type: {
control: {type: 'select'},
options: ['primary', 'warn'],
},
size: {
control: {type: 'select'},
options: ['big', 'normal', 'small'],
},
},
};

export default meta;
type Story = StoryObj<typeof AbButtonMulti>;

export const Template: Story = {
render: (args) => ({
components: {AbButtonMulti},
setup() {
return {args};
},
template: '<ab-button-multi v-bind="args">button</ab-button-multi>',
}),
};
150 changes: 150 additions & 0 deletions webui/src/components/basic/ab-button-multi.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<script lang="ts" setup xmlns="http://www.w3.org/1999/html">
import {NSpin} from 'naive-ui';
import {Down} from "@icon-park/vue-next";
import {computed} from "vue";
const props = withDefaults(
defineProps<{
type?: 'primary' | 'warn';
size?: 'big' | 'normal' | 'small';
link?: string | null;
loading?: boolean;
selections: string[];
}>(),
{
type: 'primary',
size: 'normal',
link: null,
loading: false,
}
);
defineEmits(['click']);
const selected = ref<string>(
props.selections[0]
);
const showSelections = ref<boolean>(false);
const buttonSize = computed(() => {
switch (props.size) {
case 'big':
return 'rounded-10px text-h1 w-276px h-55px text-h1';
case 'normal':
return 'rounded-6px w-170px h-36px';
case 'small':
return 'rounded-6px w-86px h-28px text-main';
}
});
const selectboxSize = computed(() => {
switch (props.size) {
case 'big':
return 'w-276px rounded-10px text-h1';
case 'normal':
return 'w-170px rounded-6px';
case 'small':
return 'w-86px rounded-6px text-main';
}
});
const loadingSize = computed(() => {
switch (props.size) {
case 'big':
return 'large';
case 'normal':
return 'small';
case 'small':
return 18;
}
});
function onSelect(selection: string) {
selected.value = selection;
showSelections.value = false;
console.log(selected.value);
}
</script>

<template>
<div
:class="buttonSize"
f-cer
overflow-hidden
>
<Component
:is="link !== null ? 'a' : 'button'"
:href="link"
text-white
outline-none
wh-full
pl-12px
:class="[`type-${type}`]"
@click="$emit('click', selected)"
>
<NSpin :show="loading" :size="loadingSize">
<div text-main>{{ selected }}</div>
</NSpin>
</Component>
<div
is-btn
px-12px
h-full
f-cer
:class="[`selector-${type}`]"
@click="() => showSelections = !showSelections"
>
<Down fill="white"/>
</div>
</div>
<div
v-if="showSelections"
abs
z-70
:class="selectboxSize"
overflow-hidden
class="select-box"
>
<div
v-for="selection in selections"
:key="selection"
is-btn
wh-full
f-cer
text-main
py-8px
text-white
:class="[`type-${type}`]"
@click="onSelect(selection)"
>
{{ selection }}
</div>
</div>
</template>

<style lang="scss" scoped>
.type {
&-primary {
@include bg-mouse-event(#4e3c94, #281e52, #8e8a9c);
}
&-warn {
@include bg-mouse-event(#943c61, #521e2a, #9c8a93);
}
}
.selector {
&-primary {
@include bg-mouse-event(#4e3c94, #281e52, #8e8a9c);
}
&-warn {
@include bg-mouse-event(#943c61, #521e2a, #9c8a93);
}
}
.select-box {
transform: TranslateY(80%) TranslateX(-111%);
}
</style>
1 change: 1 addition & 0 deletions webui/types/dts/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare module '@vue/runtime-core' {
AbAddRss: typeof import('./../../src/components/ab-add-rss.vue')['default']
AbBangumiCard: typeof import('./../../src/components/ab-bangumi-card.vue')['default']
AbButton: typeof import('./../../src/components/basic/ab-button.vue')['default']
AbButtonMulti: typeof import('./../../src/components/basic/ab-button-multi.vue')['default']
AbChangeAccount: typeof import('./../../src/components/ab-change-account.vue')['default']
AbCheckbox: typeof import('./../../src/components/basic/ab-checkbox.vue')['default']
AbContainer: typeof import('./../../src/components/ab-container.vue')['default']
Expand Down

0 comments on commit 6a8aa0a

Please sign in to comment.