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 01-06-2013, 11:43 AM   #1
johanp
Member
johanp began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jan 2010
Location: Stockholm, Sweden
Device: Kobo Glo, PocketBook Touch 622
Fetching Lenta.ru from python script

Hi,

I have a setup where I fetch news from a python script on my Linux server using cron. It works well apart from Lenta.ru for which the description string contains non-ascii characters. I get the "Failed to find builtin recipe: " error. I'm running Python 2.7.1. I copied the description string from the builtin_recipes.xml file. Script:

Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os, subprocess, tempfile

os.environ['DISPLAY'] = ':1'

recipes = [u'Lenta.ru: Новости' 'Dagens Nyheter', \
           'Svenska Dagbladet', 'BBC News', 'La Repubblica']

tmp_dir = tempfile.mkdtemp()
out_file = tmp_dir + "/news.epub"

for recipe in recipes:
    subprocess.call(["ebook-convert", recipe + ".recipe", out_file])
    subprocess.call(["calibredb", "add", out_file])

os.remove(out_file)
os.removedirs(tmp_dir)
Any clue how to make this work?
johanp is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use python script with windows xp tuufbiz1 Other formats 12 01-08-2011 08:22 AM
Import ebook conversion in python script erollisi Calibre 1 08-19-2010 09:43 PM
How do I get a shortcut for a Python script onto the taskbar in W7? Sydney's Mom Workshop 6 03-28-2010 08:11 PM
Nedd a little help with a python script gandor62 Calibre 1 08-07-2008 09:59 PM
Python script to create collections gwynevans Sony Reader Dev Corner 2 03-13-2008 12:29 PM


All times are GMT -4. The time now is 05:34 AM.


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