From 6bc2447f9de2e2e1657f07753f9edc85dab5d3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ibu=20=E2=98=89=20radempa?= Date: Sat, 26 Dec 2020 11:27:05 +0000 Subject: [PATCH] Import release 1.0.0 from http://theanarchistlibrary.org/docs/theanarchistlibrary_store.zip . --- CHANGELOG.md | 14 +++++ releases/theanarchistlibrary_store_v1.0.0.zip | Bin 0 -> 1735 bytes theanarchistlibrary_store/__init__.py | 14 +++++ ...-import-name-store_theanarchistlibrary.txt | 0 .../theanarchistlibrary_plugin.py | 56 ++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 CHANGELOG.md create mode 100644 releases/theanarchistlibrary_store_v1.0.0.zip create mode 100644 theanarchistlibrary_store/__init__.py create mode 100644 theanarchistlibrary_store/plugin-import-name-store_theanarchistlibrary.txt create mode 100644 theanarchistlibrary_store/theanarchistlibrary_plugin.py diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c34a74f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +## [1.0.0] - 2012-06-28 + +On 2020-12-26 the page +https://bookshelf.theanarchistlibrary.org/library/calibre-store-plugin +claimed that the source repository was https://gitorious.org/~meskio, +however according to [archiveteam](https://www.archiveteam.org/index.php?title=Gitorious) +the site gitorious.org was closed in 2015. + +The page also had a download link to a zip file +(named theanarchistlibrary_store.zip), which was +added to this repository. It contained a calibre +plugin versioned (1, 0, 0), a copyright string +'2012, Ruben Pollan ' and +files datemarked 2012-06-27 and 2012-06-28. diff --git a/releases/theanarchistlibrary_store_v1.0.0.zip b/releases/theanarchistlibrary_store_v1.0.0.zip new file mode 100644 index 0000000000000000000000000000000000000000..203aa6658a782d626d7be8a8914ecc63135afafe GIT binary patch literal 1735 zcmWIWW@Zs#U|`^2@b$doaDAyjP#PlxLn9Ld12=;VLwtN@US>&ryk0?NXb2|*bEEtl z|27~lt>9*0WckRMt{;bp1r`drO@3LPyo*3IKv zHhI~qs5yUs`C7ewageu>YyG{|dsbb#W!>EvnEiwERaG@}I*@zpp+nw%&x8Kg)t77U zkd8MvU{;mS^ykII_}D*3^-MOFA3SQcASR_yI9Gb5`Q{lDTHUmj6P17HH8_TbdT(UU z-czl(=Ix0|U4L8){t9?Lh*NsFG;xjAYhL3wR)1u9Zl2qCN2Pb+;UkeUGf#i!y2QEc z_@8W{1A&a2U3{mo-JB$S{!d zo0{2PbysLn-$D7HGIwRa&P^-XnP`=&A?~0i9Ti&s|lYgbyaKg8g zJ#v3`lwU4+CVH0R`kd!$_s_m*eq)W*|NGxUzVZhEqlya{RSXPUHs5vtGoXY4Fscf2 zO4Bp*bTe}c@{3Az^AdAYb&E^#i&EoDGEx)s5{r^EGK))cGLwoDiz@X>DoVid8Ql5W z|M!R2=Ijcbc`r@89UAYZL53N|wHCAr; zo@JKS=IpGH!5Ll9xlmYk&!t0AflT-L&65-OB86J?*XFdX%Y8Oq>WY$*>fG(YD}J}{ z?T`p-TI2ga`2BwA8yD(zy)JLx{(bN13*S$+zk7GQJ}Xn9;M<3#w^urS`u2)V`!*WEc*H+L&4}pd*5m@>0X}vzU-fIT=LOXYb&B=uM9cekha@+QP7VSx3BGa zeRS`<{j3|UuFD#(+A`TR{OPfekGgNKe)6yC$LBxCA0$P$%;8+Uxb74C;@`&qE35Tn zSnbvuaAs0e1N^m!-;x_s#PVOY`A;r(Qq*zAFYY+o*6&DZ#K}IcUTn#jr^uhyZE2!|m nYAddy1KAs*z#4`?K?1Y_OCb{A&B_LHI5QAx0iE8?3gQ6(+CkAe literal 0 HcmV?d00001 diff --git a/theanarchistlibrary_store/__init__.py b/theanarchistlibrary_store/__init__.py new file mode 100644 index 0000000..7188418 --- /dev/null +++ b/theanarchistlibrary_store/__init__.py @@ -0,0 +1,14 @@ +__license__ = 'GPL 3' +__copyright__ = '2012, Ruben Pollan ' +__docformat__ = 'restructuredtext en' + +from calibre.customize import StoreBase + +class TheAnarchistLibraryStore(StoreBase): + name = 'The Anarchist Library' + description = 'theanarchistlibrary.org is (despite its name) an archive focusing on anarchism, anarchist texts, and texts of interest for anarchists.' + author = 'Ruben Pollan' + version = (1, 0, 0) + drm_free_only = True + formats = ['EPUB', 'PDF', 'TXT', 'TEX', 'MUSE'] + actual_plugin = 'calibre_plugins.store_theanarchistlibrary.theanarchistlibrary_plugin:TheAnarchistLibraryStore' diff --git a/theanarchistlibrary_store/plugin-import-name-store_theanarchistlibrary.txt b/theanarchistlibrary_store/plugin-import-name-store_theanarchistlibrary.txt new file mode 100644 index 0000000..e69de29 diff --git a/theanarchistlibrary_store/theanarchistlibrary_plugin.py b/theanarchistlibrary_store/theanarchistlibrary_plugin.py new file mode 100644 index 0000000..4ee9dce --- /dev/null +++ b/theanarchistlibrary_store/theanarchistlibrary_plugin.py @@ -0,0 +1,56 @@ +__license__ = 'GPL 3' +__copyright__ = '2012, Ruben Pollan ' +__docformat__ = 'restructuredtext en' + +import urllib2 +from contextlib import closing + +import json + +from PyQt4.Qt import QUrl + +from calibre import browser +from calibre.gui2 import open_url +from calibre.gui2.store import StorePlugin +from calibre.gui2.store.basic_config import BasicStoreConfig +from calibre.gui2.store.search_result import SearchResult +from calibre.gui2.store.web_store_dialog import WebStoreDialog + +class TheAnarchistLibraryStore(BasicStoreConfig, StorePlugin): + + def open(self, parent=None, detail_item=None, external=False): + url = 'http://theanarchistlibrary.org/' + + if external or self.config.get('open_external', False): + open_url(QUrl(url_slash_cleaner(detail_item if detail_item else url))) + else: + d = WebStoreDialog(self.gui, url, parent, detail_item) + d.setWindowTitle(self.name) + d.set_tags(self.config.get('tags', '')) + d.exec_() + + def search(self, query, max_results=10, timeout=60): + url = 'http://theanarchistlibrary.org/search?fmt=json&query=' + urllib2.quote(query) + + br = browser() + + counter = max_results + with closing(br.open(url, timeout=timeout)) as f: + doc = json.load(f) + for data in doc: + s = SearchResult() + s.title = data['title'].strip() + s.author = data['author'].strip() + s.price = '$0.00' + s.detail_item = data['url'].strip() + s.drm = SearchResult.DRM_UNLOCKED + s.downloads['EPUB'] = data['url'].strip() + '.epub' + s.downloads['PDF'] = data['url'].strip() + '.pdf' + s.downloads['A4.PDF'] = data['url'].strip() + '.a4.pdf' + s.downloads['LT.PDF'] = data['url'].strip() + '.lt.pdf' + s.downloads['TXT'] = data['url'].strip() + '.txt' + s.downloads['TEX'] = data['url'].strip() + '.tex' + s.downloads['MUSE'] = data['url'].strip() + '.muse' + s.formats = 'EPUB, PDF, A4.PDF, LT.PDF, TXT, TEX, MUSE' + + yield s