Skip to content

Commit

Permalink
整理一下,完善文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeroblast committed Jul 6, 2019
1 parent 77c7bd0 commit 85bc551
Show file tree
Hide file tree
Showing 30 changed files with 175 additions and 88 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ temp/
*.epub
*.log
dedrm.bat
Release
.vscode
Released

25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/bin/Debug/netcoreapp2.2/UnpackKindleS.dll",
"args": ["../samples/sample_iruma.azw.res","--just-dump-res"],
"cwd": "${workspaceFolder}/src",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
36 changes: 36 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/src/UnpackKindleS.csproj"
],
"problemMatcher": "$tsc"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/src/UnpackKindleS.csproj"
],
"problemMatcher": "$tsc"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/src/UnpackKindleS.csproj"
],
"problemMatcher": "$tsc"
}
]
}
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# UnpackKindleS
将 XXX_nodrm.azw3(通过DeDRM工具生成) 和 azw.res(Kindle for PC 1.19 or later) 合并为 epub
将 XXX_nodrm.azw3(通过DeDRM工具生成) 和 azw.res(Kindle for PC 1.19 or later) 合并为 epub。推荐使用Kindle for PC 1.19~1.24之间的版本。

## 使用场景
当你需要将azw.res里的高清资源和azw3合并输出到epub中时。也可以单独转换azw3。这个项目还没有支持其他情况
当你需要将azw.res里的高清资源和azw3合并输出到epub中时。也可以单独转换azw3或解体azw.res。这个项目没有支持其他情况

## 使用方法

Expand All @@ -14,9 +14,19 @@

使用Release版**不要**下载源码中的bat。

方式1:将需要转换的azw3和azw.res放在同一目录,任选其一或者将文件夹拖到_Tool_Drop_Single.bat上。输出在同目录下
下载之后,可以在dedrm.bat中配置自己的dedrm路径

方式2:配置好dedrm.bat,将My Kindle Content拖到_Tool_Drop_MyKindleContent.bat上。批量输出在My Kindle Content 里面。
方式1:将azw.res和已经去除DRM的azw3放在同一目录,任选其一或者将文件夹拖到_Tool_Drop_Single.bat上。输出在同目录下。

方式2:配置好dedrm.bat,将My Kindle Content中的文件夹拖到_Tool_Drop_Single_dedrm.bat上。输出在同目录下。

方式3:配置好dedrm.bat,将My Kindle Content拖到_Tool_Drop_MyKindleContent.bat上。批量输出在My Kindle Content 里面。

提取azw.res中的高清插图:将相应的文件拖到_Tool_Drop_Dump_azwres.bat上。输出到一个名字为该资源书籍标题的文件夹中。

补充说明:Kindle for PC默认存放书籍位置:C:\Users\用户名\Documents\My Kindle Content

转换完成后,会在程序目录输出lastrun.log,可以用于检查输出结果。

#### 详细说明
命令行参数格式:
Expand All @@ -28,11 +38,15 @@

`` -batch `` 检测文件夹中含有EBOK的文件夹并处理。用于处理My Kindle Content。

`` --just-dump-res `` 提取高清插图。

可以参考提供的bat

指定输出目录的功能没怎么测试(懒)

### 使用开发版

安装dotnet core,请使用源码中的bat,其他同上。
安装dotnet core,请使用源码中的bat,其他同上。


