Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-24-2014, 11:44 PM   #16
Purple Lady
Grand Sorcerer
Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.
 
Purple Lady's Avatar
 
Posts: 5,698
Karma: 16542228
Join Date: Feb 2010
Location: Pennsylvania
Device: Huawei MediaPad M5, LG V30, Boyue T80S, Nexus 7 LTE, K3 3G, Fire HD8
Quote:
Originally Posted by chaley View Post
You can probably use the template in your composite column:
Code:
{#mybool:switch(yes,read,no,unread,)}
instead of this one that you are probably using now:
Code:
{#read}
Quote:
Originally Posted by kaufman View Post
No problem, its was just an idea. I'm not invested in it that much. I just thought it might be easier for everyone.

By the way, you can do a lot with Calibre and custom columns using tags. I used to use separate columns for a lot of things because I didn't know how to do it with a tag. Some helpful person on Mobileread showed me how to do it with a small program block. If you are interested, take a look at:

https://www.mobileread.com/forums/sho....php?p=2761871

I'm using a template function - I copied something Chaley did for someone for the sub collections for Sony PRS+ to start with and changed it to suit me. I have categories that I want as a top level collection, and genres that I want to combine with the #read column. I used to have series and author collections as well, but CC takes care of those.

Code:
def evaluate(self, formatter, kwargs, mi, locals, cats, genre):

    categories = set([v.strip() for v in cats.split(',') if v.strip()])
    genres = set([v.strip() for v in genre.split(',') if v.strip()])
    res = []

    tags = [v.strip() for v in kwargs.get('tags') if v.strip()]
    isread = kwargs.get('#read')
	
	for v in tags:
		if v in categories:
			res.append(v)
		elif v in genres:
			if isread:
				res.append('Genre ' + isread+ '|' + v)
			else:
				res.append('Genre|'  + v)
		elif isread:
			res.append(isread + '|' + v)
		else:
			res.append('stuff|'  + v)

    if isread:
		res.append(isread) 
            
    return ', '.join(res)
I end up with these groupings:
Borrowed, Genre unread|Non Fiction, unread
read|-bought, Genre read|Mystery - Thriller, read
unread|-free, Genre unread|Science Fiction, unread
Purple Lady is offline   Reply With Quote
Old 02-25-2014, 03:15 AM   #17
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Thanks everyone for the comments. I don't seem to be too far off. We will see when I get the beta out.
chaley is offline   Reply With Quote
Advert
Old 02-25-2014, 03:24 AM   #18
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Purple Lady View Post
I'm using a template function - I copied something Chaley did for someone for the sub collections for Sony PRS+ to start with and changed it to suit me. I have categories that I want as a top level collection, and genres that I want to combine with the #read column. I used to have series and author collections as well, but CC takes care of those.

Spoiler:
Code:
def evaluate(self, formatter, kwargs, mi, locals, cats, genre):
    categories = set([v.strip() for v in cats.split(',') if v.strip()])
    genres = set([v.strip() for v in genre.split(',') if v.strip()])
    res = []

    tags = [v.strip() for v in kwargs.get('tags') if v.strip()]
    isread = kwargs.get('#read')
	
	for v in tags:
		if v in categories:
			res.append(v)
		elif v in genres:
			if isread:
				res.append('Genre ' + isread+ '|' + v)
			else:
				res.append('Genre|'  + v)
		elif isread:
			res.append(isread + '|' + v)
		else:
			res.append('stuff|'  + v)

    if isread:
		res.append(isread) 
            
    return ', '.join(res)


I end up with these groupings:
Borrowed, Genre unread|Non Fiction, unread
read|-bought, Genre read|Mystery - Thriller, read
unread|-free, Genre unread|Science Fiction, unread
You can use a yes/no column (lets call it #read_yesno) by changing the line
Code:
isread = kwargs.get('#read')
to be
Code:
isread = kwargs.get('#read_yesno')
if isread == 'Yes': isread = 'read'
elif isread == 'No': isread = 'unread'
else: isread = ''
chaley is offline   Reply With Quote
Old 02-25-2014, 10:52 AM   #19
Purple Lady
Grand Sorcerer
Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.Purple Lady ought to be getting tired of karma fortunes by now.
 
Purple Lady's Avatar
 
Posts: 5,698
Karma: 16542228
Join Date: Feb 2010
Location: Pennsylvania
Device: Huawei MediaPad M5, LG V30, Boyue T80S, Nexus 7 LTE, K3 3G, Fire HD8
Quote:
Originally Posted by chaley View Post
You can use a yes/no column (lets call it #read_yesno) by changing the line
Code:
isread = kwargs.get('#read')
to be
Code:
isread = kwargs.get('#read_yesno')
if isread == 'Yes': isread = 'read'
elif isread == 'No': isread = 'unread'
else: isread = ''
Thanks. I knew it should be easy, but my brain has not been cooperating lately.
Purple Lady is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Feature Request - Check Box "Want to Read" Rudyman Calibre 3 05-03-2012 12:34 PM
"Mark this forum read" is not working signum Feedback 0 04-19-2012 10:02 PM
New to "Read in Store" feature: Limited Selection negris123 Barnes & Noble NOOK 4 06-09-2011 01:08 PM
What is the best way to mark books as "read"? treadlightly Calibre 10 05-03-2011 08:50 AM
"Menu" and "Mark" keys does not work murad Sony Reader 4 07-11-2009 12:35 PM


All times are GMT -4. The time now is 02:37 AM.


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