mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-02 20:26:36 +08:00
fix: add smart download classification
This commit is contained in:
@@ -13,6 +13,9 @@ export interface AddDownloadInput {
|
||||
poster_url?: string
|
||||
backdrop_url?: string
|
||||
overview?: string
|
||||
media_type?: string
|
||||
media_category?: string
|
||||
source_category?: string
|
||||
}
|
||||
|
||||
export const downloadsAPI = {
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface SiteSearchResult {
|
||||
title: string
|
||||
torrent_url: string
|
||||
download_url: string
|
||||
category?: string
|
||||
size: number
|
||||
seeders: number
|
||||
leechers: number
|
||||
|
||||
@@ -152,11 +152,18 @@ const GROUPS: SettingGroup[] = [
|
||||
label: '入库时自动整理',
|
||||
type: 'toggle',
|
||||
},
|
||||
{
|
||||
key: 'downloads.smart_classify',
|
||||
label: '下载器智能分类',
|
||||
type: 'toggle',
|
||||
hint: '订阅下载和站点搜索下载未指定保存路径时,自动按媒体类型/分类写入 qB 保存目录与 qB 分类(如:/downloads/国产剧、/downloads/综艺)。',
|
||||
defaultValue: 'true',
|
||||
},
|
||||
{
|
||||
key: 'organizer.smart_classify',
|
||||
label: '启用智能分类',
|
||||
type: 'toggle',
|
||||
hint: '根据元数据(语言/国家/类型)自动分类到子目录(如:华语电影、欧美剧、日番)',
|
||||
hint: '整理/入库时根据元数据(语言/国家/类型)自动分类到媒体库子目录(如:华语电影、欧美剧、日番)',
|
||||
},
|
||||
{
|
||||
key: 'organize.source_dir',
|
||||
|
||||
@@ -53,7 +53,10 @@ export function SiteSearchPage() {
|
||||
return
|
||||
}
|
||||
try {
|
||||
await downloadsAPI.add(url, '', { title: item.title })
|
||||
await downloadsAPI.add(url, '', {
|
||||
title: item.title,
|
||||
source_category: item.category,
|
||||
})
|
||||
toast.success(`已加入下载: ${item.title.substring(0, 40)}...`)
|
||||
} catch (err: unknown) {
|
||||
const msg =
|
||||
|
||||
@@ -71,6 +71,7 @@ function OrganizePanel() {
|
||||
const [savingDefaults, setSavingDefaults] = useState(false)
|
||||
const ORGANIZE_KEYS = [
|
||||
'organizer.auto_after_download',
|
||||
'downloads.smart_classify',
|
||||
'organizer.smart_classify',
|
||||
'organize.source_dir',
|
||||
'organize.target_dir',
|
||||
@@ -332,6 +333,14 @@ function OrganizePanel() {
|
||||
/>
|
||||
入库时自动整理
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-xs text-ink-600">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={!defaults['downloads.smart_classify'] || isOn(defaults['downloads.smart_classify'])}
|
||||
onChange={(e) => setDefault('downloads.smart_classify', e.target.checked ? 'true' : 'false')}
|
||||
/>
|
||||
下载器智能分类
|
||||
</label>
|
||||
<label className="flex items-center gap-2 text-xs text-ink-600">
|
||||
<input
|
||||
type="checkbox"
|
||||
|
||||
Reference in New Issue
Block a user