Skip to content

Commit

Permalink
bug fix & improve
Browse files Browse the repository at this point in the history
.Net Core 3.0
修正一些命令解析错误
新写了一个bat
  • Loading branch information
AeroNovel authored and AeroNovel committed Oct 19, 2019
1 parent 4e78530 commit 48a0873
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 105 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ temp/
*.log
dedrm.bat
Released
.vscode
_temp_

25 changes: 0 additions & 25 deletions .vscode/launch.json

This file was deleted.

36 changes: 0 additions & 36 deletions .vscode/tasks.json

This file was deleted.

12 changes: 3 additions & 9 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ azw3将包含书籍的主要信息,包括正文和图片,主流的工具都
電撃文庫 | KADOKAWA | 长1600(2016.6)/长2048(2016.12-最新)
メディアワークス文庫 | KADOKAWA | 长1600(-2015.9)/长2048(2016.10-最新)
富士见L文庫 | KADOKAWA | 1600(2016.12)
富士見ファンタジア文庫 | KADOKAWA | 高1600(-2018.3)
富士見ファンタジア文庫 | KADOKAWA | 高1600(-2018.3)/长2048(最新)
MF文庫J | KADOKAWA | 高1600(2012.2-2018.2)/长2048(最新)
角川文庫 | KADOKAWA | 1600(2016.5)/长2048(最新)
角川スニーカー文庫 | KADOKAWA | 长2048(最新)
Expand All @@ -33,15 +33,9 @@ TOブックス | TOブックス | 长1600(最新)

以下教程根据Windows编写,Mac用户请自求多福(理论上可以搞……)

**批量转换:** 对于批量一键转换,由于Calibre没有一个插件能处理多个文件输入,因此使用独立的脚本,即DeDRM_tools的Release中的DeDRM_Windows_Application
**批量转换:** 对于批量一键转换,由于Calibre没有一个插件能处理多个文件输入,因此使用独立的版本

