Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 10-21-2012, 06:12 PM   #16
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,317
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
I'd forgotten that searches are case insensitive, so the regexp search doesn't work, sorry.

Getting and setting custom column values is pretty easy:

Code:
existing=db.get_custom(book_id,label=label,index_is_id=True)

db.set_custom(book_id, value, label=label, commit=True)
Where label is the # name, like #wordcount, or whatever you set it to.

(added) And, of course, you can use the custom column for the search instead of the regexps.

Last edited by JimmXinu; 10-21-2012 at 06:17 PM.
JimmXinu is offline   Reply With Quote
Old 10-21-2012, 06:39 PM   #17
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Quote:
Originally Posted by JimmXinu View Post
I'd forgotten that searches are case insensitive, so the regexp search doesn't work, sorry.

Getting and setting custom column values is pretty easy:

Code:
existing=db.get_custom(book_id,label=label,index_is_id=True)

db.set_custom(book_id, value, label=label, commit=True)
Where label is the # name, like #wordcount, or whatever you set it to.

(added) And, of course, you can use the custom column for the search instead of the regexps.
I've done as you suggested and also this problem seem solved.
I attach the latest version just in case it is useful to someone else (in the next few days I will try on windows and on my huge collection of about 1000 books).
Xwang
Attached Files
File Type: zip Upperize_DB.zip (11.7 KB, 224 views)
Xwang is offline   Reply With Quote
Old 10-23-2012, 01:29 PM   #18
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
I attach the newer version in which I use the string "_T[##]" as a prefix before title and author name, instead of using it at their end (I've thought that since under Windows the folder and file name can be cut with respect to the title inside metadata, it is possible that the special string is washed out creating issues).
This version works well, but their still a problem with the mixed use of linux and windows.
The problem is originated by the 256 character windows limit on complete path length.
I've discovered that using the plugin under linux, it creates a lot of book with an excessively long path.
So I wonder if it is possible to modify the plugin so that to limit the length of file and directory name maintaining the full title in the metadata.
Thank you,
Xwang
Attached Files
File Type: zip Upperize_DB.zip (11.4 KB, 230 views)

Last edited by Xwang; 10-23-2012 at 03:10 PM.
Xwang is offline   Reply With Quote
Old 10-23-2012, 03:45 PM   #19
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,317
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Quote:
Originally Posted by Xwang View Post
The problem is originated by the 256 character windows limit on complete path length.
I've discovered that using the plugin under linux, it creates a lot of book with an excessively long path.
So I wonder if it is possible to modify the plugin so that to limit the length of file and directory name maintaining the full title in the metadata.
No, there isn't, calibre doesn't allow you to control the file names directly.

But since you're already changing the title/authors, you can do other things. Replace common words/phrases with abbreviations: 'Federal Aviation Administration' with 'FAA', etc.
Code:
mi.title = mi.title.replace('Federal Aviation Administration','FAA')
You can also force them to be no more than a max length something like so:
Code:
mi.title = mi.title.replace('Federal Aviation Administration','FAA')
mi.title = mi.title[:-5][:100]
Jim
JimmXinu is offline   Reply With Quote
Old 10-23-2012, 04:01 PM   #20
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Quote:
Originally Posted by JimmXinu View Post
No, there isn't, calibre doesn't allow you to control the file names directly.

But since you're already changing the title/authors, you can do other things. Replace common words/phrases with abbreviations: 'Federal Aviation Administration' with 'FAA', etc.
Code:
mi.title = mi.title.replace('Federal Aviation Administration','FAA')
You can also force them to be no more than a max length something like so:
Code:
mi.title = mi.title.replace('Federal Aviation Administration','FAA')
mi.title = mi.title[:-5][:100]
Jim
Maybe I can add field to my db to maintain the entire title in case the original one is too long (so that to not waste info maybe useful in the future).
The check on the length of the title should be run every time the "OK" button is pushed on the metadata GUI, so that to avoid the long filename is created at all.
Is it possible to link a plugin function to such an action?
Otherwise I can create a plugin to scan for the entire library in a manner similar to this one to cut the title if necessary by saving the entire title in the additional db field.
Xwang
Xwang is offline   Reply With Quote
Old 08-07-2019, 05:09 PM   #21
Xwang
Connoisseur
Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.Xwang ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 2136220
Join Date: Sep 2012
Device: none
Sorry if I reopen this thread but I've discovered that the plugin is loaded in the newer Calibre version, but there is no possibility to add the button that is needed to run it. I'm missing something?
Xwang is offline   Reply With Quote
Old 08-07-2019, 06:03 PM   #22
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,317
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Your plugin hasn't been through the conversion to Qt5 from several years back. Here's a contemporary thread about it.
JimmXinu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access "database" from a plugin hakan42 Development 2 09-06-2012 05:35 PM
upper case to sentence case conversion cybmole Sigil 8 01-20-2011 06:03 AM
I don't like the way calibre sticks with upper-case/capital acolsandra Calibre 6 11-12-2010 11:17 AM
Update Metadata in database from Plugin DokaMax Plugins 0 05-22-2010 05:58 AM
Upper half of the screen blank tapf! Sony Reader 6 07-18-2008 02:49 AM


All times are GMT -4. The time now is 08:23 PM.


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