02-20-2012, 10:47 PM | #1 |
Junior Member
Posts: 5
Karma: 10
Join Date: Feb 2012
Device: Sony PRS-350
|
Won't accept my date
I'm trying to set the "date" for the article dictionary in parse_index(). It seems that at a certain point, Calibre stops accepting my manipulation of the source data.
This is the code I think should work: Code:
i = div.find('i') m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12} dateGroup = re.match(r"(?P<month>\w+) (?P<date>\d+), (?P<year>\d+)", ''.join(i.findAll(text=True, recursive=False)).strip()) artDate = date(int(dateGroup.group('year')), m[dateGroup.group('month')], int(dateGroup.group('date'))) pubdate = artDate.strftime('%a, %d %b') Curiously, the following three all work as expected: Code:
pubdate = strftime('%a, %d %b') Code:
pubdate = ''.join(i.findAll(text=True, recursive=False)).strip() Code:
pubdate = dateGroup.group('year') + '{0}'.format(m[dateGroup.group('month')]) + dateGroup.group('date') Spoiler:
What's going on here? I don't understand why it won't work. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre will not accept new books. | Rusherman | Calibre | 5 | 06-10-2011 02:14 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 |
new official shipping date / US invitation date | R2D2 | iRex | 18 | 07-06-2006 02:32 PM |