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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-12-2014, 09:03 PM   #1
ireadtheinternet
Member
ireadtheinternet began at the beginning.
 
Posts: 20
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, 10: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: 26,436
Karma: 5383257
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 10:41 PM.
kovidgoyal is offline   Reply With Quote
 
Advertisement
Old 11-12-2014, 11:14 PM   #3
ireadtheinternet
Member
ireadtheinternet began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Oct 2014
Device: Android
Ah, thanks -- that will help a lot.
ireadtheinternet is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:25 PM
How to update metadata information from excel (Publication Date,Tags) mahaveer Calibre 3 09-26-2011 01:55 PM
Help for populate_article_metadata ajmoraal Recipes 10 11-16-2010 05:24 PM
Bulk Changing Published Date To Date hmf Calibre 4 10-19-2010 11:19 PM
Up-to-date candy teacher (date being 1921) kacir Deals, Freebies, and Resources (No Self-Promotion) 0 06-16-2010 05:18 PM


All times are GMT -4. The time now is 09:04 AM.


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