Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-16-2011, 12:05 PM   #31
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
It's all english. How about extracting values instead or removing them? Like listing the values I want to keep and removing all others.

After this I will go to actually read some book instead of organizing them
What can I say, I have weakness for organizing

Last edited by Noughty; 10-16-2011 at 12:13 PM.
Noughty is offline   Reply With Quote
Old 10-16-2011, 12:21 PM   #32
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: 11,779
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Noughty View Post
It's all english. How about extracting values instead or removing them? Like listing the values I want to keep and removing all others.
Use something like the following:
Code:
def evaluate(self, formatter, kwargs, mi, locals):
	# Tags is a multiple text field, so it is already split
	tags = set(mi.get('tags', []))
	# Shelf is a multiple text field, so it is already split
	shelf = set(mi.get('#shelf', []))
	
	# items that must be in the result
	must_have = set(['foo', 'bar', 'somethingElse', 'Comics',
		 'andSoOn', 'until I get tired', 'of adding things']) 

	# combine tags and shelf together
	ts = tags | shelf
	# get the items in the combined tags and shelf that are also in must_have
	res = must_have & ts
	return ', '.join(sorted(res))
The line "must_have & ts" returns a set containing items that are in both must_have and ts. This effectively extracts items in must_have from the set ts.

As for your question about functions in python, the definitive source is the python manual. It can be (is!) overwhelming. However, all the functions we have been using here are described in the section http://docs.python.org/library/stdty...-set-frozenset.
chaley is offline   Reply With Quote
Old 10-16-2011, 12:48 PM   #33
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Thanks for all the trouble. It works and the time for writing metadata decreased twice. It took a minute after it rewrote everything after applying the last created template.

Just got a little scare, apparently I cannot edit any values in tag browser or my templates disappear and I get errors.

All codes disappeared, I cannot edit them to fix them. Only add again

Last edited by Noughty; 10-16-2011 at 01:15 PM.
Noughty is offline   Reply With Quote
Old 10-16-2011, 01:21 PM   #34
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Ok. I tried to edit one value in my #shelf and all these 4 templates disappeared and I get error as result.

I don't understand why. It shouldn't affect it's stability if I change values in tags or shelves, only result should get modified if new value matches/doesn't match the ones I listed....

How does it work so I wouldn't mess it up again? Just recovered it.

But it's strange that template disappeared from the templates list (in advanced preferences)

How to avoid this?

They disappeared again

Code:
TEMPLATE ERROR Formatter: unknown function mygenres near mygenres
So twice already

Seems restart fixes this.

Last edited by Noughty; 10-16-2011 at 02:53 PM.
Noughty is offline   Reply With Quote
Old 10-16-2011, 04:48 PM   #35
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: 11,779
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Noughty View Post
They disappeared again

Code:
TEMPLATE ERROR Formatter: unknown function mygenres near mygenres
So twice already

Seems restart fixes this.
OK, so it seems that custom template functions disappear from time to time.

I will look for the cause tomorrow.
chaley is offline   Reply With Quote
Old 10-17-2011, 05:02 AM   #36
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: 11,779
Karma: 7029857
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I can't repeat the problem, nor can I find a reason for it.

If I understand correctly, every time you change #shelf (and tags?), the templates stop working. A failure scenario would be:
- start calibre. Composite columns are correct.
- change #shelf. Composite columns are gone/not correct.
- restart calibre. Composite columns are correct again.
Is this right?
chaley is offline   Reply With Quote
Old 10-17-2011, 11:53 AM   #37
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
I thought so since the first time happened after I changed "western" to "Western" in shelves, not sure about the others. One had something to do with metadata download. Can't yet pin point what causes this.
I just changed values in shelves, tags. It works fine. Added new files, downloaded metadata, works fine.

Will try to track every action and see exactly when/if it fails. So far I wasn't able to make it fail after the latest restart. Maybe restarting is important after any changes in the templates (in the code itself, I added some values etc.).

Will post if it repeats.
Noughty is offline   Reply With Quote
Old 10-17-2011, 12:55 PM   #38
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Disappeared again after I added 15 books to my columns which aren't even in templates. They have nothing to do with these codes. One is for Anthology and another for Managing

I also added one of the programs into my custom columns template. I think that might have caused it. I did both things close together.

I think messing with templates does it. Maybe it requires restart after every edit.

Last edited by Noughty; 10-17-2011 at 12:57 PM.
Noughty is offline   Reply With Quote
Old 10-17-2011, 01:19 PM   #39
Noughty
Addict
Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.Noughty is cognizant of many things which escape those who dream only by night.
 
Posts: 352
Karma: 103850
Join Date: Apr 2011
Device: Kindle NT
Another question for my custom column I made which involves comments. It saves html comments so in output I get all codes with <></> and alike. It's not very nice to read. How to make it save the simple text?

It keeps disappearing. Now happened after I used goodreads sync plug in. I used it to add books on goodreads shelf and when sync that shelf. Also linked a few books. Again no values in any of the columns in any way related to the created templates were touched.
Now I'm completely confused.
It works for some books, fails for others. I see zero pattern. Two books with the same values in tags, shelves. One works while another fails. Well,the only patters is that if it fails for a book it fails in all columns, if it works it works in all columns. It works only on like 3% of the books.

Changing metadata does this. Maybe when it is a lot of metadata changes it can't deal with it or something. I synced from one shelves which adds Y to yes/no column and just searched for books with no value in that column. They all are ok. Almost all of my books are on that shelf so it's a lot of metadata to sync and change if needed.

Last edited by Noughty; 10-18-2011 at 03:21 PM.
Noughty is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tag browser searching Stampercam Calibre 2 06-25-2011 04:42 AM
Browser freezes loading main forum page Ripplinger Feedback 5 04-20-2011 04:24 PM
Calibre 7.36 Author Fields in Tag Browser is weird dfad1469 Library Management 44 01-24-2011 04:47 AM
Tag Browser partitioning dasimser Calibre 2 01-03-2011 12:18 PM
Empty tag browser Rachel Calibre 18 07-26-2010 11:42 AM


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


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