|  11-02-2011, 04:42 PM | #1 | 
| Junior Member  Posts: 7 Karma: 10 Join Date: Oct 2011 Device: kindle | 
				
				help with Read_Status2 column tweaking
			 
			
			I'm trying to tweak the Read Status 2 column - get rid of the percent read, and update the date completed, to make the date hierarchical in the tag browser. I've never tried to mess with python before today (no, yesterday, I started this yesterday afternoon) but here's what i've got: Code: def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct, is_read_str,
				is_reading_str, no_page_read_str):
	try:
		test_val = int(is_read_pct)
	except:
		return 'is_read_pct is not a number'
	import re
	mg = re.match('.*\s(\d+[-/]\d+[-/]\d+).*?Last Page Read: Location \d+ \((\d+)%\)', val, re.I + re.DOTALL);
	if mg is None:
		return no_page_read_str
	date = mg.group(1)
	pct = mg.group(2)
	n = date.split('/')
	year = n[2]
	month = n[0]
	yemo = year + '.' + month
	try:
		f = int(pct)
		if f > test_val:
			return is_read_str + ' ' + yemo
		elif f > 0:
			return is_reading_str 
	except:
		pass
	return no_page_read_strAny feedback on my modifications, or on possible solutions would be *greatly* appreciated. note: yemo looks like an excess variable to me, I was hoping that might change the text string of the output so it might work. | 
|   |   | 
|  11-03-2011, 05:05 AM | #2 | 
| Grand Sorcerer            Posts: 12,525 Karma: 8065948 Join Date: Jan 2010 Location: Notts, England Device: Kobo Libra 2 | 
			
			Setting a composite column to hierarchical requires that the lookup name be typed by hand into the box in preferences -> tags browser. Composite columns are not included in the drop-down list. I will look at fixing this. The composite column type must be "column built from other columns, behaves like tags". I tested whether composite columns can display as hierarchical, and it works. The following function returns one of two values, based on whether the database ID is odd. Code: def evaluate(self, formatter, kwargs, mi, locals): if (mi.id % 2) == 1: return 'foo.bar' return 'foo.mumble' Code: program: myFunction() | 
|   |   | 
| Advert | |
|  | 
|  11-03-2011, 06:48 PM | #3 | |
| Junior Member  Posts: 7 Karma: 10 Join Date: Oct 2011 Device: kindle | Quote: 
 | |
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Q: multi-column PDF to single column mobi format converstion | auburn1975 | Calibre | 7 | 01-28-2012 06:11 PM | 
| Rebuild ePub after tweaking | hollowayhouse | Conversion | 8 | 08-05-2011 08:09 PM | 
| Tweaking Samsung E65 | Sidd | Which one should I buy? | 1 | 07-14-2011 06:48 AM | 
| Table of contents - tweaking | webfolk | Calibre | 26 | 11-05-2010 05:21 PM | 
| pdf to lrf with 2 column and 1 column pages in same file | danielwille | Sony Reader | 3 | 11-12-2008 10:57 AM |