feat: filter resources that is qiangban

This commit is contained in:
Simon Ding
2024-08-11 19:18:27 +08:00
parent 0057a75a95
commit 6c26812b92
8 changed files with 93 additions and 21 deletions

View File

@@ -52,13 +52,15 @@ class GeneralSetting {
String? logLevel;
String? proxy;
bool? enablePlexmatch;
bool? allowQiangban;
GeneralSetting(
{this.tmdbApiKey,
this.downloadDIr,
this.logLevel,
this.proxy,
this.enablePlexmatch});
this.enablePlexmatch,
this.allowQiangban});
factory GeneralSetting.fromJson(Map<String, dynamic> json) {
return GeneralSetting(
@@ -66,6 +68,7 @@ class GeneralSetting {
downloadDIr: json["download_dir"],
logLevel: json["log_level"],
proxy: json["proxy"],
allowQiangban: json["allow_qiangban"] ?? false,
enablePlexmatch: json["enable_plexmatch"] ?? false);
}
@@ -76,6 +79,7 @@ class GeneralSetting {
data["log_level"] = logLevel;
data["proxy"] = proxy;
data["enable_plexmatch"] = enablePlexmatch;
data["allow_qiangban"] = allowQiangban;
return data;
}
}
@@ -134,7 +138,14 @@ class Indexer {
double? seedRatio;
bool? disabled;
Indexer({this.name, this.url, this.apiKey, this.id, this.priority=50, this.seedRatio=0, this.disabled});
Indexer(
{this.name,
this.url,
this.apiKey,
this.id,
this.priority = 50,
this.seedRatio = 0,
this.disabled});
Indexer.fromJson(Map<String, dynamic> json) {
name = json['name'];
@@ -142,7 +153,7 @@ class Indexer {
apiKey = json['api_key'];
id = json["id"];
priority = json["priority"];
seedRatio = json["seed_ratio"]??0;
seedRatio = json["seed_ratio"] ?? 0;
disabled = json["disabled"] ?? false;
}
Map<String, dynamic> toJson() {

View File

@@ -34,7 +34,8 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
"download_dir": v.downloadDIr,
"log_level": v.logLevel,
"proxy": v.proxy,
"enable_plexmatch": v.enablePlexmatch
"enable_plexmatch": v.enablePlexmatch,
"allow_qiangban": v.allowQiangban,
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -81,8 +82,19 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
),
SizedBox(
width: 300,
child: FormBuilderSwitch(decoration: const InputDecoration(icon: Icon(Icons.token)),
name: "enable_plexmatch", title: const Text("Plex 刮削支持")),
child: FormBuilderSwitch(
decoration:
const InputDecoration(icon: Icon(Icons.token)),
name: "enable_plexmatch",
title: const Text("Plex 刮削支持")),
),
SizedBox(
width: 300,
child: FormBuilderSwitch(
decoration:
const InputDecoration(icon: Icon(Icons.token)),
name: "allow_qiangban",
title: const Text("是否下载枪版资源")),
),
Center(
child: Padding(
@@ -102,6 +114,7 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
downloadDIr: values["download_dir"],
logLevel: values["log_level"],
proxy: values["proxy"],
allowQiangban: values["allow_qiangban"],
enablePlexmatch:
values["enable_plexmatch"]))
.then((v) => showSnakeBar("更新成功"));