Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Sony Reader > Sony Reader Dev Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 12-04-2008, 04:54 AM   #1
acidzebra
Liseuse Lover
acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.
 
acidzebra's Avatar
 
Posts: 869
Karma: 1035404
Join Date: Jul 2008
Location: Netherlands
Device: PRS-505
webcomic2lrf, a brutal and simplistic commandline script

So I've settled into a comfortable routine with my Sony PRS-505, plugging it into my linux box at night which runs Calibre's feeds2lrf via a scheduled job so that in the morning I have my favorite news sources ready for consumption during my daily commute. I also enjoy a webcomic now and then (especially in the morning when my brain is still booting), so I hacked together a crude script that pulls in the latest of my favorite webcomics, zips them, then runs comic2lrf to create a nice LRF file.

To pull in the comics I use dosage, a program specifically designed for creating offline mirrors of various webcomics using 'recipes' which describe the URL and filename format the comic uses. Dosage is completely written in Python, which is why I chose to use it (there is other similar software out there).

Aside from Dosage, you'll need Calibre installed (duh). I run on linux but theoretically it should be possible to port this to other OSes. The script lives in a folder in my home directory called webcomic2lrf, and yes, the code is awkward and painful to behold but it works for me

Code:
#!/bin/bash
# First archive old comics and clean temp
mv -f ~/webcomic2lrf/Comics/ ~/webcomic2lrf/comicarchive/
rm -Rf ~/webcomic2lrf/tempcomic
mkdir ~/webcomic2lrf/tempcomic
# use the dosage binary 'mainline' to grab the comics
mainline ASofterWorld CatAndGirl CtrlAltDel DieselSweeties JerkCity JoyOfTech LittleGamers MakeWithTheFunny NuklearPower RealLife RedMeat QuestionableContent PvPonline TheOrderOfTheStick UserFriendly VGCats Wulffmorgenthaler xkcd Goats Dilbert SchlockMercenary UberSoft
# go to comic folder
cd ~/webcomic2lrf/Comics
# move everything to one folder as dosage creates subfolders for every comic
find . -name "*.*" -exec cp {} ~/webcomic2lrf/tempcomic \;
# go to tempcomic folder
cd ~/webcomic2lrf/tempcomic
# zip the comics
zip -m comic.zip *
# rename to cbz
mv -f comic.zip comic.cbz
# convert to lrf
comic2lrf -r -l -a "Webcomics" -t "Daily Webcomics" comic.cbz
Note that earlier I used the older "comiclrf" script which for some reason didn't like all these different images formats combined so I found it necessary to add one more step before zipping to convert everything to .jpg:
Code:
for img in *.*; do base=`basename $img`; convert "$img" "$base.jpg"; done
But since I switched to comic2lrf it all worked fine without it

Webcomics come in all shapes and sizes so some will be readable on your reader, some might not be. The 'recipes' that Dosage uses are sometimes out of date, but the format is easy enough to understand and adapt to any webcomic out there. Dosage also has some more advanced archiving and 'catching up' functionality but I haven't yet looked into it.

Anyhow, I hope this is of some use to the webcomic/prs-505/linux fans out there, all five of them
acidzebra is offline   Reply With Quote
Old 12-20-2008, 11:48 AM   #2
ashadocat
Member
ashadocat began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Dec 2008
Device: sony 505
Make that six. Thanks this is really useful and saved me much sanity
ashadocat is offline   Reply With Quote
Advert
Old 12-22-2008, 09:40 AM   #3
acidzebra
Liseuse Lover
acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.
 
acidzebra's Avatar
 
Posts: 869
Karma: 1035404
Join Date: Jul 2008
Location: Netherlands
Device: PRS-505
Yay, six! Our numbers are growing!

I've got a slightly better version brewing which keeps track of when the reader was last attached and grabs all comics between now and the last connection but my complete lack of coding skills and procrastinating ways are stopping me from getting it to actually work.
acidzebra is offline   Reply With Quote
Old 12-22-2008, 09:42 AM   #4
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
hm. possibly seven. i love my comics. if i can figure this out i'd love to use it as well.
zelda_pinwheel is offline   Reply With Quote
Old 12-22-2008, 09:50 AM   #5
acidzebra
Liseuse Lover
acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.
 
acidzebra's Avatar
 
Posts: 869
Karma: 1035404
Join Date: Jul 2008
Location: Netherlands
Device: PRS-505
Hmmm, you would need a working python installation which is as simple as grabbing an installer from http://www.python.org/ , Calibre installed but that is a given I think, a commandline zip or rar program (to create the archive), and then try and run the dosage software.

Once you get that running the script should be easy to port to windows, these commands could be run from a batch script as easy as from a shell. It is the dosage program which is the crux - perhaps there is a way to grab offline copies of webcomics for windows already, in fact, I would bet on it.
acidzebra is offline   Reply With Quote
Advert
Old 12-22-2008, 10:06 AM   #6
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
mm hm. okay. i think i can manage most if not all of that. what exactly do you mean by a commandline zip or rar program ? can winrar be used via commandline ? can you recommend one, if not ?

