So I just bought a new Kindle eBook and was rather sad to learn that some wine update broke the Amazon Kindle application. The existing PlayOnLinux script does not work either and furthermore I also need the utility to extract the encryption keys from the Kindle application for use with the DeDRM Calibre plugin. I thought about fixing the existing Kindle script and making this like an addon to it, but who even wants to use this super old version of Kindle for anything other than downloading ebooks to strip the DRM off of them anyway?
This is my first PlayOnLinux script and it was very much a learning by doing thing, so if I did something stupid or not so nice, well.. colour me unsurprised.
Source
#!/bin/bash
# Date: 2019-06-02
# Last revision: 2019-06-02
# Author: Jan Path
# Script license: BSD3
[ "$PLAYONLINUX" = "" ] && exit 1
source "$PLAYONLINUX/lib/sources"
TITLE="Amazon Kindle + DeDRM"
PREFIX="amazonkindlededrm"
# The current wine version (4.9) does not work. This one does.
WORKING_WINE_VERSION="3.5"
POL_SetupWindow_Init
POL_Debug_Init
POL_SetupWindow_free_presentation "$TITLE" \
"This will install Amazon Kindle version 1.16 and the DeDRM utility to extract
the encryption keys for use with the DeDRM calibre plugin. (Newer versions of
Amazon Kindle do not work with wine)
Once you logged into your Amazon account in the Kindle application you can run
the “Extract Keys” utility created by this script. The extracted keys should be in
“~/.PlayOnLinux/wineprefix/amazonkindlededrm/drive_c/kindlekey1.k4i”
It is probably a good idea to disable automatic updates after installation
under Tools > Options > General"
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"
POL_System_TmpCreate "$PREFIX"
cd "$POL_System_TmpDir"
# Python 2.7
POL_Download "https://www.python.org/ftp/python/2.7.16/python-2.7.16.msi" "912428345b7e0428544ec4edcdf70286"
POL_Wine_WaitBefore "Python 2.7"
POL_Wine msiexec /i "python-2.7.16.msi"
POL_Wine_WaitExit "Python 2.7"
# PyCrypto 2.6 for Python 2.7
POL_Download "http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe" "e7875e7f6bf0b23701bdd5ef1d8679cd"
POL_Wine_WaitBefore "PyCrypto 2.6 for Python 2.7"
POL_Wine "pycrypto-2.6.win32-py2.7.exe"
POL_Wine_WaitExit "PyCrypto 2.6 for Python 2.7"
# DeDRM
POL_Download "https://github.com/apprenticeharper/DeDRM_tools/releases/download/v6.6.3/DeDRM_tools_6.6.3.zip" "16b0bc2cc165db3215d0b6203bb0ab64"
unzip -u DeDRM_tools_6.6.3.zip
mv "Other_Tools/DRM_Key_Scripts/Kindle_for_Mac_and_PC/kindlekey.pyw" "$WINEPREFIX/drive_c/"
POL_Shortcut 'Python27/python.exe' 'DeDRM Extract Amazon Kindle Keys' '' 'C:\\kindlekey.pyw'
# Amazon Kindle
POL_Download "https://web.archive.org/web/20160817182927/https://s3.amazonaws.com/kindleforpc/44025/KindleForPC-installer-1.16.44025.exe" "92f8b55a17a632e77bcd94f7d7e767fc"
POL_Wine_WaitBefore "Amazon Kindle"
POL_Wine "KindleForPC-installer-1.16.44025.exe"
# I don't really know what this does or if it is important.
# I just copied it from the existing Kindle script. I will have to test
# whether removing it makes a difference
rm "$WINEPREFIX/drive_c/windows/winsxs/manifests/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_deadbeef.manifest"
POL_Wine_WaitExit "Amazon Kindle"
POL_Shortcut "Kindle.exe" "Amazon Kindle"
POL_System_TmpDelete
POL_SetupWindow_Close
exit
Edité par jpath