Skip to content

Commit c9fff13

Browse files
committed
disable self-install, use Makefile to create github releases
1 parent 4d995a9 commit c9fff13

File tree

3 files changed

+48
-24
lines changed

3 files changed

+48
-24
lines changed

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env make -f
2+
#make a github release of the calibre plugin
3+
4+
VERSION := $(shell python __init__.py)
5+
LAST_TAG != git describe --abbrev=0 --tags
6+
7+
USER := kfix
8+
PLUGIN := djvumaker
9+
REPO := calibre_plugin_djvumaker
10+
ZIP := $(PLUGIN).zip
11+
12+
GH_RELEASE_JSON = '{"tag_name": "v$(VERSION)","target_commitish": "master","name": "v$(VERSION)","body": "calibre plugin of version $(VERSION)","draft": false,"prerelease": false}'
13+
14+
all: clean release
15+
16+
tag:
17+
git tag -f -a v$(VERSION) -m 'release $(VERSION)'
18+
19+
$(ZIP): tag
20+
git archive --format=zip --output=$@ v$(VERSION) *.py *.txt
21+
22+
release: $(ZIP)
23+
git push -f --tags
24+
posturl=$$(curl --data $(GH_RELEASE_JSON) "https://api.github.com/repos/$(USER)/$(REPO)/releases?access_token=$(GITHUB_ACCESS_TOKEN)" | jq -r .upload_url | sed 's/[\{\}]//g') && \
25+
dload=$$(curl --fail -X POST -H "Content-Type: application/gzip" --data-binary "@$(ZIP)" "$$posturl=$(ZIP)&access_token=$(GITHUB_ACCESS_TOKEN)" | jq -r .browser_download_url | sed 's/[\{\}]//g') && \
26+
echo "Plugin now available for download at $$dload"
27+
#update attachment @ http://www.mobileread.com/forums/showthread.php?p=2881112#post2881112
28+
clean:
29+
rm *.zip
30+
31+
test: $(ZIP)
32+
calibre-customize -a $(ZIP)
33+
calibre-debug -r djvumaker test.pdf
34+
35+
.PHONY: clean tag release all test

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,16 @@ PDF is still better for vector/markup based "ebooks" so this plugin will not try
1515
Installation
1616
---
1717
1. Right click the preferences button in calibre, select get new plugins, scroll down the list and choose the DjVuMaker plugin to install
18-
* Or, download the zip and install it from the shell
18+
* Or clone this repo and install from source
1919

2020
````bash
21-
wget https://github.com/kfix/calibre_plugin_djvumaker/archive/master.zip
22-
calibre-customize -b master.zip
23-
````
24-
* Or++, clone this repo and install from source
25-
26-
````bash
27-
git clone github.com/kfix/calibre-plugin-djvumaker
28-
cd calibre-plugin-djvumaker
29-
./__init__.py
21+
git clone https://github.com/kfix/calibre_plugin_djvumaker
22+
cd calibre_plugin_djvumaker
23+
calibre-customize -b ./
3024
````
3125
2. [Required] Build the conversion programs (**fixme: works only on OSX**)
3226
```calibre-debug -R djvumaker install_deps```
33-
3. [Optional] run a test conversion out-of-GUI against the included PDF.
34-
```calibre-debug -R djvumaker test.pdf```
35-
4. (Re)start Calibre and start converting your PDF books!
27+
3. (Re)start Calibre and start converting your PDF books!
3628

3729
Under the Hood
3830
---
@@ -44,7 +36,7 @@ Therefore both packages must be built by the user in a complicated procedure, wh
4436
Q: Why not write a "standard" Conversion Plugin for DjVU?
4537
---
4638
Calibre's conversion API currently supports two pipelines:
47-
1) markup-based ebooks (book.xfmt > book.OEB > book.yfmt): useless for working on image-based scans.
39+
1) markup-based ebooks (book.xfmt > book.OEB > book.yfmt): useless for working on image-based scans.
4840
2) comic books (*.cbz): unusably slow for library books due to its over-reliance on Python for its transform pipeline.
4941
5042
Only ghostscript+gsdjvu delivers usable conversion times for large scanned books.

__init__.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
__copyright__ = '2014, Joey Korkames <github.com/kfix>'
66
__docformat__ = 'restructuredtext en'
77

8-
PLUGINNAME = 'djvumaker' # Name of the plugin
8+
PLUGINNAME = 'djvumaker'
9+
PLUGINVER = (1,0,0)
910

10-
#run this file directly to self-install the plugins to calibre
1111
if __name__ == '__main__':
12-
import os, sys
13-
os.system("calibre-customize -b %s" % os.path.dirname(os.path.abspath(__file__)))
14-
print 'plugin installed.'
15-
print 'install support programs with: `calibre-debug -r djvumaker install_deps`'
16-
print 'test & debug with: `calibre-debug -r djvumaker -- test.pdf`'
12+
import sys
13+
sys.stdout.write(".".join(str(i) for i in PLUGINVER)) #Makefile needs this to do releases
1714
sys.exit()
1815

1916
import errno, os, sys, subprocess, traceback
@@ -143,7 +140,7 @@ class DJVUmaker(FileTypePlugin, InterfaceActionBase): #multiple inheritance for
143140
description = 'Convert raster-based document files (Postscript, PDF) to DJVU with GUI button and on-import'
144141
supported_platforms = ['linux', 'osx', 'windows'] # Platforms this plugin will run on
145142
author = 'Joey Korkames' # The author of this plugin
146-
version = (1, 0, 1) # The version number of this plugin
143+
version = PLUGINVER # The version number of this plugin
147144
file_types = set(['pdf','ps', 'eps']) # The file types that this plugin will be automatically applied to
148145
on_postimport = True # Run this plugin after books are addded to the database
149146
minimum_calibre_version = (1, 0, 0) #needs the new db api and id bugfix
@@ -163,8 +160,8 @@ def prints(p): print p
163160
self.postimport(id_or_path, fmt)
164161
elif id_or_path == "convert_all":
165162
'`calibre-debug -r djvumaker convert_all`'
166-
prints("Copy-convert all PDFs to DJVU? (press CTRL+C to abort)")
167-
icl_user = raw_input('')
163+
prints("Press Enter to copy-convert all PDFs to DJVU, or CTRL+C to abort...")
164+
raw_input('')
168165
from calibre.library import db
169166
db = db() # initialize calibre library database
170167
for book_id in list(db.all_ids()):

0 commit comments

Comments
 (0)