Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 04-15-2014, 09:16 AM   #31
cram1010
Member
cram1010 began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Apr 2012
Device: Bq cervantes
Typographical styleshhet

Gutenweb is a typographical stylesheet I have developed to get up and runing when generating html or epub documents. It uses some very known typographical principes and it adapts to screen or print media.

It can be used with calibre recipes to get default styles that will look nice and readable. To use it, you can do something like this:

Code:
import urllib
class MyRecipe (BasicNewsRecipe):
  # some code

  no_stylesheets = True
  extra_css = urllib.urlopen('https://raw.githubusercontent.com/laMarciana/gutenweb/master/dist/gutenweb.css').read().replace('@charset "UTF-8";', '')

 # more code
cram1010 is offline   Reply With Quote
Old 02-28-2015, 04:24 AM   #32
Antiould
Junior Member
Antiould began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2015
Device: Kindle PW
Adding QR codes to articles

Some times you want to see the original version of the article you're reading. Kindle devices are not very convinient when it comes to browsing the web. Of couse you can always copy the URL calibre displays in the navbar, but if you have a smartphone, it's much easier to scan a QR code (2d barcode) instead. The following snippet is a skeleton of recipe which adds a QR code to the bottom of the article with its URL.

https://gist.github.com/guyru/d35712edcc5b6adf364c
Antiould is offline   Reply With Quote
Advert
Old 03-12-2015, 11:17 AM   #33
waldorfpatriot
Junior Member
waldorfpatriot began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2012
Device: Kindle 3
epubs: convert and send to kindle in one click

Preamble
I have a huge library of digital content in a software called "digitale bibliothek" by directmedia. In version 5 you can export to epub. That is great, so I can finally read the books on my kindle. Unfortunately getting an epub to kindle is a complicated business: open calibre, import the book, click send to kindle, wait for calibre to convert the document, close calibre again. If I'm working and just want to remember to read something later I need something that is working with one click: here is how I solved it.

Requirements
Workflow
All you need to do, to get your epub to your kindle is put the file in a specific folder on your mac. A mac os x automation folder action automatically scans the folder, grabs the epub files and gives them to calibre to convert to the kindle friendly format mobi. After converting, automator puts the mobi file in a dropbox folder called send2kindle. The dropbox folder is scanned by if that than that, which sends the file to your @free.kindle.com address.

customize the folder action


(if the picture is broken, try looking here)

There are two adjustments you have to make:
  1. the folder, in which you put the files. in my case it is "lesestoff"
  2. the other is the dropbox folder in which the script puts the mobi files. in my case it is "send2kindle"

The first adjustment you do by clicking in the right corner under the play button. Here you chose the folder to be scanned.

The next three steps in the workflow are
  1. show folder content
  2. filter the content for epub files
  3. run shell script that gives the epub files to calibre to convert them to mobi, move the converted files to the dropbox folder and remove the original epub

Code:
while read LINE
do
 /Applications/calibre.app/Contents/MacOS/ebook-convert "$LINE" "${LINE/.*/}.mobi"
mv "${LINE/.*/}.mobi" ~/Dropbox/[your_folder_name]
rm "$LINE"

Last edited by waldorfpatriot; 03-12-2015 at 11:58 AM.
waldorfpatriot is offline   Reply With Quote
Old 11-18-2016, 08:45 PM   #34
teotjunk
Connoisseur
teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.teotjunk could sell banana peel slippers to a Deveel.
 
Posts: 84
Karma: 3004
Join Date: Jul 2011
Device: none
There is a newspaper that I would like to download. How do I go about doing it?
teotjunk is offline   Reply With Quote
Old 05-29-2018, 08:53 AM   #35
jtheelen
Junior Member
jtheelen began at the beginning.
 
Posts: 1
Karma: 10
Join Date: May 2018
Device: Sony eReader PRS-T3
Here's a Python 2.7 script to create a large poster with all the covers of your e-book files in Calibre (requires libraries PIL and BeautifulSoup):

Spoiler:
Code:
from bs4 import BeautifulSoup
from PIL import Image
import fnmatch
import os


PATH_TO_CALIBRE_LIBRARY = './Calibre Library'
PATH_TO_POSTER = './poster.jpg'

COLS = 10  # book covers per row
WIDTH = 1000  # px

KEEP_TAGS = None
SKIP_TAGS = set(['foo', 'bar'])  # skip books with Calibre tags 'foo' or 'bar'

books = []
for book, _, filenames in os.walk(PATH_TO_CALIBRE_LIBRARY):
    for _ in fnmatch.filter(filenames, 'cover.jpg'):
        if not KEEP_TAGS and not SKIP_TAGS:
            books.append(book)
        else:
            soup = BeautifulSoup(open(os.path.join(book, 'metadata.opf')), 'lxml')
            tags = set(str(tag.text) for tag in soup.findAll('dc:subject', text=True))
            if KEEP_TAGS:
                if KEEP_TAGS & tags:
                    books.append(book)
            elif SKIP_TAGS:
                if not SKIP_TAGS & tags:
                    books.append(book)

cover_height = []
for book in books:
    w, h = Image.open(os.path.join(book, 'cover.jpg')).size
    cover_height.append((int(h * WIDTH / w), book))

cover_height = sorted(cover_height)

poster_height = sum(h for h, _ in cover_height[-len(books) / COLS - 1:])
poster = Image.new('RGB', (COLS * WIDTH, poster_height), (255, 255, 255))

row_height = {}
for i, (h, book) in enumerate(cover_height):
    cover = os.path.join(book, 'cover.jpg')
    row_height[i / COLS] = h
    poster.paste(Image.open(cover).resize((WIDTH, h), Image.ANTIALIAS),
                 ((i % COLS) * WIDTH, sum(list(row_height.values())[:-1])))

