![]() |
#1 | |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2012
Device: Kindle
|
Error when adding date to titles in recipes
Hi! I am a complete newbie, so please bear with me if I am making any silly mistakes.
I am trying to customize the built-in recipes by adding the date to the title. By following the instructions in the Calibre manual, I added "import time" and put " + time.strftime('%d %b %Y')" in the title line (these are the only changes I made to the recipe). So the recipe looks something like this: Code:
#!/usr/bin/env python __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' ''' economist.com ''' from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import Tag, NavigableString from collections import OrderedDict import time, re class Economist(BasicNewsRecipe): title = 'The Economist' + time.strftime('%d %b %Y') Quote:
|
|
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,173
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Use
from calibre import strftime rather than time.strftime |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Oct 2012
Device: Kindle
|
|
![]() |
![]() |
![]() |
#4 |
Zealot
![]() ![]() ![]() Posts: 110
Karma: 240
Join Date: Sep 2009
Device: Kindle 3 3G Graphite, Sony PRS-505
|
Hi, can you tell me what I am doing wrong in the below script? I believe I followed the explanations above. I am trying to make the title show as follows: The Economist - 2012 Dec 22. In the recipe I changed only the below line:
title = 'The Economist - ' + from calibre import strftime('%Y %b %d') |
![]() |
![]() |
![]() |
#5 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 44,173
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You need
title = 'The Economist' + time.strftime('%d %b %Y') |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Zealot
![]() ![]() ![]() Posts: 110
Karma: 240
Join Date: Sep 2009
Device: Kindle 3 3G Graphite, Sony PRS-505
|
Kovid, you are the BOSS!!! Great work, and now this is awesome!
![]() Thanks a lot and Happy New Year!!! ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding Apostrophes in Recipes | Steven630 | Recipes | 2 | 07-30-2012 05:53 AM |
Import OS modify date while Adding books? | unboggling | Calibre | 4 | 12-07-2011 12:09 PM |
Changing article titles in recipes | tbaac | Recipes | 8 | 12-22-2010 12:03 PM |
Date in Calibre? Adding books in the future? | wygit | Calibre | 2 | 11-04-2009 11:12 AM |
Bug with the date in subscription titles | copernicc | Calibre | 4 | 03-05-2009 01:22 PM |