From 0d530c0c464754d581e739d6c73eecd104df931c Mon Sep 17 00:00:00 2001 From: apprenticeharper Date: Mon, 7 Sep 2015 08:11:18 +0100 Subject: [PATCH] Add encryption fixes from other scripts (SafeUnbuffered). --- Obok_calibre_plugin/obok_plugin.zip | Bin 60497 -> 60744 bytes Obok_calibre_plugin/obok_plugin/obok/obok.py | 29 +++++++++++++++++-- Other_Tools/Kobo/obok.py | 29 +++++++++++++++++-- 3 files changed, 52 insertions(+), 6 deletions(-) diff --git a/Obok_calibre_plugin/obok_plugin.zip b/Obok_calibre_plugin/obok_plugin.zip index 8c22732032e6d313a1ab224d2ee92e6017721f32..144ad0e8d130a67ba4498de81a8407afbd145599 100644 GIT binary patch delta 7075 zcmV;U8(iek*aOJg1F$Vx4k|$>N5-S5AQKw^06I^TJ6b9VnWZHv*4Vm~B(IZiS|oqz zbH8=-`|ozjJlmP6ct^%}B3&1YB>wiB@5S~H+agFp72k|RS^f z5h>oQI80W#IF$Kqk)*;;Q?Cc~Gchi2%DkxHjtRRW^W!}73!0Sk2Iomu&@@Rz`Ee-5 znLkrO541h;Pd_gGY~2Ek#wAk%NcNQ<$4MCn%*PG5yD!99P$Y)>=NNxH4r!vA zD@g=ioNUiCDa9;FZgX%J*JbaL=&Q@Xo*UGNt&^6yFWWN-_8BUK@_h*ZF$-nm~C z%jn7dG7>Bswe)Y~&d;g5AqmC>F}!Dsr{bSwEUOI;0J^!-GLioFZ)HJ?BXuu|b(#PS z3DN4WN@>Pi-H6nuP2-y$9NH+HkgIr+FuZ&nS@NNd_02tGeIZqmLiBGDSo<>$yKHbZS1Fsh?4k*6s^dh zsMv9?G7`th_yArYlX?EPdT=RxVw9Q-RS-6X3<~%Ht<93<4SMIK4>Gh|uwJ00)X&6h zEyl6-ah6YeqzTl2)$!Kql-(8)Z zUw+sE3ut~2lwdbeAtk`Tix?;3kvV6#a-A~`7&s#FdPd%^aT$O3gWY;QZ_Zww!8wV8 zi}Ar5@#;g*oQHqb3UU7W!{zbi)$z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z}y^oyc-vbf31A*7&C*D2a691W#!xp)YH zsYu3BrV_mO@Xex$(glhumoL&d`Fhh6msgkP;wrqzbw}Ix4#~l!c1(v#pi{OpYM8K`U7iIAYvuKjz+B16y+{J zVTI@%CBWa1N9FDTJ{M4hs6d~4=1Y-NFZBcmLu?~lwG(Y=J&L(}i+J~(&1!WY3SQlo zA#r~bZ(ma!g|@AHXiJmU6x^gk{tm_Fl=Axqwev6nvHd7WcjKAh-?O{@@R90eD--(Xwvex?!b6v#GfzK+I+MTaNcg*`wjo+1PA$l0c>9T_gTAmsaINb{LxI7lIb zmvSBP{0AArV+5y_fA7zQw_3O39ZkPjfYE>;K(x4knN}k>l|CA~w9#sI;6_R3n?MS> zb1zsqNXqEVU$bC!6?6_eJ|{;$uLMmT8UO$zOp}A@N&;zglh5ft0?Brh5b8|<2$Npw zKLUn)lb`B70(*y(-|9XA29qA^KLXp3lV9sY0*;xJp_&wvxa%qcwWpKh>plYdwv#06 zJ_3iklVt2Z0#?A2r0hNd^v#px>^>&L+W-J{bZKm9bZKRCE^v8JO9ci10000N02ctE M1pok=<^TWy0IAqjkpKVy diff --git a/Obok_calibre_plugin/obok_plugin/obok/obok.py b/Obok_calibre_plugin/obok_plugin/obok/obok.py index 1e93c0e..d619a26 100644 --- a/Obok_calibre_plugin/obok_plugin/obok/obok.py +++ b/Obok_calibre_plugin/obok_plugin/obok/obok.py @@ -3,6 +3,7 @@ # Version 3.1.5 September 2015 # Removed requirement that a purchase has been made. +# Also add in character encoding fixes # # Version 3.1.4 September 2015 # Updated for version 3.17 of the Windows Desktop app. @@ -218,6 +219,24 @@ def _load_crypto(): AES = _load_crypto() +# Wrap a stream so that output gets flushed immediately +# and also make sure that any unicode strings get +# encoded using "replace" before writing them. +class SafeUnbuffered: + def __init__(self, stream): + self.stream = stream + self.encoding = stream.encoding + if self.encoding == None: + self.encoding = "utf-8" + def write(self, data): + if isinstance(data,unicode): + data = data.encode(self.encoding,"replace") + self.stream.write(data) + self.stream.flush() + def __getattr__(self, attr): + return getattr(self.stream, attr) + + class KoboLibrary(object): """The Kobo library. @@ -463,8 +482,7 @@ class KoboFile(object): contents = contents[:-padding] return contents -if __name__ == '__main__': - +def cli_main(): lib = KoboLibrary() for i, book in enumerate(lib.books): @@ -515,4 +533,9 @@ if __name__ == '__main__': zin.close() lib.close() - exit(result) + return result + +if __name__ == '__main__': + sys.stdout=SafeUnbuffered(sys.stdout) + sys.stderr=SafeUnbuffered(sys.stderr) + sys.exit(cli_main()) diff --git a/Other_Tools/Kobo/obok.py b/Other_Tools/Kobo/obok.py index 1e93c0e..d619a26 100644 --- a/Other_Tools/Kobo/obok.py +++ b/Other_Tools/Kobo/obok.py @@ -3,6 +3,7 @@ # Version 3.1.5 September 2015 # Removed requirement that a purchase has been made. +# Also add in character encoding fixes # # Version 3.1.4 September 2015 # Updated for version 3.17 of the Windows Desktop app. @@ -218,6 +219,24 @@ def _load_crypto(): AES = _load_crypto() +# Wrap a stream so that output gets flushed immediately +# and also make sure that any unicode strings get +# encoded using "replace" before writing them. +class SafeUnbuffered: + def __init__(self, stream): + self.stream = stream + self.encoding = stream.encoding + if self.encoding == None: + self.encoding = "utf-8" + def write(self, data): + if isinstance(data,unicode): + data = data.encode(self.encoding,"replace") + self.stream.write(data) + self.stream.flush() + def __getattr__(self, attr): + return getattr(self.stream, attr) + + class KoboLibrary(object): """The Kobo library. @@ -463,8 +482,7 @@ class KoboFile(object): contents = contents[:-padding] return contents -if __name__ == '__main__': - +def cli_main(): lib = KoboLibrary() for i, book in enumerate(lib.books): @@ -515,4 +533,9 @@ if __name__ == '__main__': zin.close() lib.close() - exit(result) + return result + +if __name__ == '__main__': + sys.stdout=SafeUnbuffered(sys.stdout) + sys.stderr=SafeUnbuffered(sys.stderr) + sys.exit(cli_main())