Skip to content
Browse files

Added epub and mobi builder scripts

  • Loading branch information...
1 parent a2af2fc commit 1d39b8f3db8179c34cbed289018bc6dec58a4b3a Guille Lopez committed Apr 8, 2012
Showing with 103 additions and 0 deletions.
  1. 0 README
  2. +35 −0 README.md
  3. +30 −0 epub-me
  4. +16 −0 mobi-me
  5. +22 −0 unepub-me
View
0 README
No changes.
View
35 README.md
@@ -0,0 +1,35 @@
+# script-me
+A small collection of bash scripts helping on a few mundane developer's tasks.
+
+## Featuring:
+- Build and validate an epub file (all in one call!)
+- Build a mobi file (kindle format)
+- Uncompress epub file to folder
+
+## Installation
+First [download this repository as a zip file](https://github.com/guillelopez/script-me/zipball/master) and uncompress it on your computer.
+
+Second install (or make sure you already have installed) [epubcheck](http://code.google.com/p/epubcheck/) and [kindlegen](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211).
+
+Then add this lines to your ~/bash_profile file (being aware to change it to your own paths):
+
+ # script-me
+ export PATH=/path/to/your/script-me:$PATH
+
+ # Epubcheck
+ function epubcheck() { java -jar /path/to/your/epubcheck.jar $@; }
+ export -f epubcheck
+
+ # Kindlegen
+ export PATH=/path/to/your/kindlegen/:$PATH
+
+## Usage (on terminal)
+
+### Folder → Epub
+ $ epub-me path/to/your/epub/folder/
+
+### Epub → Mobi
+ $ mobi-me path/to/your/epub/file.epub
+
+### Epub → Folder
+ $ unepub-me path/to/your/epub/file.epub
View
30 epub-me
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# ===========
+# = EPUB ME =
+# ===========
+# folder to epub + epubcheck
+# $1 = epub folder path
+# $2 = epub name (optional)
+
+if [ $1 ]; then
+ FOLDER=$1
+else
+ echo "The epub folder path is missing."
+ exit 0
+fi
+
+cd $FOLDER
+
+if [ $2 ]; then
+ NAME=$2
+else
+ NAME=${PWD##*/}
+fi
+
+zip -0Xq ../$NAME.epub mimetype
+zip -Xr9Dq ../$NAME.epub * -x *.DS_Store
+
+cd ..
+
+epubcheck $NAME.epub
View
16 mobi-me
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# ===========
+# = MOBI ME =
+# ===========
+# epub to mobi
+# $1 - epub file path
+
+if [ $1 ]; then
+ FILE=$1
+else
+ echo "The epub file is missing."
+ exit 0
+fi
+
+kindlegen $FILE
View
22 unepub-me
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# =============
+# = UNEPUB ME =
+# =============
+# epub to folder
+# $1 = epub file path
+
+if [ $1 ]; then
+ FILE=$1
+else
+ echo "The epub file path is missing."
+ exit 0
+fi
+
+if [ $2 ]; then
+ NAME=$2
+else
+ NAME=`echo "$FILE" | cut -d'.' -f1`
+fi
+
+unzip -q $FILE -d $NAME

0 comments on commit 1d39b8f

Please sign in to comment.
Something went wrong with that request. Please try again.