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

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-09-2017, 07:43 AM   #1
Alaa
Junior Member
Alaa began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2017
Device: kindle
Column to show mags. that are NOT in any virtual Libraries

Hi,

I have a large collection of magazines.
I created several virtual libraries with search expressions to classify them.

I would like to create a custom column to show all the magazines that have NOT been included in any virtual libraries.This way I can add the search expressions to the appropriate virtual library.

Anybody know how to do that?

Please bear in mind that I am a beginner at Calibre. Thanks!
Alaa is offline   Reply With Quote
Old 03-09-2017, 08:13 AM   #2
higgs
Connoisseur
higgs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicinghiggs causes much rejoicing
 
higgs's Avatar
 
Posts: 68
Karma: 149999
Join Date: Aug 2008
Location: Ireland
Device: Kobo Mini, Kindle PW3
This might help;
https://www.mobileread.com/forums/sh...d.php?t=282127
higgs is offline   Reply With Quote
Advert
Old 03-10-2017, 01:07 AM   #3
Alaa
Junior Member
Alaa began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2017
Device: kindle
Thanks! I'll try that...
Alaa is offline   Reply With Quote
Old 03-10-2017, 01:40 AM   #4
Alaa
Junior Member
Alaa began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2017
Device: kindle
Ok I tried the instructions given in the above link and , like Thinkblot, I had the same error "maximum recursion depth exceeded..."
Then like him I also tried creating the column , but this time as"column built from other columns" (without the "behaves like tags" part)
Now I get this error: "This function can be used only in the GUI".

Interestingly, in both times, the first magazine show up correctly and the column displays teh name of the virtual library that it's in. All the following magazines give the same error.

Question : I used the lookup name: virtlibs.
Is this correct? can I try something else?
Alaa is offline   Reply With Quote
Old 03-10-2017, 02:54 AM   #5
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,452
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Alaa View Post
Ok I tried the instructions given in the above link and , like Thinkblot, I had the same error "maximum recursion depth exceeded..."
Then like him I also tried creating the column , but this time as"column built from other columns" (without the "behaves like tags" part)
Now I get this error: "This function can be used only in the GUI".

Interestingly, in both times, the first magazine show up correctly and the column displays teh name of the virtual library that it's in. All the following magazines give the same error.

Question : I used the lookup name: virtlibs.
Is this correct? can I try something else?
I get the "maximum recursion depth exceeded" error too

I created a 'Has Location' VL based on presence of value in a long text column - #location/Location. If I F2 in the Location column and do nothing (including leaving it empty) the error goes away for that book.

I switched to another library and back to my test library and no errors

Try that, or stop/start calibre.

BR
BetterRed is offline   Reply With Quote
Advert
Old 03-11-2017, 11:49 AM   #6
Alaa
Junior Member
Alaa began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2017
Device: kindle
Hi ,
Thanks for your help, it looks like you have a solution.
However , being a complete beginner at this I will need more of your help.
Could you describe your steps in more detail?

I think I understand that you created a virtual library and called it "Has Location" . Did you then use #location/Location as the search term?
If I do that I get a warning that there are no results in that column...

sorry but I need more info on how you did that.
thanks!
Alaa is offline   Reply With Quote
Old 03-11-2017, 03:29 PM   #7
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,452
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Alaa - No problems, I'll use screen shots so we get the ducks lined up right on the pond.

This is my Location column definition

Click image for larger version

Name:	1 location.jpg
Views:	77
Size:	27.6 KB
ID:	155586

This is my Virtual Libraries column definition

Click image for larger version

Name:	2 virtlibs.jpg
Views:	83
Size:	29.4 KB
ID:	155587

This is my Has Location virtual library definition

Click image for larger version

Name:	3 haslocation.jpg
Views:	74
Size:	55.3 KB
ID:	155588

This is my list of columns that get shown in the book list

Click image for larger version

Name:	4 booklistcolumns.jpg
Views:	72
Size:	106.2 KB
ID:	155589

And this is the result - after a library switch or stop start to get rid of the error messages.

Click image for larger version

Name:	5 booklist result.jpg
Views:	71
Size:	172.7 KB
ID:	155590

Those spurious error messages should be reported as a bug at Bugs : calibre. Would be better if you did that, because you have it on a real library, whereas mine is on my kitchen sink test library. Include a link to this threat in the post.

BR
BetterRed is offline   Reply With Quote
Old 03-11-2017, 09:39 PM   #8
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,452
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Alaa - don't worry about reporting the 'bug', I took it up with chaley in this thread ==>> Problem with template functions and library maintenance

@chaley - I did some tests on an fresh empty library and I could not reproduce the TEMPLATE ERROR... I saw previously. Happy to write that down to me not doing a restart when I should have done, or using a much abused library