also, when you say "batch file", do you mean copy that code into a txt and rename it *.bat ? or something more complicated ? in which case, what would it take to get you to make the batch file for me ?
zelda_pinwheel is offline   Reply With Quote
Old 12-22-2008, 10:34 AM   #7
acidzebra
Liseuse Lover
acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.
 
acidzebra's Avatar
 
Posts: 869
Karma: 1035404
Join Date: Jul 2008
Location: Netherlands
Device: PRS-505
Okay, for the webcomic grabbing maybe something like this 5 seconds of googling brought me:
http://www.softpedia.com/get/Others/Fun/Woofy.shtml
Haven't tested, haven't looked further :P

If you have winrar, there should already be two commandline programs installed in C:\Program Files\WinRAR - rar.exe and unrar.exe, you'll have to run them from a commandline to see what the possible switches are, I don't know.

As for batch files, yeah, it would be a little more involved. Linux uses a different structure for directories, you can see this in arguments used like "~/somefolder" which expands to "/home/acidzebra/somefolder", which in windows terms would be like c:\documents and settings\acidzebra.
I don't know if windows has a direct "move" (mv) command, but I'm sure that could be done with "copy" and "del" too. I think a "find" command also exists in windows 2000 and later versions but fecked if I know the syntax.

Last edited by acidzebra; 12-22-2008 at 10:39 AM.
acidzebra is offline   Reply With Quote
Old 12-22-2008, 10:36 AM   #8
zelda_pinwheel
zeldinha zippy zeldissima
zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.zelda_pinwheel ought to be getting tired of karma fortunes by now.
 
zelda_pinwheel's Avatar
 
Posts: 27,827
Karma: 921169
Join Date: Dec 2007
Location: Paris, France
Device: eb1150 & is that a nook in her pocket, or she just happy to see you?
Quote:
Originally Posted by acidzebra View Post
Okay, for the webcomic grabbing maybe something like this 5 seconds of googling brought me:
http://www.softpedia.com/get/Others/Fun/Woofy.shtml
Haven't tested, haven't looked further :P

If you have winrar, there should already be two commandline programs installed in C:\Program Files\WinRAR - rar.exe and unrar.exe, you'll have to run them from a commandline to see what the possible switches are, I don't know.
ta. i'll look into it.
zelda_pinwheel is offline   Reply With Quote
Old 12-23-2008, 03:17 PM   #9
gwynevans
Wizzard
gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.gwynevans ought to be getting tired of karma fortunes by now.
 
gwynevans's Avatar
 
Posts: 1,402
Karma: 2000000
Join Date: Nov 2007
Location: UK
Device: iPad 2, iPhone 6s, Kindle Voyage & Kindle PaperWhite
Dosage runs fine on Windows, although you need to install it and it's dependancies 'manually' (i.e. 'python setup.py install')

I'm using the following script conversion, although that itself uses the cygwin 'find.exe' in my D:\bin\ and A: is where I mount the Reader.

Code:
REM First archive old comics and clean temp
cd Z:\WebComics
cp -vr Comics/* ComicsArchive
rm -Rf Comics work
mkdir work

REM use the dosage binary 'mainline' to grab the comics
mainline ChasingTheSunset DieselSweeties JoyOfTech LittleGamers UserFriendly xkcd ComicsDotCom/getfuzzy Flipside KeenSpot/ElGoonishShive KeenSpot/ElGoonishShiveNP KeenSpot/JuvenileDiversion KeenSpot/MenageA3 KeenSpot/Striptease UClick/Doonesbury UClick/Foxtrot UClick/Garfield UClick/LibertyMeadows

REM go to comic folder
cd Comics
rem # move everything to one folder as dosage creates subfolders for every comic
D:\bin\find . -name "*.*" -exec "cp {} \WebComics\work" ;

rem # go to work folder
cd \WebComics\work
rem # zip the comics
zip -m comic.zip *
rem # rename to cbz
mv -f comic.zip comic.cbz
rem # convert to lrf
comic2lrf -r -l -a "Webcomics" -t "Daily Webcomics" comic.cbz
cd ..
copy work\comic.lrf A:\database\media\books\
gwynevans is offline   Reply With Quote
Reply

Tags
bash, calibre, script, webcomic

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Commandline only build plord Calibre 11 11-27-2010 06:56 PM
Search Script Gibbo Lounge 7 03-30-2009 04:36 PM
conversion script JeffElkins Calibre 2 03-28-2009 03:06 AM
iLiad Can't run my first script ragdoll iRex Developer's Corner 4 01-28-2008 06:40 AM
Would anyone be interested in this script... coleman Sony Reader 2 07-26-2007 11:30 AM


All times are GMT -4. The time now is 10:02 PM.


MobileRead.com is a privately owned, operated and funded community.