poster.crop((0, 0, COLS * WIDTH, sum(row_height.values()))).save(PATH_TO_POSTER)

print('{} book covers added in {} columns and {} rows'
      .format(len(books), COLS, len(row_height)))

Last edited by jtheelen; 06-16-2018 at 03:21 PM.
jtheelen is offline   Reply With Quote
Advert
Old 09-25-2018, 12:04 PM   #36
Ramana
Connoisseur
Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.
 
Posts: 51
Karma: 20728
Join Date: May 2015
Device: Onyx Boox i86 Hdml plus
Could anyone tell me how to combine multiple html pages' content into single article and add to the section in the custom recipe?
I am able to add each page of the one post as separate article. But, I want to add all of these pages content as single article.
Ramana is offline   Reply With Quote
Old 09-25-2018, 09:59 PM   #37
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,658
Karma: 24966646
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
you add only the first article's url to the list of articles and then set recursion = some high enough number and implement is_link_wanted() in your recipe to follow the links to the next article pages.
kovidgoyal is offline   Reply With Quote
Old 09-26-2018, 02:11 PM   #38
Ramana
Connoisseur
Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.
 
Posts: 51
Karma: 20728
Join Date: May 2015
Device: Onyx Boox i86 Hdml plus
Quote:
Originally Posted by kovidgoyal View Post
you add only the first article's url to the list of articles and then set recursion = some high enough number and implement is_link_wanted() in your recipe to follow the links to the next article pages.
Hi Kovid,
My article spread over multiple pages like article1/page/1, article1/page/2 ....
I do not want link from page1 content to page2 content. I want to combine the content of all these pages of article1 into one and add this article1 to section. Could you suggest in this scenario.
Similar way all the aritcles spread over multiple pages.
Ramana is offline   Reply With Quote
Old 09-27-2018, 01:27 AM   #39
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,658
Karma: 24966646
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Yeah what I suggested will result in all pages being combined into one article, there are many builtin recipes that use this echnique, for example the recipe for New York Magazine
kovidgoyal is offline   Reply With Quote
Old 09-27-2018, 03:38 AM   #40
Ramana
Connoisseur
Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.
 
Posts: 51
Karma: 20728
Join Date: May 2015
Device: Onyx Boox i86 Hdml plus
Quote:
Originally Posted by kovidgoyal View Post
Yeah what I suggested will result in all pages being combined into one article, there are many builtin recipes that use this echnique, for example the recipe for New York Magazine
Thank you Kovid
Ramana is offline   Reply With Quote
Old 11-13-2018, 02:14 PM   #41
Ramana
Connoisseur
Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.
 
Posts: 51
Karma: 20728
Join Date: May 2015
Device: Onyx Boox i86 Hdml plus
Quote:
Originally Posted by kovidgoyal View Post
Yeah what I suggested will result in all pages being combined into one article, there are many builtin recipes that use this echnique, for example the recipe for New York Magazine
I tried to create recipe as shown in New York Magazine. I set recursions value. But unable to combine the multiple html files into single article. The first url source contains a input tag which is a button to redirect to next page. No href link present. Any suggestion how to deal with input tag that redirects to other page ?
Ramana is offline   Reply With Quote
Old 11-14-2018, 01:01 AM   #42
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,658
Karma: 24966646
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
as long as you can figure out what the url for the next page is, you can always add it to the html manualy in preprocess_html() then the rest of the recipe system should pick it up. See https://www.crummy.com/software/Beau...mentation.html

for how to add tags to the soup
kovidgoyal is offline   Reply With Quote
Old 11-15-2018, 05:16 AM   #43
Ramana
Connoisseur
Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.
 
Posts: 51
Karma: 20728
Join Date: May 2015
Device: Onyx Boox i86 Hdml plus
Quote:
Originally Posted by kovidgoyal View Post
as long as you can figure out what the url for the next page is, you can always add it to the html manualy in preprocess_html() then the rest of the recipe system should pick it up. See https://www.crummy.com/software/Beau...mentation.html

for how to add tags to the soup
Thank you Kovid
Ramana is offline   Reply With Quote
Old 11-19-2018, 10:01 AM   #44
Ramana
Connoisseur
Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.Ramana can self-interpret dreams as they happen.
 
Posts: 51
Karma: 20728
Join Date: May 2015
Device: Onyx Boox i86 Hdml plus
Could anyone tell me how to write recipe to extract articles from scrollable page? Is there a way without using selenium ? Can we write recipes that uses selenium with Calibre ?
Ramana is offline   Reply With Quote
Old 01-10-2023, 01:54 PM   #45
redrob
Junior Member
redrob began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Jan 2023
Device: Kobo Libra
Nickel Menu Config scripts: Menu Items

The only 2 things in my Nickel Menu are Kor Reader and Plato. Is there an easy way to inject some baseline menu items that might be useful for a low maintenance user? I've struggled for about a year. The Nickel instructions have a script in them. It hasn't helped ..."me."

Will anyone offer direction to simply expand the number of menu items for at least a novice user as well as how to insert them?

Red

Last edited by redrob; 01-10-2023 at 01:57 PM.
redrob is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DR800 The working (usable) screen resolution PaulS iRex 7 04-23-2010 01:27 PM
Let's create a source code repository for DR 800 related code? jraf iRex 3 03-11-2010 01:26 PM
any usable epub reader? janw iRex 10 09-04-2009 01:25 PM
FICTIONWISE, still usable? jcbeam Amazon Kindle 4 03-19-2009 02:17 PM
iLiad usable for scientists? doctorow iRex 5 08-14-2006 06:00 PM


All times are GMT -4. The time now is 01:50 AM.


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