✨ Export comics to cbzs.zip
This commit is contained in:
parent
60beaba9ad
commit
3d3f452c40
|
@ -1,2 +1,3 @@
|
|||
v1.7.6
|
||||
- [x] ♻️ 优化发电
|
||||
- [x] ✨ 导出多个cbz的zip
|
||||
|
|
|
@ -641,6 +641,15 @@ class Method {
|
|||
});
|
||||
}
|
||||
|
||||
/// 导出下载的漫画到cbzs.zip
|
||||
Future<dynamic> exportComicDownloadToCbzsZip(String comicId, String dir, String name) {
|
||||
return _flatInvoke("exportComicDownloadToCbzsZip", {
|
||||
"comicId": comicId,
|
||||
"dir": dir,
|
||||
"name": name,
|
||||
});
|
||||
}
|
||||
|
||||
/// 导入文件夹所有的文件
|
||||
Future<dynamic> importComicDownloadDir(
|
||||
String dir,
|
||||
|
|
|
@ -116,6 +116,8 @@ class _DownloadExportToFileScreenState
|
|||
Container(height: 10),
|
||||
_exportToHtmlJPEGNotDownOverButton(),
|
||||
Container(height: 10),
|
||||
_exportComicDownloadToCbzsZipButton(),
|
||||
Container(height: 10),
|
||||
MaterialButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).push(
|
||||
|
@ -446,6 +448,59 @@ class _DownloadExportToFileScreenState
|
|||
);
|
||||
}
|
||||
|
||||
Widget _exportComicDownloadToCbzsZipButton() {
|
||||
return MaterialButton(
|
||||
onPressed: () async {
|
||||
if (!isPro) {
|
||||
defaultToast(context, "请先发电鸭");
|
||||
return;
|
||||
}
|
||||
var name = "";
|
||||
if (currentExportRename()) {
|
||||
var rename = await inputString(
|
||||
context,
|
||||
"请输入保存后的名称",
|
||||
defaultValue: _task.title,
|
||||
);
|
||||
if (rename != null && rename.isNotEmpty) {
|
||||
name = rename;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!await confirmDialog(
|
||||
context, "导出确认", "将您所选的漫画导出cbk.zip${showExportPath()}")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
try {
|
||||
setState(() {
|
||||
exporting = true;
|
||||
});
|
||||
await method.exportComicDownloadToCbzsZip(
|
||||
widget.comicId,
|
||||
await attachExportPath(),
|
||||
name,
|
||||
);
|
||||
setState(() {
|
||||
exportResult = "导出成功";
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
exportResult = "导出失败 $e";
|
||||
});
|
||||
} finally {
|
||||
setState(() {
|
||||
exporting = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: _buildButtonInner(
|
||||
'导出阅读器用cbk.zip\n(暂时不能导入)' + (!isPro ? "\n(发电后使用)" : ""),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildButtonInner(String text) {
|
||||
return LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
|
|
|
@ -91,6 +91,13 @@ class _DownloadExportingGroupScreenState
|
|||
),
|
||||
),
|
||||
Container(height: 20),
|
||||
MaterialButton(
|
||||
onPressed: _exportComicDownloadToCbzsZip,
|
||||
child: _buildButtonInner(
|
||||
"每部漫画都导出成cbz.zip" + (!isPro ? "\n(发电后使用)" : ""),
|
||||
),
|
||||
),
|
||||
Container(height: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -250,6 +257,38 @@ class _DownloadExportingGroupScreenState
|
|||
}
|
||||
}
|
||||
|
||||
_exportComicDownloadToCbzsZip() async {
|
||||
if (!isPro) {
|
||||
defaultToast(context, "请先发电鸭");
|
||||
return;
|
||||
}
|
||||
if (!await confirmDialog(
|
||||
context, "导出确认", "将您所选的漫画分别导出cbz.zip${showExportPath()}")) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setState(() {
|
||||
exporting = true;
|
||||
});
|
||||
final path = await attachExportPath();
|
||||
for (var id in widget.idList) {
|
||||
await method.exportComicDownloadToCbzsZip(
|
||||
id,
|
||||
path,
|
||||
"",
|
||||
);
|
||||
}
|
||||
exported = true;
|
||||
} catch (err) {
|
||||
e = err;
|
||||
exportFail = true;
|
||||
} finally {
|
||||
setState(() {
|
||||
exporting = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
|
|
|
@ -71,6 +71,8 @@ class _ProScreenState extends State<ProScreen> {
|
|||
"去\"关于\"界面找到维护地址可获得发电指引\n"
|
||||
"\n \"我曾经发过电\"可同步相应发电状态"
|
||||
"\n \"我刚才发了电\"兑换神秘代码"
|
||||
"\n \"发电方式\"可以在网络不通时尝试更换"
|
||||
"\n \"PAT入会\"是独立的发电方式"
|
||||
"\n\n发电小功能: 多线程下载 / 批量导入导出下载",
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue