mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix #92
This commit is contained in:
@@ -255,7 +255,10 @@
|
|||||||
"Click favorite": "点击收藏",
|
"Click favorite": "点击收藏",
|
||||||
"End": "末尾",
|
"End": "末尾",
|
||||||
"None": "无",
|
"None": "无",
|
||||||
"View Detail": "查看详情"
|
"View Detail": "查看详情",
|
||||||
|
"Select a directory which contains multiple cbz/zip files." : "选择一个包含多个cbz/zip文件的目录",
|
||||||
|
"Multiple cbz files" : "多个cbz文件",
|
||||||
|
"No valid comics found" : "未找到有效的漫画"
|
||||||
},
|
},
|
||||||
"zh_TW": {
|
"zh_TW": {
|
||||||
"Home": "首頁",
|
"Home": "首頁",
|
||||||
@@ -513,6 +516,9 @@
|
|||||||
"Click favorite": "點擊收藏",
|
"Click favorite": "點擊收藏",
|
||||||
"End": "末尾",
|
"End": "末尾",
|
||||||
"None": "無",
|
"None": "無",
|
||||||
"View Detail": "查看詳情"
|
"View Detail": "查看詳情",
|
||||||
|
"Select a directory which contains multiple cbz/zip files." : "選擇一個包含多個cbz/zip文件的目錄",
|
||||||
|
"Multiple cbz files" : "多個cbz文件",
|
||||||
|
"No valid comics found" : "未找到有效的漫畫"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -495,12 +495,14 @@ class _ImportComicsWidgetState extends State<_ImportComicsWidget> {
|
|||||||
"Select a directory which contains the comic files.".tl,
|
"Select a directory which contains the comic files.".tl,
|
||||||
"Select a directory which contains the comic directories.".tl,
|
"Select a directory which contains the comic directories.".tl,
|
||||||
"Select a cbz/zip file.".tl,
|
"Select a cbz/zip file.".tl,
|
||||||
|
"Select a directory which contains multiple cbz/zip files.".tl,
|
||||||
"Select an EhViewer database and a download folder.".tl
|
"Select an EhViewer database and a download folder.".tl
|
||||||
][type];
|
][type];
|
||||||
List<String> importMethods = [
|
List<String> importMethods = [
|
||||||
"Single Comic".tl,
|
"Single Comic".tl,
|
||||||
"Multiple Comics".tl,
|
"Multiple Comics".tl,
|
||||||
"A cbz file".tl,
|
"A cbz file".tl,
|
||||||
|
"Multiple cbz files".tl,
|
||||||
"EhViewer downloads".tl
|
"EhViewer downloads".tl
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -628,7 +630,8 @@ class _ImportComicsWidgetState extends State<_ImportComicsWidget> {
|
|||||||
0 => await importer.directory(true),
|
0 => await importer.directory(true),
|
||||||
1 => await importer.directory(false),
|
1 => await importer.directory(false),
|
||||||
2 => await importer.cbz(),
|
2 => await importer.cbz(),
|
||||||
3 => await importer.ehViewer(),
|
3 => await importer.multipleCbz(),
|
||||||
|
4 => await importer.ehViewer(),
|
||||||
int() => true,
|
int() => true,
|
||||||
};
|
};
|
||||||
if(result) {
|
if(result) {
|
||||||
|
@@ -37,6 +37,33 @@ class ImportComic {
|
|||||||
return registerComics(imported, false);
|
return registerComics(imported, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> multipleCbz() async {
|
||||||
|
var picker = DirectoryPicker();
|
||||||
|
var dir = await picker.pickDirectory();
|
||||||
|
if (dir != null) {
|
||||||
|
var files = (await dir.list().toList()).whereType<File>().toList();
|
||||||
|
files.removeWhere((e) => e.extension != 'cbz' && e.extension != 'zip');
|
||||||
|
Map<String?, List<LocalComic>> imported = {};
|
||||||
|
var controller = showLoadingDialog(App.rootContext, allowCancel: false);
|
||||||
|
var comics = <LocalComic>[];
|
||||||
|
for (var file in files) {
|
||||||
|
try {
|
||||||
|
var comic = await CBZ.import(file);
|
||||||
|
comics.add(comic);
|
||||||
|
} catch (e, s) {
|
||||||
|
Log.error("Import Comic", e.toString(), s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (comics.isEmpty) {
|
||||||
|
App.rootContext.showMessage(message: "No valid comics found".tl);
|
||||||
|
}
|
||||||
|
imported[selectedFolder] = comics;
|
||||||
|
controller.close();
|
||||||
|
return registerComics(imported, false);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> ehViewer() async {
|
Future<bool> ehViewer() async {
|
||||||
var dbFile = await selectFile(ext: ['db']);
|
var dbFile = await selectFile(ext: ['db']);
|
||||||
final picker = DirectoryPicker();
|
final picker = DirectoryPicker();
|
||||||
|
@@ -72,6 +72,7 @@ extension FileSystemEntityExt on FileSystemEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension FileExtension on File {
|
extension FileExtension on File {
|
||||||
|
/// Get the file extension, not including the dot.
|
||||||
String get extension => path.split('.').last;
|
String get extension => path.split('.').last;
|
||||||
|
|
||||||
/// Copy the file to the specified path using memory.
|
/// Copy the file to the specified path using memory.
|
||||||
|
Reference in New Issue
Block a user