But I did find an anomaly that could be related. Here is a blow-by-blow script of what I did (twice - i.e. it's repeatable)

Code:
create two custom columns - 
	#first_location/First Location, 
             Long text . . . 
             header on the side,
             HTML
	#second_location/Second Location, 
             Long text . . . 
             header on the side, 
             HTML
	Apply and Restart
create two virtual libraries
	Has First Loc, #first_location:true
	Has Second Loc, #second_location:true 
create two custom columns (to test if tags-like was relevant - it seems not) 
	#virtlibs_like_tags/Virtual Lib Like Tags, 
		column built from other columns, behaves like Tags, 
		Sort/search column by Text, 
		Show in tags browser: unchecked, 
		Show as HTML in book details unchecked 
	#virtlibs_not_tags/Virtual Lib Not Tags, 
		column built from other columns, 
		Sort/search column by Text, 
		Show in tags browser: unchecked, 
		Show as HTML in book details unchecked 
		Apply and Restart
Put some data in First Location and Second Location- everything OK, the two VL columns were updated dynamically and no TEMPLATE Error... msgs.

Added a Third Location, same as First and Second, Put some HTML values into Third Location.

Added another VL - Has Third Loc, books with a Third Location appeared in the VL. However the Virtual Libs columns didn't update to show the Has Third Loc VL . . . until I did a restart

But once I'd done a restart. the Virt Lib columns updated dynamically.

Looks to me if as the template {:'virtual_libraries()'} is only evaluated (goes looking for VLs) when a library is opened. Ideally I guess it should refresh if a VL is added, edited, or removed, or less ideally any VL add/edit/remove should ask for a restart a'la custom columns...

Hope this makes sense

BR

Last edited by BetterRed; 03-12-2017 at 05:33 AM.
BetterRed is offline   Reply With Quote
Old 03-12-2017, 07:21 AM   #9
Alaa
Junior Member
Alaa began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2017
Device: kindle
Hi thanks for your amazing help and patience with the step by step instructions and screenshots.
I did exactly as you describe but sadly I 'm still getting teh same result - see image 1.
Attached Thumbnails
Click image for larger version

Name:	Capture1.JPG
Views:	71
Size:	37.9 KB
ID:	155601   Click image for larger version

Name:	Capture2.JPG
Views:	73
Size:	101.2 KB
ID:	155602   Click image for larger version

Name:	Capture3.JPG
Views:	81
Size:	55.9 KB
ID:	155603  
Alaa is offline   Reply With Quote
Old 03-12-2017, 02:12 PM   #10
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,452
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Alaa - does it fix itself if you do a restart (Ctrl+R)?

Clearly, there is something not quite right here, but chaley, the template and virtual library aficionado, is now aware of it. So hopefully between your posts and mine he will have enough information to figure out what's happening and fix it

for the screen shots, they're just as useful to 'responders', as ours are for the 'originators'

BR
BetterRed is offline   Reply With Quote
Old 03-12-2017, 05:49 PM   #11
chaley
CC Android & calibre dev
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: 8,709
Karma: 2655880
Join Date: Jan 2010
Location: France
Device: Many android devices
Quote:
Originally Posted by Alaa View Post
Hi thanks for your amazing help and patience with the step by step instructions and screenshots.
I did exactly as you describe but sadly I 'm still getting teh same result - see image 1.
I cannot reproduce this problem. I created a new empty library, copied some books to it, added the two columns, created virtual libraries based on the contents of #location, and it worked.

I might be able to figure out what is happening if you send me a (zipped) copy of your metadata.db file. If you are willing then send it to calibre_bugs [AT] charles [DOT] haleys [DOT] org (make the obvious substitutions). Don't send any books. The metadata.db file is in the top-level calibre library folder.
chaley is offline   Reply With Quote
Old 03-12-2017, 06:05 PM   #12
chaley
CC Android & calibre dev
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: 8,709
Karma: 2655880
Join Date: Jan 2010
Location: France
Device: Many android devices
@BR: I have duplicated not having the VL column updating. I am not sure I can fix it with acceptable performance. The problem is that changes to VL structure do not invalidate any data for the books, meaning that the info shown by the VL column is not repainted. The not-invalidated behavior is reasonable given that VLs are in fact not book data. I would need to somehow force a global repaint whenever the VL structure changes, which would be *very* slow.

Restarting calibre forces the recomputation, as does changing any data in the book. Selecting a book, choosing Edit Metadata, then pressing OK without making any changes refreshes the column. So does selecting multiple books (e.g., all of them), choosing edit metadata multiple, making no changes, then pressing OK.

It is worth noting that the virtual_libraries() formatter function can be *exceedingly* slow if there are a lot of VLs. How many a "lot" is depends on memory and book count. The problem is that if there are a "lot" then some will fall out of calibre's VL cache. If this happens then the VLs must be recomputed from scratch for each book. Sad.

For amusement, for some time I have been working on a "library closed" plugin that will update a tags-like column with all the virtual libraries "containing" a book. This is *much* higher performance because the computations are done once, can be optimized, and doesn't use the cache. Of course, the downside is that the answer (the content of the updated column) is wrong until the library is closed and opened again if the VL structure changes or if metadata affecting VLs changes.
chaley is offline   Reply With Quote
Old 03-12-2017, 07:14 PM   #13
BetterRed
null operator
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 10,452
Karma: 10563064
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@chaley - that confirms my deductions. Speaking for myself only, I can easily live with workarounds like 'do a restart'. For the benefit of others, the VL list for an individual book can also be refreshed via F2 (metadata edit) in any editable column

I only have half a dozen VL's in my biggest library, the other libraries no more than four. I don't actually use a Virtual Libraries column, I was only verifying Alaa's result. But no matter what I do, I cannot replicate any errors on the fresh library I created yesterday. This morning I tried removing one of the 3 virtual libraries columns, and adding it back with same names etc - no ill effects.

Would it help if I sent you my kitchen sink test library, where I did get the error?

BR
BetterRed is offline   Reply With Quote
Reply

Tags
column, custom, library, virtual

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Column to display Virtual Libraries thinkblot Library Management 2 12-28-2016 02:09 PM
IF statement in virtual libraries sbin Library Management 5 11-01-2016 05:34 AM
Virtual Libraries scottmc Library Management 0 08-13-2014 07:15 PM
Virtual Libraries Ortep Library Management 68 12-21-2013 04:23 AM
Virtual Libraries - web? soundsfromsound Calibre 20 08-16-2013 02:15 PM


All times are GMT -4. The time now is 06:54 PM.


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