## 其他说明
Expand All @@ -41,7 +55,7 @@
并且将我之前写的 [UnpackKindleHDRes](https://github.com/Aeroblast/UnpackKindleHDRes) 功能加进去了。
初衷是为了转换日亚的轻小说

由于没有那么多测试,可能有各种各样的问题,会尽力修。
由于没有那么多测试,可能有各种各样的问题,会尽力修,欢迎提供样本

转换完可以看一眼命令行输出或者lastrun.log是不是所有flow和图片Section都被转换了。

2 changes: 1 addition & 1 deletion _Tool_Drop_Dump_azwres.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd /d %~dp0
cd /d %~dp0/src
dotnet run %1 --just-dump-res
pause
2 changes: 1 addition & 1 deletion _Tool_Drop_MyKindleContent-nodrm.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd /d %~dp0
cd /d %~dp0/src
dotnet run %1 -batch
pause
2 changes: 1 addition & 1 deletion _Tool_Drop_MyKindleContent.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd /d %~dp0
cd /d %~dp0/src
dotnet run %1 -dedrm -batch
pause
2 changes: 1 addition & 1 deletion _Tool_Drop_Single.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd /d %~dp0
cd /d %~dp0/src
dotnet run %1
pause
3 changes: 3 additions & 0 deletions _Tool_Drop_Single_dedrm.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd /d %~dp0/src
dotnet run %1 -dedrm
pause
4 changes: 4 additions & 0 deletions clear.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rd /Q /S src\_temp_
rd /Q /S src\obj
rd /Q /S src\bin
pause
2 changes: 1 addition & 1 deletion dedrm.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"C:\Python2\python2.exe" "E:\_Download\DeDRM_tools_6.6.2\DeDRM_Windows_Application\DeDRM_App\DeDRM_lib\DeDRM_App.pyw" %1
"C:\Python2\python2.exe" "D:\Apps\DeDRM_App\DeDRM_lib\DeDRM_App.pyw" %1
27 changes: 19 additions & 8 deletions publish.bat
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
cd /d %~dp0
rd /Q /S bin

cd src
rd /Q /S bin

dotnet publish -c release -r win-x64 --self-contained
rename bin\release\netcoreapp2.2\win-x64\publish lib
move bin\release\netcoreapp2.2\win-x64\lib bin\lib
copy template_cover.txt bin\lib\template_cover.txt
copy template_ncx.txt bin\lib\template_ncx.txt
copy template_opf.txt bin\lib\template_opf.txt
copy template_opf.txt bin\lib\template_opf.txt

md ..\bin
move bin\release\netcoreapp2.2\win-x64\publish ..\bin\lib

md ..\bin\lib\template\
copy template\template_cover.txt ..\bin\lib\template\template_cover.txt
copy template\template_ncx.txt ..\bin\lib\template\template_ncx.txt
copy template\template_opf.txt ..\bin\lib\template\template_opf.txt

rd /Q /S bin
rd /Q /S obj

cd ..
copy dedrm.bat bin\dedrm.bat
copy template_batch\_Tool_Drop_Dump_azwres.txt bin\_Tool_Drop_Dump_azwres.bat
copy template_batch\_Tool_Drop_MyKindleContent.txt bin\_Tool_Drop_MyKindleContent.bat
copy template_batch\_Tool_Drop_MyKindleContent-nodrm.txt bin\_Tool_Drop_MyKindleContent-nodrm.bat
copy template_batch\_Tool_Drop_Single.txt bin\_Tool_Drop_Single.bat
rd /Q /S bin\release
copy template_batch\_Tool_Drop_Single_dedrm.txt bin\_Tool_Drop_Single_dedrm.bat

pause
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions EpubBuilder.cs → src/EpubBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ string ProcCSS(string text)

void CreateNCX()
{
string t = File.ReadAllText("template_ncx.txt");
string t = File.ReadAllText("template\\template_ncx.txt");
string np_temp = "<navPoint id=\"navPoint-{0}\" playOrder=\"{0}\">\n <navLabel><text>{1}</text></navLabel>\n <content src=\"{2}\" />\n</navPoint>\n";
string np = "";
int i = 1;
Expand All @@ -282,7 +282,7 @@ void CreateCover()
if (azw3.mobi_header.first_res_index + off < azw3.section_count)
if (azw3.sections[azw3.mobi_header.first_res_index + off].type == "Image")
{
string t = File.ReadAllText("template_cover.txt");
string t = File.ReadAllText("template\\template_cover.txt");
cover_name = AddImage(off);
cover = t.Replace("{❕image}", cover_name);
xhtml_names.Insert(0, "cover.xhtml");
Expand All @@ -299,7 +299,7 @@ void CreateOPF()
{
if (azw3.resc != null)
{
string t = File.ReadAllText("template_opf.txt");
string t = File.ReadAllText("template\\template_opf.txt");
XmlDocument manifest = new XmlDocument();
XmlElement mani_root = manifest.CreateElement("manifest");
manifest.AppendChild(mani_root);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 85bc551

Please sign in to comment.