根据DeDRM文档和实际试验,需要安装:
+ ActivePython 2.7,运行环境。[【官方下载(居然还得注册)】](http://www.activestate.com/activepython/downloads) [【百度网盘(随便找的)】](https://pan.baidu.com/s/1jGBo9QA)
+ Visual C++ Compiler for Python 2.7 ,安装PyCryoto可能需要,[【官方下载】](https://www.microsoft.com/en-us/download/details.aspx?id=44266)
+ PyCrypto,需要的模块,[【官方下载】](http://www.voidspace.org.uk/python/modules.shtml#pycrypto)
+ 通过pip安装pylzma ,例:```pip2 install pylzma```

确保安装的如上模块,可以正常使用DeDRM_App,则可以按照自己的安装路径修改dedrm.bat。
由于官方版DeDRM_Tools应对了其他加密,而这里只处理AZW3,因此可以使用这个[精简版](https://github.com/Aeroblast/AZW3_PC_DeDRM/releases)

例子:
```"C:\Python2\python2.exe" "D:\Apps\DeDRM_App\DeDRM_lib\DeDRM_App.pyw" %1```
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Release版可执行文件为Windows 64bit,不需要安装任何依赖。[【

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

+ 方式3:配置好dedrm.bat,```My Kindle Content```拖到```_Tool_Drop_MyKindleContent.bat```上。批量输出在My Kindle Content 里面
+ 方式3:配置好dedrm.bat,直接运行```_Tool_Proc_MyKindleContent.bat```,自动处理书库所有书,输出在bat同一目录下

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

Expand All @@ -42,9 +42,9 @@ Release版可执行文件为Windows 64bit,不需要安装任何依赖。[【

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

可以参考提供的bat
可以参考提供的bat

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

### 使用开发版

Expand Down
2 changes: 1 addition & 1 deletion dedrm.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"C:\Python2\python2.exe" "D:\Apps\DeDRM_App\DeDRM_lib\DeDRM_App.pyw" %1
"D:\Apps\AZW3_PC_DeDRM\AZW3_PC_DeDRM.exe" %1
4 changes: 2 additions & 2 deletions publish.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rd /Q /S bin
dotnet publish -c release -r win-x64 --self-contained

md ..\bin
move bin\release\netcoreapp2.2\win-x64\publish ..\bin\app
move bin\release\netcoreapp3.0\win-x64\publish ..\bin\app

md ..\bin\app\template\
copy template\template_cover.txt ..\bin\app\template\template_cover.txt
Expand All @@ -20,7 +20,7 @@ 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_Proc_MyKindleContent.txt bin\_Tool_Proc_MyKindleContent.bat
copy template_batch\_Tool_Drop_Single.txt bin\_Tool_Drop_Single.bat
copy template_batch\_Tool_Drop_Single_dedrm.txt bin\_Tool_Drop_Single_dedrm.bat

Expand Down
77 changes: 50 additions & 27 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ static void Main(string[] args)
{
append_log = true;
}
if(a.ToLower()=="--overwrite")
if (a.ToLower() == "--overwrite")
{
overwrite=true;
overwrite = true;
}
if(a.ToLower()=="--rename-when-exist")
if (a.ToLower() == "--rename-when-exist")
{
rename_when_exist=true;
rename_when_exist = true;
}
}
if (!end_of_proc)
Expand All @@ -74,6 +74,7 @@ static void Main(string[] args)
}
static void ProcBatch(string[] args)
{
Log.log("Batch Process:"+args[0]);
string[] dirs = Directory.GetDirectories(args[0]);
foreach (string s in dirs)
{
Expand Down Expand Up @@ -121,35 +122,57 @@ static void ProcPath(string[] args)
}
}
}
else if (Path.GetExtension(p).ToLower() == ".azw3")
else
{
azw3_path = p;
dir = Path.GetDirectoryName(p);
string[] files = Directory.GetFiles(dir);
foreach (string n in files)
if (dedrm && Path.GetExtension(p).ToLower() == ".azw")
{
if (Path.GetExtension(n) == ".res")
DeDRM(p);
dir = Path.GetDirectoryName(p);
string[] files = Directory.GetFiles(dir);
foreach (string n in files)
{
azw6_path = n;
break;
if (Path.GetExtension(n) == ".res")
{
azw6_path = n;
}
if (Path.GetExtension(n).ToLower() == ".azw3")
{
azw3_path = n;
}
}
}
}
else if (Path.GetExtension(p).ToLower() == ".res")
{
azw6_path = p;
dir = Path.GetDirectoryName(p);
string[] files = Directory.GetFiles(dir);
foreach (string n in files)
else
if (Path.GetExtension(p).ToLower() == ".azw3")
{
if (Path.GetExtension(n).ToLower() == ".azw3")
azw3_path = p;
dir = Path.GetDirectoryName(p);
string[] files = Directory.GetFiles(dir);
foreach (string n in files)
{
azw3_path = n;
break;
if (Path.GetExtension(n) == ".res")
{
azw6_path = n;
break;
}
}
}
else if (Path.GetExtension(p).ToLower() == ".res")
{
azw6_path = p;
dir = Path.GetDirectoryName(p);
string[] files = Directory.GetFiles(dir);
foreach (string n in files)
{
if (Path.GetExtension(n).ToLower() == ".azw3")
{
azw3_path = n;
break;
}
}
}
}


Azw3File azw3 = null;
Azw6File azw6 = null;
if (azw3_path != null)
Expand All @@ -169,11 +192,11 @@ static void ProcPath(string[] args)
epub.Save(temp_path);
Log.log(azw3);
string output_path;
if (args.Length >= 2)
if (Directory.Exists(args[1]))
{
output_path = Path.Combine(args[1], outname);
}
if (args.Length >= 2 && Directory.Exists(args[1]))
{
output_path = Path.Combine(args[1], outname);
}
else
{
string outdir = Path.GetDirectoryName(args[0]);
output_path = Path.Combine(outdir, outname);
Expand Down
2 changes: 1 addition & 1 deletion src/UnpackKindleS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/version.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UnpackKindleS
{
public class Version{public static string version="20190905";}
public class Version{public static string version="20191019";}
}
3 changes: 3 additions & 0 deletions template_batch/_Tool_Proc_MyKindleContent.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd /d %~dp0\app
UnpackKindleS "%USERPROFILE%\Documents\My Kindle Content" %~dp0 -dedrm -batch
pause

0 comments on commit 48a0873

Please sign in to comment.