基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。
test webdav before collect bangumi sync && more comments
Predidit3f979b7f82a2
diff --git a/lib/modules/collect/collect_change_module.dart b/lib/modules/collect/collect_change_module.dartindex d28f9cf9..87c72d1b 100644--- a/lib/modules/collect/collect_change_module.dart+++ b/lib/modules/collect/collect_change_module.dart@@ -2,9 +2,13 @@ import 'package:hive/hive.dart';part 'collect_change_module.g.dart';+// The box stores the changes history of collected bangumi+// The changes will be used to sync with webDav@HiveType(typeId: 5)class CollectedBangumiChange {// timestamp in seconds+ // hivebox has limited the length of key, the max number is 4294967295+ // we have to use timestamp in seconds as key to avoid key conflict and hive key limit@HiveField(0)int id;diff --git a/lib/pages/collect/collect_controller.dart b/lib/pages/collect/collect_controller.dartindex de3f45e5..1c442657 100644--- a/lib/pages/collect/collect_controller.dart+++ b/lib/pages/collect/collect_controller.dart@@ -90,6 +90,17 @@ abstract class _CollectController with Store {KazumiDialog.showToast(message: '未开启WebDav同步或配置无效');return;}+ bool flag = true;+ try {+ await WebDav().ping();+ } catch (e) {+ KazumiLogger().log(Level.error, 'WebDav连接失败: $e');+ KazumiDialog.showToast(message: 'WebDav连接失败: $e');+ flag = false;+ }+ if (!flag) {+ return;+ }await WebDav().syncCollectibles();loadCollectibles();}diff --git a/lib/pages/collect/collect_page.dart b/lib/pages/collect/collect_page.dartindex 5722c071..3bd6ead7 100644--- a/lib/pages/collect/collect_page.dart+++ b/lib/pages/collect/collect_page.dart@@ -79,33 +79,6 @@ class _CollectPageState extends State<CollectPage>),title: const Text('追番'),actions: [- IconButton(- onPressed: () async {- bool webDavenable = await setting.get(- SettingBoxKey.webDavEnable,- defaultValue: false);- if (!webDavenable) {- KazumiDialog.showToast(message: 'webDav未启用, 同步功能不可用');- return;- }- if (showDelete) {- KazumiDialog.showToast(message: '编辑模式无法执行同步');- return;- }- if (syncCollectiblesing) {- return;- }- setState(() {- syncCollectiblesing = true;- });- await collectController.syncCollectibles();- setState(() {- syncCollectiblesing = false;- });- },- icon: syncCollectiblesing- ? const CircularProgressIndicator()- : const Icon(Icons.sync)),IconButton(onPressed: () {setState(() {@@ -117,6 +90,34 @@ class _CollectPageState extends State<CollectPage>: const Icon(Icons.edit))],),+ floatingActionButton: FloatingActionButton(+ onPressed: () async {+ bool webDavenable = await setting.get(SettingBoxKey.webDavEnable,+ defaultValue: false);+ if (!webDavenable) {+ KazumiDialog.showToast(message: 'webDav未启用, 同步功能不可用');+ return;+ }+ if (showDelete) {+ KazumiDialog.showToast(message: '编辑模式无法执行同步');+ return;+ }+ if (syncCollectiblesing) {+ return;+ }+ setState(() {+ syncCollectiblesing = true;+ });+ await collectController.syncCollectibles();+ setState(() {+ syncCollectiblesing = false;+ });+ },+ child: syncCollectiblesing+ ? const SizedBox(+ width: 24, height: 24, child: CircularProgressIndicator())+ : const Icon(Icons.cloud_sync),+ ),body: Padding(padding: const EdgeInsets.only(left: 8, right: 8, top: 8),child: Observer(builder: (context) {diff --git a/lib/pages/webdav_editor/webdav_setting.dart b/lib/pages/webdav_editor/webdav_setting.dartindex 8446621e..790efd4b 100644--- a/lib/pages/webdav_editor/webdav_setting.dart+++ b/lib/pages/webdav_editor/webdav_setting.dart@@ -17,7 +17,6 @@ class WebDavSettingsPage extends StatefulWidget {class _PlayerSettingsPageState extends State<WebDavSettingsPage> {Box setting = GStorage.setting;late bool webDavEnable;- late bool webDavEnableCollect;late bool webDavEnableHistory;late bool enableGitProxy;@@ -25,7 +24,6 @@ class _PlayerSettingsPageState extends State<WebDavSettingsPage> {void initState() {super.initState();webDavEnable = setting.get(SettingBoxKey.webDavEnable, defaultValue: false);- webDavEnableCollect = setting.get(SettingBoxKey.webDavEnableCollect, defaultValue: false);webDavEnableHistory = setting.get(SettingBoxKey.webDavEnableHistory, defaultValue: false);enableGitProxy = setting.get(SettingBoxKey.enableGitProxy, defaultValue: false);}@@ -124,26 +122,15 @@ class _PlayerSettingsPageState extends State<WebDavSettingsPage> {SettingsTile.switchTile(onToggle: (value) async {webDavEnable = value ?? !webDavEnable;+ if (!WebDav().initialized && webDavEnable) {+ WebDav().init();+ }await setting.put(SettingBoxKey.webDavEnable, webDavEnable);setState(() {});},title: const Text('WEBDAV同步'),initialValue: webDavEnable,),- SettingsTile.switchTile(- onToggle: (value) async {- if (!webDavEnable) {- KazumiDialog.showToast(message: '请先开启WEBDAV同步');- return;- }- webDavEnableCollect = value ?? !webDavEnableCollect;- await setting.put(SettingBoxKey.webDavEnableCollect, webDavEnableCollect);- setState(() {});- },- title: const Text('追番同步'),- description: const Text('允许手动同步追番列表'),- initialValue: webDavEnableCollect,- ),SettingsTile.switchTile(onToggle: (value) async {if (!webDavEnable) {