Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d0aa17b2e | ||
|
|
b17b913839 | ||
|
|
d73cd15090 | ||
|
|
e4f44604d7 | ||
|
|
6ab4f633f1 | ||
|
|
feae07c502 | ||
|
|
c8aaabcbca | ||
|
|
588d06e846 | ||
|
|
ca4bab45ec | ||
|
|
3f21bd9f5a | ||
|
|
454286b08b | ||
|
|
63c8b28efd | ||
|
|
9b001bfaf3 | ||
|
|
a76adf0ee1 | ||
|
|
49b064efa4 | ||
|
|
8f23bf2b30 | ||
|
|
1a38cdaf21 | ||
|
|
c20089676d | ||
|
|
f688bee0aa | ||
|
|
114c4988c0 | ||
|
|
0b206e3fc5 | ||
|
|
ed306a8488 | ||
|
|
34b533363a | ||
|
|
b1d13f2b23 | ||
|
|
613450f84d | ||
|
|
20d445acb7 |
47
CALIBRE_CLI_INSTRUCTIONS.md
Normal file
47
CALIBRE_CLI_INSTRUCTIONS.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Using the DeDRM plugin with the Calibre command line interface
|
||||||
|
|
||||||
|
If you prefer the Calibre CLI instead of the GUI, follow this guide to
|
||||||
|
install and use the DeDRM plugin.
|
||||||
|
|
||||||
|
This guide assumes you are on Linux, but it may very well work on other
|
||||||
|
platforms.
|
||||||
|
|
||||||
|
## Step-by-step Tutorial
|
||||||
|
|
||||||
|
#### Install Calibre
|
||||||
|
- Follow [Calibre's installation instructions](https://calibre-ebook.com/download_linux)
|
||||||
|
|
||||||
|
#### Install plugins
|
||||||
|
- Download the DeDRM `.zip` archive from DeDRM_tools'
|
||||||
|
[latest release](https://github.com/apprenticeharper/DeDRM_tools/releases/latest).
|
||||||
|
Then unzip it.
|
||||||
|
- Add the DeDRM plugin to Calibre:
|
||||||
|
```
|
||||||
|
cd *the unzipped DeDRM_tools folder*
|
||||||
|
calibre-customize --add DeDRM_calibre_plugin/DeDRM_plugin.zip
|
||||||
|
```
|
||||||
|
- Add the Obok plugin:
|
||||||
|
```
|
||||||
|
calibre-customize --add Obok_calibre_plugin/obok_plugin.zip
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Enter your keys
|
||||||
|
- Figure out what format DeDRM wants your key in by looking in
|
||||||
|
[the code that handles that](src/prefs.py).
|
||||||
|
- For Kindle eInk devices, DeDRM expects you to put a list of serial
|
||||||
|
numbers in the `serials` field: `"serials": ["012345689abcdef"]` or
|
||||||
|
`"serials": ["1111111111111111", "2222222222222222"]`.
|
||||||
|
- Now add your keys to `$CALIBRE_CONFIG_DIRECTORY/plugins/dedrm.json`.
|
||||||
|
|
||||||
|
#### Import your books
|
||||||
|
- Make a library folder
|
||||||
|
```
|
||||||
|
mkdir library
|
||||||
|
```
|
||||||
|
- Add your book(s) with this command:
|
||||||
|
```
|
||||||
|
calibredb add /path/to/book.format --with-library=library
|
||||||
|
```
|
||||||
|
|
||||||
|
The DRM should be removed from your book, which you can find in the `library`
|
||||||
|
folder.
|
||||||
24
FAQs.md
24
FAQs.md
@@ -15,11 +15,12 @@ Just download and use these tools, that's all! Uh, almost. There are a few, uh,
|
|||||||
* You must own the ebook - the tools won't work on library ebooks or rented ebooks or books from a friend.
|
* You must own the ebook - the tools won't work on library ebooks or rented ebooks or books from a friend.
|
||||||
* You must not use these tools to give your ebooks to a hundred of your closest friends. Or to a million strangers. Authors need to sell books to be able to write more books. Don't be mean to the authors.
|
* You must not use these tools to give your ebooks to a hundred of your closest friends. Or to a million strangers. Authors need to sell books to be able to write more books. Don't be mean to the authors.
|
||||||
* Do NOT use Adobe Digital Editions 3.0 or later to download your ePubs. ADE 3.0 and later might use a new encryption scheme that the tools can't handle. While major ebook stores aren't using the new scheme yet, using ADE 2.0.1 will ensure that your ebooks are downloaded using the old scheme. Once a book has been downloaded with the new scheme, it's IMPOSSIBLE to re-download using the old scheme (without buying it again).
|
* Do NOT use Adobe Digital Editions 3.0 or later to download your ePubs. ADE 3.0 and later might use a new encryption scheme that the tools can't handle. While major ebook stores aren't using the new scheme yet, using ADE 2.0.1 will ensure that your ebooks are downloaded using the old scheme. Once a book has been downloaded with the new scheme, it's IMPOSSIBLE to re-download using the old scheme (without buying it again).
|
||||||
|
* Do NOT use Kindle for PC/Mac version 1.25 or later. The tools don't current work with those versions.
|
||||||
|
|
||||||
But otherwise, if your ebook is from Amazon, Kobo, Barnes & Noble or any of the ebook stores selling ebooks compatible with Adobe Digital Editions 2.0.1, you should be able to remove the DRM that's been applied to your ebooks.
|
But otherwise, if your ebook is from Amazon, Kobo, Barnes & Noble or any of the ebook stores selling ebooks compatible with Adobe Digital Editions 2.0.1, you should be able to remove the DRM that's been applied to your ebooks.
|
||||||
|
|
||||||
### A Recent Change to Kindle for PC/Kindle for Mac
|
### A Recent Change to Kindle for PC/Kindle for Mac
|
||||||
Starting with version 1.19, Kindle for PC/Mac uses Amazon's new KFX format which these tools can't handle. There are two options to get the older formats that the tools can decrypt. Either stick with version 1.17 or earlier, or modify the executable by changing a file name.
|
Starting with version 1.19, Kindle for PC/Mac uses Amazon's new KFX format which isn't quite as good a source fro conversion to ePub as the older KF8 (& MOBI) formats. There are two options to get the older formats. Either stick with version 1.17 or earlier, or modify the executable by changing a file name. Note that with Kindle for PC/Mac 1.25 and later, there is no current solution even for FKX. You must use 1.24 or earlier.
|
||||||
|
|
||||||
Version 1.17 of Kindle is are no longer available directly from Amazon, so you will need to search for the proper file name and find it on a third party site. The name is "KindleForPC-installer-1.17.44170.exe" for PC and "KindleForMac-44182.dmg" for Mac.
|
Version 1.17 of Kindle is are no longer available directly from Amazon, so you will need to search for the proper file name and find it on a third party site. The name is "KindleForPC-installer-1.17.44170.exe" for PC and "KindleForMac-44182.dmg" for Mac.
|
||||||
Verify the one of the following cryptographic hash values, using software of your choice, before installing the downloaded file in order to avoid viruses. If the hash does not match, delete the downloaded file and try again from another site.
|
Verify the one of the following cryptographic hash values, using software of your choice, before installing the downloaded file in order to avoid viruses. If the hash does not match, delete the downloaded file and try again from another site.
|
||||||
@@ -34,7 +35,7 @@ SHA-256: 28DC21246A9C7CDEDD2D6F0F4082E6BF7EF9DB9CE9D485548E 8A9E1D19EAE2AC.
|
|||||||
|
|
||||||
You will need to go to the preferences and uncheck the auto update checkbox. Then download and install 1.17 over the top of the 1.19 installation. You'll also need to delete the KFX folders from your My Kindle Content folder.
|
You will need to go to the preferences and uncheck the auto update checkbox. Then download and install 1.17 over the top of the 1.19 installation. You'll also need to delete the KFX folders from your My Kindle Content folder.
|
||||||
|
|
||||||
A second possible solution is to use 1.19 or later, but disable KFX by renaming or disabling a necessary component of the application. This may or may not work on versions after 1.20. In a command window, enter the following commands when Kindle for PC/Mac is not running:
|
A other possible solution is to use 1.19 or later, but disable KFX by renaming or disabling a necessary component of the application. This may or may not work on versions after 1.20. In a command window, enter the following commands when Kindle for PC/Mac is not running:
|
||||||
|
|
||||||
#### Windows
|
#### Windows
|
||||||
ren %localappdata%\Amazon\Kindle\application\renderer-test.exe renderer-test.xxx
|
ren %localappdata%\Amazon\Kindle\application\renderer-test.exe renderer-test.xxx
|
||||||
@@ -48,11 +49,11 @@ Mac Note: If the chmod command fails with a permission error try again using sud
|
|||||||
|
|
||||||
After restarting the Kindle program any books previously downloaded in KFX format will no longer open. You will need to remove them from your device and re-download them. All future downloads will use the older Kindle formats instead of KFX although they will continue to be placed in one individual subdirectory per book.
|
After restarting the Kindle program any books previously downloaded in KFX format will no longer open. You will need to remove them from your device and re-download them. All future downloads will use the older Kindle formats instead of KFX although they will continue to be placed in one individual subdirectory per book.
|
||||||
|
|
||||||
#### Another Note on KFX
|
#### Decrypting KFX
|
||||||
It now possible, but not easy, to convert books from KFX to other formats in calibre by installing the optional KFX Input plugin. The lack of automatic DRM removal makes this process difficult so it is not recommended unless there is no other alternative, such as for Indic language books only available in KFX. There is a windows-only KFX DRM rmeoval program in the repository, but not yet integrated into the tools.
|
Thanks to work by several people, the tools can now decrypt KFX format ebooks from Kindle for PC. In addition to the DeDRM plugin, calibre users will also need to install jhowell's KFX Input plugin which is available through the standard plugin menu in calibre, or directly from [his plugin thread](https://www.mobileread.com/forums/showthread.php?t=291290) on Mobileread. Not that KFX decryption does not work for Kindle for Mac 1.25 and later.
|
||||||
|
|
||||||
#### Thanks
|
#### Thanks
|
||||||
Thanks to jhowell for his investigations into KFX format and workarounds. Some of these instructions are from [his thread on the subject](https://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead.
|
Thanks to jhowell for his investigations into KFX format and the KFX Input plugin. Some of these instructions are from [his thread on the subject](https://www.mobileread.com/forums/showthread.php?t=283371) at MobileRead.
|
||||||
|
|
||||||
## Where can I get the latest version of these free DRM removal tools?
|
## Where can I get the latest version of these free DRM removal tools?
|
||||||
Right here at github. Just go to the [releases page](https://github.com/apprenticeharper/DeDRM_tools/releases) and download the latest zip archive of the tools, named DeDRM\_tools\_X.X.X.zip, where X.X.X is the version number. You do not need to download the source code archive.
|
Right here at github. Just go to the [releases page](https://github.com/apprenticeharper/DeDRM_tools/releases) and download the latest zip archive of the tools, named DeDRM\_tools\_X.X.X.zip, where X.X.X is the version number. You do not need to download the source code archive.
|
||||||
@@ -86,9 +87,14 @@ Try right-clicking and select open. That might give you the option to open it an
|
|||||||
### I can't open the Macintosh Application at all. I get 'The aplication "DeDRM" can't be opened'
|
### I can't open the Macintosh Application at all. I get 'The aplication "DeDRM" can't be opened'
|
||||||
Some unzip applications do not respect the execution bit setting. Try unzipping the main tools archive using the built-in Mac unzip utility.
|
Some unzip applications do not respect the execution bit setting. Try unzipping the main tools archive using the built-in Mac unzip utility.
|
||||||
|
|
||||||
|
Alternatively, sometimes the execution bit isn't set correctly in the archive. If you put the extracted DeDRM application in your Applications folder, you can set the executable bit on the 'droplet' file from the terminal using the command chmod +x /Applications/DeDRM.app/Contents/MacOS/droplet
|
||||||
|
|
||||||
### I can't open the Macintosh Application at all. I get 'spawn_via_launchd() failed, errno=111'
|
### I can't open the Macintosh Application at all. I get 'spawn_via_launchd() failed, errno=111'
|
||||||
There seems to be a bug in Apple's launch services. Try using the free [Maintenance utility](https://www.titanium-software.fr/en/maintenance.html) from Titanium Software to clear the launch cache and database.
|
There seems to be a bug in Apple's launch services. Try using the free [Maintenance utility](https://www.titanium-software.fr/en/maintenance.html) from Titanium Software to clear the launch cache and database.
|
||||||
|
|
||||||
|
### The application opens, but always gives an error in the log 'ImportError: No module named Crypto.Cipher'
|
||||||
|
Some version of MacOS don't include PyCrpto. Your should be able to install it by using this command in the Terminal app: python -m pip pycrypto
|
||||||
|
|
||||||
# Using the Tools
|
# Using the Tools
|
||||||
## I can’t get the tools to work on my rented or library ebooks.
|
## I can’t get the tools to work on my rented or library ebooks.
|
||||||
The tools are not designed to remove DRM from rented or library ebooks.
|
The tools are not designed to remove DRM from rented or library ebooks.
|
||||||
@@ -128,7 +134,7 @@ If this book is from an eInk Kindle (e.g. Paperwhite), you must enter the serial
|
|||||||
|
|
||||||
If this book is from Kindle for Mac or Kindle for PC, you must have the Kindle Software installed on the same computer and user account as your copy of calibre.
|
If this book is from Kindle for Mac or Kindle for PC, you must have the Kindle Software installed on the same computer and user account as your copy of calibre.
|
||||||
|
|
||||||
If this book is from Kindle for Mac or Kindle for PC, you must be using version 1.17 or below, see note at top of this file.
|
If this book is from Kindle for Mac you must be using version 1.24 or below, even if you have the Input plugin installed.
|
||||||
|
|
||||||
If the book is from Kindle for PC or Kindle for Mac and you think you are doing everything right, and you are getting this message, it is possible that the files containing the encryption key aren’t quite in the format the tools expect. To try to fix this:
|
If the book is from Kindle for PC or Kindle for Mac and you think you are doing everything right, and you are getting this message, it is possible that the files containing the encryption key aren’t quite in the format the tools expect. To try to fix this:
|
||||||
|
|
||||||
@@ -149,7 +155,7 @@ There are several possible reasons why only some books get their DRM removed.
|
|||||||
If you are still having problems with particular books, you will need to create a log of the DRM removal attempt for one of the problem books, and post that in a comment at Apprentice Alf's blog or in a new issue at Apprentice Harper's github repository.
|
If you are still having problems with particular books, you will need to create a log of the DRM removal attempt for one of the problem books, and post that in a comment at Apprentice Alf's blog or in a new issue at Apprentice Harper's github repository.
|
||||||
|
|
||||||
## My Kindle book has imported and the DRM has been removed, but all the pictures are gone.
|
## My Kindle book has imported and the DRM has been removed, but all the pictures are gone.
|
||||||
Most likely, this is a book downloaded from Amazon directly to an eInk Kindle (e.g. Paperwhite). Unfortunately, the pictures are probably in a .azw6 file that the tools don't understand. You must download the book manually from Amazon's web site "For transfer via USB" to your Kindle. When you download the eboook in this manner, Amazon will package the pictures in the with text in a single file that the tools will be able to import successfully.
|
Most likely, this is a book downloaded from Amazon directly to an eInk Kindle (e.g. Paperwhite). Unfortunately, the pictures are probably in a .azw6 file that the tools don't understand. You must download the book manually from Amazon's web site "For transfer via USB" to your Kindle. When you download the eBook in this manner, Amazon will package the pictures in the with text in a single file that the tools will be able to import successfully.
|
||||||
|
|
||||||
## My Kindle book has imported, but it's showing up as an AZW4 format. Conversions take a long time and/or are very poor.
|
## My Kindle book has imported, but it's showing up as an AZW4 format. Conversions take a long time and/or are very poor.
|
||||||
You have found a Print Replica Kindle ebook. This is a PDF in a Kindle wrapper. Now the DRM has been removed, you can extract the PDF from the wrapper using the KindleUnpack plugin. Conversion of PDFs rarely gives good results.
|
You have found a Print Replica Kindle ebook. This is a PDF in a Kindle wrapper. Now the DRM has been removed, you can extract the PDF from the wrapper using the KindleUnpack plugin. Conversion of PDFs rarely gives good results.
|
||||||
@@ -175,6 +181,8 @@ The Macintosh DeDRM application creates a log file on your desktop every time it
|
|||||||
## I cannot solve my problem with the Windows DeDRM application, and now I need to ‘post a log’. How do I do that?
|
## I cannot solve my problem with the Windows DeDRM application, and now I need to ‘post a log’. How do I do that?
|
||||||
The Windows DeDRM application creates a log file in your home directory (C:\Users\[username]) every time it is run. After unsuccessfully removing DRM from one ebook, copy the contents of the log file (it is a simple text file) and paste it into your comment at Apprentice Alf's blog or in a new issue at Apprentice Harper's github repository.
|
The Windows DeDRM application creates a log file in your home directory (C:\Users\[username]) every time it is run. After unsuccessfully removing DRM from one ebook, copy the contents of the log file (it is a simple text file) and paste it into your comment at Apprentice Alf's blog or in a new issue at Apprentice Harper's github repository.
|
||||||
|
|
||||||
|
## Is there a way to use the DeDRM plugin for Calibre from the command line?
|
||||||
|
See the [Calibre command line interface (CLI) instructions](CALIBRE_CLI_INSTRUCTIONS.md).
|
||||||
|
|
||||||
# General Questions
|
# General Questions
|
||||||
|
|
||||||
@@ -221,7 +229,7 @@ The authors tend to identify themselves only by pseudonyms:
|
|||||||
* The Amazon Topaz format conversion was created by some_updates, clarknova, and Bart Simpson
|
* The Amazon Topaz format conversion was created by some_updates, clarknova, and Bart Simpson
|
||||||
* The DeDRM all-in-one AppleScript application was created by Apprentice Alf
|
* The DeDRM all-in-one AppleScript application was created by Apprentice Alf
|
||||||
* The DeDRM all-in-one Python application was created by some_updates
|
* The DeDRM all-in-one Python application was created by some_updates
|
||||||
* The DeDRM all-in-one calibre plugins was created by Apprentice Alf
|
* The DeDRM all-in-one calibre plugin was created by Apprentice Alf
|
||||||
* The Scuolabooks tool was created by Hex
|
* The Scuolabooks tool was created by Hex
|
||||||
* The Microsoft code was created by drs
|
* The Microsoft code was created by drs
|
||||||
* The Apple DRM removal tool was created by Brahms
|
* The Apple DRM removal tool was created by Brahms
|
||||||
|
|||||||
Binary file not shown.
@@ -8,6 +8,8 @@ Mostly it tracks the tools releases by Apprentice Alf, athough it also includes
|
|||||||
Users should download the latest zip archive.
|
Users should download the latest zip archive.
|
||||||
Developers might be interested in forking the repository, as it contains unzipped versions of those tools that are zipped, and text versions of the AppleScripts, to make the changes over time easier to follow.
|
Developers might be interested in forking the repository, as it contains unzipped versions of those tools that are zipped, and text versions of the AppleScripts, to make the changes over time easier to follow.
|
||||||
|
|
||||||
|
For the latest Amazon KFX format, users of the calibre plugin should also install the KFX Input plugin from the standard calibre plugin menu. It's also available from the MobileRead thread here: https://www.mobileread.com/forums/showthread.php?t=291290
|
||||||
|
|
||||||
I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixes, speed improvements and UI enhancements.
|
I welcome contributions from others to improve these tools, from expanding the range of books handled, improving key retrieval, to just general bug fixes, speed improvements and UI enhancements.
|
||||||
|
|
||||||
My special thanks to all those developers who have done the hard work of reverse engineering to provide the initial tools.
|
My special thanks to all those developers who have done the hard work of reverse engineering to provide the initial tools.
|
||||||
|
|||||||
@@ -1,29 +1,33 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf470
|
{\rtf1\ansi\ansicpg1252\cocoartf1561\cocoasubrtf600
|
||||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset134 STHeitiSC-Light;}
|
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset134 STHeitiSC-Light;}
|
||||||
{\colortbl;\red255\green255\blue255;}
|
{\colortbl;\red255\green255\blue255;}
|
||||||
|
{\*\expandedcolortbl;;}
|
||||||
\paperw11900\paperh16840\vieww12000\viewh15840\viewkind0
|
\paperw11900\paperh16840\vieww12000\viewh15840\viewkind0
|
||||||
\deftab720
|
\deftab720
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\qc\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\qc\partightenfactor0
|
||||||
|
|
||||||
\f0\b\fs24 \cf0 DeDRM ReadMe
|
\f0\b\fs24 \cf0 DeDRM ReadMe
|
||||||
\b0 \
|
\b0 \
|
||||||
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\qj\partightenfactor0
|
||||||
|
|
||||||
|
\b \cf0 \
|
||||||
|
\
|
||||||
|
DeDRM is now a 64-bit application for Mac OS X 10.6 and later.
|
||||||
|
\b0 \
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
||||||
\cf0 \
|
\cf0 \
|
||||||
\
|
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
||||||
|
|
||||||
\b \cf0 First Use for Mac OS X 10.9 and later\
|
\b \cf0 First Use for Mac OS X 10.9 and later\
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
||||||
|
|
||||||
\b0 \cf0 The application is not signed, so the first time you run it you will need to change your security options, or hold down the option key when double-clicking on the icon, or control-click or right-button to get the contextual menu to open it.\
|
\b0 \cf0 The application is not signed, so the first time you run it you will need to change your security options, or hold down the option key when double-clicking on the icon, or control-click or right-button to get the contextual menu to open it. For later versions, after trying to run it once, you may need to go to the security options of the control panel and give explicit permission for this application to be run.\
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
||||||
|
|
||||||
\b \cf0 \
|
\b \cf0 \
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\qj\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\qj\partightenfactor0
|
||||||
|
|
||||||
\b0 \cf0 \
|
\b0 \cf0 DeDRM is an application that packs all of the python dm removal software into one easy to use program that remembers preferences and settings.\
|
||||||
\
|
|
||||||
DeDRM is an application that packs all of the python dm removal software into one easy to use program that remembers preferences and settings.\
|
|
||||||
It works without manual configuration with Kindle for Mac ebooks, Adobe Digital Editions Adept ePub and PDF ebooks, and Barnes & Noble NOOK Study ebooks.\
|
It works without manual configuration with Kindle for Mac ebooks, Adobe Digital Editions Adept ePub and PDF ebooks, and Barnes & Noble NOOK Study ebooks.\
|
||||||
\
|
\
|
||||||
To remove the DRM of Kindle ebooks from eInk Kindles, other Barnes & Noble ePubs, eReader pdb ebooks, or Mobipocket ebooks, you must first run DeDRM application (by double-clicking it) and set some additional Preferences, depending on the origin of your ebook files:\
|
To remove the DRM of Kindle ebooks from eInk Kindles, other Barnes & Noble ePubs, eReader pdb ebooks, or Mobipocket ebooks, you must first run DeDRM application (by double-clicking it) and set some additional Preferences, depending on the origin of your ebook files:\
|
||||||
@@ -52,8 +56,7 @@ A final preference is the destination folder for the DRM-free copies of your ebo
|
|||||||
\
|
\
|
||||||
Once these preferences have been set, you can drag and drop ebooks (or folders of ebooks) onto the DeDRM droplet to remove the DRM.\
|
Once these preferences have been set, you can drag and drop ebooks (or folders of ebooks) onto the DeDRM droplet to remove the DRM.\
|
||||||
\
|
\
|
||||||
This program uses notifications, so really needs Mac OS X 10.8 or above. It will not work on Mac OS X 10.4 or earlier. It might work on Mac OS X 10.5-10.7, but the latest Kindle for Mac does not support those System versions.\
|
This program uses notifications, so really needs Mac OS X 10.8 or above.\
|
||||||
\
|
|
||||||
\
|
\
|
||||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardeftab720\partightenfactor0
|
||||||
|
|
||||||
@@ -23,12 +23,10 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>droplet</string>
|
<string>droplet</string>
|
||||||
<key>CFBundleGetInfoString</key>
|
|
||||||
<string>DeDRM AppleScript 6.6.1 Written 2010–2018 by Apprentice Alf et al.</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>DeDRM</string>
|
<string>DeDRM</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.apple.ScriptEditor.id.707CCCD5-0C6C-4BEB-B67C-B6E866ADE85A</string>
|
<string>com.apple.ScriptEditor.id.DeDRM</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
@@ -36,13 +34,40 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>6.6.1</string>
|
<string>6.6.3</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>dplt</string>
|
<string>dplt</string>
|
||||||
|
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||||
|
<dict>
|
||||||
|
<key>x86_64</key>
|
||||||
|
<string>10.6</string>
|
||||||
|
</dict>
|
||||||
<key>LSRequiresCarbon</key>
|
<key>LSRequiresCarbon</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>NSAppleEventsUsageDescription</key>
|
||||||
|
<string>This script needs to control other applications to run.</string>
|
||||||
|
<key>NSAppleMusicUsageDescription</key>
|
||||||
|
<string>This script needs access to your music to run.</string>
|
||||||
|
<key>NSCalendarsUsageDescription</key>
|
||||||
|
<string>This script needs access to your calendars to run.</string>
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>This script needs access to your camera to run.</string>
|
||||||
|
<key>NSContactsUsageDescription</key>
|
||||||
|
<string>This script needs access to your contacts to run.</string>
|
||||||
|
<key>NSHomeKitUsageDescription</key>
|
||||||
|
<string>This script needs access to your HomeKit Home to run.</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>Copyright © 2010–2018 Apprentice Alf</string>
|
<string>Copyright © 2010–2019 Apprentice Alf</string>
|
||||||
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
<string>This script needs access to your microphone to run.</string>
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>This script needs access to your photos to run.</string>
|
||||||
|
<key>NSRemindersUsageDescription</key>
|
||||||
|
<string>This script needs access to your reminders to run.</string>
|
||||||
|
<key>NSSiriUsageDescription</key>
|
||||||
|
<string>This script needs access to Siri to run.</string>
|
||||||
|
<key>NSSystemAdministrationUsageDescription</key>
|
||||||
|
<string>This script needs access to administer this system to run.</string>
|
||||||
<key>WindowState</key>
|
<key>WindowState</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>bundleDividerCollapsed</key>
|
<key>bundleDividerCollapsed</key>
|
||||||
BIN
contrib/macos/DeDRM.app/Contents/MacOS/droplet → contrib/DeDRM_Macintosh_Application/DeDRM.app/Contents/MacOS/droplet
Normal file → Executable file
BIN
contrib/macos/DeDRM.app/Contents/MacOS/droplet → contrib/DeDRM_Macintosh_Application/DeDRM.app/Contents/MacOS/droplet
Normal file → Executable file
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
{\rtf1\ansi\ansicpg1252\cocoartf1671
|
||||||
|
{\fonttbl}
|
||||||
|
{\colortbl;\red255\green255\blue255;}
|
||||||
|
{\*\expandedcolortbl;;}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# DeDRM.pyw
|
# DeDRM.pyw
|
||||||
# Copyright 2010-2016 some_updates, Apprentice Alf and Apprentice Harper
|
# Copyright 2010-2019 some_updates, Apprentice Alf and Apprentice Harper
|
||||||
|
|
||||||
# Revision history:
|
# Revision history:
|
||||||
# 6.0.0 - Release along with unified plugin
|
# 6.0.0 - Release along with unified plugin
|
||||||
@@ -33,8 +33,10 @@
|
|||||||
# 6.5.5 - Kindle for PC/Accented characters in username fix.
|
# 6.5.5 - Kindle for PC/Accented characters in username fix.
|
||||||
# 6.6.0 - Initial KFX support from TomThumb
|
# 6.6.0 - Initial KFX support from TomThumb
|
||||||
# 6.6.1 - Standalong app fix from wzyboy
|
# 6.6.1 - Standalong app fix from wzyboy
|
||||||
|
# 6.6.2 - Version bump for 64-bit Mac OS X app and various fixes.
|
||||||
|
# 6.6.3 - Version bump for Kindle book name fixes and start of support for .kinf2018
|
||||||
|
|
||||||
__version__ = '6.6.1'
|
__version__ = '6.6.3'
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os, os.path
|
import os, os.path
|
||||||
4
Other_Tools/Kobo/obok.py → contrib/Other_Tools/Kobo/obok.py
Executable file → Normal file
4
Other_Tools/Kobo/obok.py → contrib/Other_Tools/Kobo/obok.py
Executable file → Normal file
@@ -449,6 +449,10 @@ class KoboLibrary(object):
|
|||||||
for m in matches:
|
for m in matches:
|
||||||
# print u"m:{0}".format(m[0])
|
# print u"m:{0}".format(m[0])
|
||||||
macaddrs.append(m[0].upper())
|
macaddrs.append(m[0].upper())
|
||||||
|
elif sys.platform.startswith('linux'):
|
||||||
|
p_out = subprocess.check_output("ip -br link show | awk '{print $3}'", shell=True)
|
||||||
|
for line in p_out:
|
||||||
|
macaddrs.append(line.upper())
|
||||||
else:
|
else:
|
||||||
# probably linux, let's try ipconfig under wine
|
# probably linux, let's try ipconfig under wine
|
||||||
c = re.compile('\s(' + '[0-9a-f]{2}-' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
|
c = re.compile('\s(' + '[0-9a-f]{2}-' * 5 + '[0-9a-f]{2})(\s|$)', re.IGNORECASE)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
Welcome to the tools!
|
Welcome to the tools!
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
This ReadMe_First.txt is meant to give users a quick overview of what is available and how to get started. This document is part of the Tools v6.6.0 archive from Apprentice Harper's github repository: https://github.com/apprenticeharper/DeDRM_tools/
|
This ReadMe_First.txt is meant to give users a quick overview of what is available and how to get started. This document is part of the Tools v6.6.2 archive from Apprentice Harper's github repository: https://github.com/apprenticeharper/DeDRM_tools/
|
||||||
|
|
||||||
The is archive includes tools to remove DRM from:
|
The is archive includes tools to remove DRM from:
|
||||||
|
|
||||||
@@ -46,14 +46,12 @@ To import ebooks from the Kobo Desktop app or from a Kobo ebook reader, install
|
|||||||
For instructions, see the obok_plugin_ReadMe.txt file in the Obok_calibre_plugin folder.
|
For instructions, see the obok_plugin_ReadMe.txt file in the Obok_calibre_plugin folder.
|
||||||
|
|
||||||
|
|
||||||
DeDRM application for Mac OS X users: (Mac OS X 10.4 and above)
|
DeDRM application for Mac OS X users: (Mac OS X 10.6 and above)
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
This application is a stand-alone DRM removal application for Mac OS X users. It is only needed for people who cannot or will not use the calibre plugin. KFX support has not been tested yet.
|
This application is a stand-alone DRM removal application for Mac OS X users. It is only needed for people who cannot or will not use the calibre plugin. KFX support has not been tested yet.
|
||||||
|
|
||||||
For instructions, see the "DeDRM ReadMe.rtf" file in the DeDRM_Macintosh_Application folder.
|
For instructions, see the "DeDRM ReadMe.rtf" file in the DeDRM_Macintosh_Application folder.
|
||||||
|
|
||||||
N.B. Mac OS X 10.4 users need to take extra steps before using the application, see the ReadMe.
|
|
||||||
|
|
||||||
|
|
||||||
DeDRM application for Windows users: (Windows XP through Windows 10)
|
DeDRM application for Windows users: (Windows XP through Windows 10)
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
@@ -73,10 +71,10 @@ B_and_N_Download_Helper
|
|||||||
A Javascript to enable a download button at the B&N website for ebooks that normally won't download to your PC. Only for the adventurous.
|
A Javascript to enable a download button at the B&N website for ebooks that normally won't download to your PC. Only for the adventurous.
|
||||||
|
|
||||||
DRM_Key_Scripts
|
DRM_Key_Scripts
|
||||||
This folder contains python scripts that create or extract or fetch encryption keyfiles for Barnes and Noble, Adobe Digital Editions, Kindle for Mac/PC and old versons of Kindle for Android.
|
This folder contains python scripts that create or extract or fetch encryption keyfiles for Barnes and Noble, Adobe Digital Editions, Kindle for Mac/PC and old versions of Kindle for Android.
|
||||||
|
|
||||||
Kindle_for_Android_Patches
|
Kindle_for_Android_Patches
|
||||||
Definitely only for the adventurous, this folder contains information on how to modify the Kindle for Android app to b able to get a PID for use with the other Kindle tools (DeDRM apps and calibre plugin).
|
Definitely only for the adventurous, this folder contains information on how to modify the Kindle for Android app to b able to get a PID for use with the other Kindle tools (DeDRM apps and calibre plugin).
|
||||||
|
|
||||||
Kobo
|
Kobo
|
||||||
Contains the standalone obok python script for removing DRM from kePubs downloaded using the kobo desktop application.
|
Contains the standalone obok python script for removing DRM from kePubs downloaded using the kobo desktop application.
|
||||||
@@ -158,4 +156,4 @@ The DeDRM python GUI was by some_updates and is maintained by Apprentice Alf and
|
|||||||
|
|
||||||
The Scuolabooks tool is by Hex
|
The Scuolabooks tool is by Hex
|
||||||
|
|
||||||
Many fixes, updates and enhancements to the scripts and applicatons have been made by many other people. For more details, see the commments in the individual scripts.
|
Many fixes, updates and enhancements to the scripts and applicatons have been made by many other people. For more details, see the comments in the individual scripts.
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf470
|
|
||||||
{\fonttbl}
|
|
||||||
{\colortbl;\red255\green255\blue255;}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 362 B |
@@ -4,9 +4,10 @@
|
|||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
# __init__.py for DeDRM_plugin
|
# __init__.py for DeDRM_plugin
|
||||||
# Copyright © 2008-2018 Apprentice Harper et al.
|
# Copyright © 2008-2019 Apprentice Harper et al.
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
|
__version__ = '6.6.3'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
|
||||||
@@ -66,6 +67,8 @@ __docformat__ = 'restructuredtext en'
|
|||||||
# 6.6.0 - Add kfx and kfx-zip as supported file types (also invoke this plugin if the original
|
# 6.6.0 - Add kfx and kfx-zip as supported file types (also invoke this plugin if the original
|
||||||
# imported format was azw8 since that may be converted to kfx)
|
# imported format was azw8 since that may be converted to kfx)
|
||||||
# 6.6.1 - Thanks to wzyboy for a fix for stand-alone tools, and the new folder structure.
|
# 6.6.1 - Thanks to wzyboy for a fix for stand-alone tools, and the new folder structure.
|
||||||
|
# 6.6.2 - revamp of folders to get Mac OS X app working. Updated to 64-bit app. Various fixes.
|
||||||
|
# 6.6.3 - More cleanup of kindle book names and start of support for .kinf2018
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -73,7 +76,7 @@ Decrypt DRMed ebooks.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
PLUGIN_NAME = u"DeDRM"
|
PLUGIN_NAME = u"DeDRM"
|
||||||
PLUGIN_VERSION_TUPLE = (6, 6, 1)
|
PLUGIN_VERSION_TUPLE = (6, 6, 3)
|
||||||
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE])
|
PLUGIN_VERSION = u".".join([unicode(str(x)) for x in PLUGIN_VERSION_TUPLE])
|
||||||
# Include an html helpfile in the plugin's zipfile with the following name.
|
# Include an html helpfile in the plugin's zipfile with the following name.
|
||||||
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
|
RESOURCE_NAME = PLUGIN_NAME + '_Help.htm'
|
||||||
@@ -4,10 +4,10 @@
|
|||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
# k4mobidedrm.py
|
# k4mobidedrm.py
|
||||||
# Copyright © 2008-2017 by Apprentice Harper et al.
|
# Copyright © 2008-2019 by Apprentice Harper et al.
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__version__ = '5.5'
|
__version__ = '5.7'
|
||||||
|
|
||||||
# Engine to remove drm from Kindle and Mobipocket ebooks
|
# Engine to remove drm from Kindle and Mobipocket ebooks
|
||||||
# for personal use for archiving and converting your ebooks
|
# for personal use for archiving and converting your ebooks
|
||||||
@@ -60,7 +60,8 @@ __version__ = '5.5'
|
|||||||
# 5.3 - Changed Android support to allow passing of backup .ab files
|
# 5.3 - Changed Android support to allow passing of backup .ab files
|
||||||
# 5.4 - Recognise KFX files masquerading as azw, even if we can't decrypt them yet.
|
# 5.4 - Recognise KFX files masquerading as azw, even if we can't decrypt them yet.
|
||||||
# 5.5 - Added GPL v3 licence explicitly.
|
# 5.5 - Added GPL v3 licence explicitly.
|
||||||
# 5.x - Invoke KFXZipBook to handle zipped KFX files
|
# 5.6 - Invoke KFXZipBook to handle zipped KFX files
|
||||||
|
# 5.7 - Revamp cleanup_name
|
||||||
|
|
||||||
import sys, os, re
|
import sys, os, re
|
||||||
import csv
|
import csv
|
||||||
@@ -155,19 +156,24 @@ def unicode_argv():
|
|||||||
# added in removal of control (<32) chars
|
# added in removal of control (<32) chars
|
||||||
# and removal of . at start and end
|
# and removal of . at start and end
|
||||||
# and with some (heavily edited) code from Paul Durrant's kindlenamer.py
|
# and with some (heavily edited) code from Paul Durrant's kindlenamer.py
|
||||||
|
# and some improvements suggested by jhaisley
|
||||||
def cleanup_name(name):
|
def cleanup_name(name):
|
||||||
# substitute filename unfriendly characters
|
# substitute filename unfriendly characters
|
||||||
name = name.replace(u"<",u"[").replace(u">",u"]").replace(u" : ",u" – ").replace(u": ",u" – ").replace(u":",u"—").replace(u"/",u"_").replace(u"\\",u"_").replace(u"|",u"_").replace(u"\"",u"\'").replace(u"*",u"_").replace(u"?",u"")
|
name = name.replace(u"<",u"[").replace(u">",u"]").replace(u" : ",u" – ").replace(u": ",u" – ").replace(u":",u"—").replace(u"/",u"_").replace(u"\\",u"_").replace(u"|",u"_").replace(u"\"",u"\'").replace(u"*",u"_").replace(u"?",u"")
|
||||||
# delete control characters
|
|
||||||
name = u"".join(char for char in name if ord(char)>=32)
|
|
||||||
# white space to single space, delete leading and trailing while space
|
# white space to single space, delete leading and trailing while space
|
||||||
name = re.sub(ur"\s", u" ", name).strip()
|
name = re.sub(ur"\s", u" ", name).strip()
|
||||||
|
# delete control characters
|
||||||
|
name = u"".join(char for char in name if ord(char)>=32)
|
||||||
|
# delete non-ascii characters
|
||||||
|
name = u"".join(char for char in name if ord(char)<=126)
|
||||||
# remove leading dots
|
# remove leading dots
|
||||||
while len(name)>0 and name[0] == u".":
|
while len(name)>0 and name[0] == u".":
|
||||||
name = name[1:]
|
name = name[1:]
|
||||||
# remove trailing dots (Windows doesn't like them)
|
# remove trailing dots (Windows doesn't like them)
|
||||||
if name.endswith(u'.'):
|
while name.endswith(u'.'):
|
||||||
name = name[:-1]
|
name = name[:-1]
|
||||||
|
if len(name)==0:
|
||||||
|
name=u"DecryptedBook"
|
||||||
return name
|
return name
|
||||||
|
|
||||||
# must be passed unicode
|
# must be passed unicode
|
||||||
@@ -269,7 +275,7 @@ def decryptBook(infile, outdir, kDatabaseFiles, androidFiles, serials, pids):
|
|||||||
re.match('^{0-9A-F-}{36}$', orig_fn_root)
|
re.match('^{0-9A-F-}{36}$', orig_fn_root)
|
||||||
): # Kindle for PC / Mac / Android / Fire / iOS
|
): # Kindle for PC / Mac / Android / Fire / iOS
|
||||||
clean_title = cleanup_name(book.getBookTitle())
|
clean_title = cleanup_name(book.getBookTitle())
|
||||||
outfilename = '{}_{}'.format(orig_fn_root, clean_title)
|
outfilename = u'{}_{}'.format(orig_fn_root, clean_title)
|
||||||
else: # E Ink Kindle, which already uses a reasonable name
|
else: # E Ink Kindle, which already uses a reasonable name
|
||||||
outfilename = orig_fn_root
|
outfilename = orig_fn_root
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ from __future__ import with_statement
|
|||||||
# Copyright © 2008-2017 Apprentice Harper et al.
|
# Copyright © 2008-2017 Apprentice Harper et al.
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__version__ = '2.5'
|
__version__ = '2.6'
|
||||||
|
|
||||||
# Revision history:
|
# Revision history:
|
||||||
# 1.0 - Kindle info file decryption, extracted from k4mobidedrm, etc.
|
# 1.0 - Kindle info file decryption, extracted from k4mobidedrm, etc.
|
||||||
@@ -28,6 +28,7 @@ __version__ = '2.5'
|
|||||||
# 2.3 - Added more field names thanks to concavegit's KFX code.
|
# 2.3 - Added more field names thanks to concavegit's KFX code.
|
||||||
# 2.4 - Fix for complex Mac disk setups, thanks to Tibs
|
# 2.4 - Fix for complex Mac disk setups, thanks to Tibs
|
||||||
# 2.5 - Final Fix for Windows user names with non-ascii characters, thanks to oneofusoneofus
|
# 2.5 - Final Fix for Windows user names with non-ascii characters, thanks to oneofusoneofus
|
||||||
|
# 2.6 - Start adding support for Kindle 2.25+ .kinf2018 file
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -124,25 +125,27 @@ def SHA256(message):
|
|||||||
return ctx.digest()
|
return ctx.digest()
|
||||||
|
|
||||||
# For K4M/PC 1.6.X and later
|
# For K4M/PC 1.6.X and later
|
||||||
# generate table of prime number less than or equal to int n
|
|
||||||
def primes(n):
|
def primes(n):
|
||||||
if n==2: return [2]
|
"""
|
||||||
elif n<2: return []
|
Return a list of prime integers smaller than or equal to n
|
||||||
s=range(3,n+1,2)
|
:param n: int
|
||||||
mroot = n ** 0.5
|
:return: list->int
|
||||||
half=(n+1)/2-1
|
"""
|
||||||
i=0
|
if n == 2:
|
||||||
m=3
|
return [2]
|
||||||
while m <= mroot:
|
elif n < 2:
|
||||||
if s[i]:
|
return []
|
||||||
j=(m*m-3)/2
|
primeList = [2]
|
||||||
s[j]=0
|
|
||||||
while j<half:
|
for potentialPrime in range(3, n + 1, 2):
|
||||||
s[j]=0
|
isItPrime = True
|
||||||
j+=m
|
for prime in primeList:
|
||||||
i=i+1
|
if potentialPrime % prime == 0:
|
||||||
m=2*i+3
|
isItPrime = False
|
||||||
return [2]+[x for x in s if x]
|
if isItPrime is True:
|
||||||
|
primeList.append(potentialPrime)
|
||||||
|
|
||||||
|
return primeList
|
||||||
|
|
||||||
# Encode the bytes in data with the characters in map
|
# Encode the bytes in data with the characters in map
|
||||||
def encode(data, map):
|
def encode(data, map):
|
||||||
@@ -971,6 +974,13 @@ if iswindows:
|
|||||||
# Probably not the best. To Fix (shouldn't ignore in encoding) or use utf-8
|
# Probably not the best. To Fix (shouldn't ignore in encoding) or use utf-8
|
||||||
print(u'searching for kinfoFiles in ' + path.encode('ascii', 'ignore'))
|
print(u'searching for kinfoFiles in ' + path.encode('ascii', 'ignore'))
|
||||||
|
|
||||||
|
# look for (K4PC 2.25.1and later) .kinf2018 file
|
||||||
|
kinfopath = path +'\\Amazon\\Kindle\\storage\\.kinf2018'
|
||||||
|
if os.path.isfile(kinfopath):
|
||||||
|
found = True
|
||||||
|
print('Found K4PC 2.25+ kinf2018 file: ' + kinfopath.encode('ascii','ignore'))
|
||||||
|
kInfoFiles.append(kinfopath)
|
||||||
|
|
||||||
# look for (K4PC 1.9.0 and later) .kinf2011 file
|
# look for (K4PC 1.9.0 and later) .kinf2011 file
|
||||||
kinfopath = path +'\\Amazon\\Kindle\\storage\\.kinf2011'
|
kinfopath = path +'\\Amazon\\Kindle\\storage\\.kinf2011'
|
||||||
if os.path.isfile(kinfopath):
|
if os.path.isfile(kinfopath):
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user