04-14-2009, 02:59 PM | #1 |
hopeless n00b
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
on-the-fly epub creation
Need some (major) help...
I have a modified PHP script (based on FLAG) that dynamically creates a Stanza catalog for my favorite FanFiction.Net categories. It basically allows me to browse FanFiction.Net in real-time and creates epub-format ebooks on the fly using Calibre for reading in Stanza iPhone. The script currently runs on my Windows PC running XAMPP. I have a shared Linux hosting account on 1and1 and I wish to upload the script there. My current dilemma is the epub creation part. I'm currently researching what methods I can use to create epub files using utilities/etc already installed or are user-installable on the shared account. The Linux host has Perl, Python and PHP installed and the operating system is CentOS, iirc. Options I'm considering:
Anyway, not really looking for a discussion on the merits of the different methods. Just asking for help on the how. If you know of another way to do this (preferably something even an inexperienced coder can do), please post it here. Thanks! |
04-14-2009, 03:09 PM | #2 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
the calibre binary installer is (almost) fully self contained, so you should be able to install it on a shared host.
|
Advert | |
|
04-14-2009, 03:59 PM | #3 |
hopeless n00b
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Thanks! That's good to know.
I don't have secure shell/terminal access to the shared host. Can I just extract the tarball on my home computer and upload via ftp? What does calibre_postinstall do? The binary installer seems to call it at the end. Is it necessary to run it? Again, thank you very, very much! |
04-14-2009, 04:01 PM | #4 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No you should be able to run it without running postinstall (postinstall just sets up integration with the host OS which you don't need if all you want to do is conversions). I don't know if the FTP will preserve execute permissions on the files in the tarball though
|
04-14-2009, 08:35 PM | #5 | |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2008
Device: Sony PRS-505
|
Quote:
Usage as follows: PHP Code:
|
|
Advert | |
|
04-14-2009, 09:45 PM | #6 | |
hopeless n00b
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
|
|
04-14-2009, 10:26 PM | #7 | |
GuteBook/Mobi2IMP Creator
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Quote:
p.s. care to share your .oeb script? Inquirying minds would like to know... |
|
04-15-2009, 10:34 AM | #8 |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2008
Device: Sony PRS-505
|
Essentially the script takes three arguments; a site, a story id and an output format. I slurp the whole story into an associative array - using htmlpurifier as it's brought in - and output using the desired format.
For epub the .opf is created using this PHP Code:
PHP Code:
|
04-15-2009, 11:01 AM | #9 | |
GuteBook/Mobi2IMP Creator
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Quote:
I'm working on a Perl script, Epub2IMP.pl, that will convert any .epub to .imp after it is tweaked to accomodate some shortcomings of the ETI eBook Publisher software. It seems that any <img src> with a width=100% stretches the image without regard to the image's aspect ratio. Also, any CSS applied to <div class=>'s doesn't appear to be honoured so must be wrapped within a <p class=> </p> with the same CSS class reference. To boot, within a .opf, even capiltalized Dublin Core metadata elements i.e. <dc:Title> cause problems. My Perl script will do many text subtitutions to alleviate these issues. Hopefully, ETI will improve their .epub support, especially since they co-authored many of the standards involved. |
|
04-15-2009, 12:40 PM | #10 |
hopeless n00b
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Thanks DigitalFeonix! Those scripts really help a lot. I'm still going to try to get Calibre working, but if it doesn't, I now have fallback #4, except you've done the job for me. Haven't been able to test anything, though, since I'm experiencing some weird issues with 1and1 mod_rewrite. The .htaccess file I use for my local XAMPP server doesn't want to work with 1and1 so I'm slowly trying to troubleshoot it.
If/when I get this working, I can start on making the covers look spiffy with ImageMagick. @nrapallo The PHP scripts don't look complicated at all, barring for the ZipCreate class. That, though, I attribute to my lack of knowledge of the zip file structure. Seems like that's the only thing you really need to port to Python. The rest is basically just creating text files. Last edited by ilovejedd; 04-15-2009 at 12:46 PM. |
04-15-2009, 12:54 PM | #11 | |
GuteBook/Mobi2IMP Creator
Posts: 2,958
Karma: 2530691
Join Date: Dec 2007
Location: Toronto, Canada
Device: REB1200 EBW1150 Device: T1 NSTG iLiad_v2 NC Device: Asus_TF Next1 WPDN
|
Quote:
I'm still not proficient at coding in Python and really need my hand held... |
|
04-15-2009, 03:45 PM | #12 |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2008
Device: Sony PRS-505
|
The zipcreate class was not written by me and is a little over my head. I did work with the author to make sure that epubs that it created worked within ADE and that the native zip utilities on both Mac and PC could open them.
I have looked at python as a possible language to pick up, but my scripts should be easy to port for someone with knowledge in both. The scripts should be hosted wherever you are going to download or create the epubs from. There is nothing in them that most hosting companies would disallow (ie no exec() calls). |
04-16-2009, 01:15 PM | #13 |
hopeless n00b
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Tried Calibre last night (still haven't fixed mod_rewrite, though). Looks like some of the commands used in the html2epub shell script requires admin access and we're only given user rights. I even changed permissions to 777 and still no go. Created a test.sh and that worked just fine with shell_exec(). I'll probably try the ZipCreate method tonight or at least attempt to create a wrapper for the whole epub creation process.
Thanks again for all the help! |
04-16-2009, 01:30 PM | #14 |
creator of calibre
Posts: 44,428
Karma: 24044628
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
html2epub shouldn't require admin access. What errors do you get when running it?
|
04-16-2009, 03:19 PM | #15 | |
Resident Curmudgeon
Posts: 76,139
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Atlantis Word Processor - ePub creation tool | awp | ePub | 408 | 01-07-2021 07:13 AM |
ePub creation is a breeze | mtravellerh | Sigil | 12 | 12-07-2009 03:21 AM |
epub creation tools | jbenny | ePub | 20 | 03-13-2009 12:30 PM |
ePub creation / conversion | philippd | ePub | 8 | 06-04-2008 04:23 AM |
ePub Creation Utility | KoopaOne | ePub | 13 | 04-30-2008 10:38 AM |