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 11-12-2014, 08:03 PM   #1
ireadtheinternet
Member
ireadtheinternet began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Oct 2014
Device: Android
Question update date in populate_article_metadata?

Why does this work:

Code:
    def populate_article_metadata(self, article, soup, first):
        article.title='Hello'
but this doesn't work:

Code:
    def populate_article_metadata(self, article, soup, first):
        article.date = '1/25/2014'
Or do you think it is something I am doing wrong elsewhere in the recipe?
ireadtheinternet is offline   Reply With Quote
Old 11-12-2014, 09:35 PM   #2
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont pass in a string date, you pass in a parsed time struct.

Use

import time
article.date = time.strftime(...)

EDIT: And IIRC to change the actual displayed date, you set formatted_date, not date (date is used internally to expire old articles and so on). And formatted date accepts a unicode string.

Last edited by kovidgoyal; 11-12-2014 at 09:41 PM.
kovidgoyal is offline   Reply With Quote
Advert
Old 11-12-2014, 10:14 PM   #3
ireadtheinternet
Member
ireadtheinternet began at the beginning.
 
Posts: 21
Karma: 10
Join Date: Oct 2014
Device: Android
Ah, thanks -- that will help a lot.
ireadtheinternet is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Read date from companion to Calibre Wirrel Calibre Companion 1 09-08-2013 08:25 PM
How to update metadata information from excel (Publication Date,Tags) mahaveer Calibre 3 09-26-2011 12:55 PM
Help for populate_article_metadata ajmoraal Recipes 10 11-16-2010 04:24 PM
Bulk Changing Published Date To Date hmf Calibre 4 10-19-2010 10:19 PM
Up-to-date candy teacher (date being 1921) kacir Deals and Resources (No Self-Promotion or Affiliate Links) 0 06-16-2010 04:18 PM


All times are GMT -4. The time now is 06:27 PM.


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