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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 07-18-2010, 07:59 AM   #16
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by chaley View Post
Get the value with db.get_custom_extra(...)
Set the value with db.set_custom(..., extra=series_index).
Thanks.

Quote:
1) your code does not remove duplicates.
Agreed - I was pointing out that all I had to do at this point was append tags in the mi (without worrying about duplicates) and let the backend fix things when I did the set_metadata(id, mi).

I was trying to figure out if your set_custom worked the same way as set_metadata (has back end that will remove dupes), and would let me do a simple append, or did I need to handle dupes here.

Quote:
There are two ways to deal with duplicates
Thanks, but it appears from your answer that I don't need to.

Also, a part of the question was about differences between get_metadata and get_custom as they related to tag-like text fields. For some reason, I was thinking that because the datatype was set as "text" for simple text fields and for tag-like fields (is_multiple) that all I would be getting for the tag-like data was a single text string, which would include all tag-like entries and their separators.

I was thinking I would have to do a split on the separator character to get them into individual tag-like entries in a list, find dupes myself, put them back into a single string with separators and pass that back.

I haven't checked yet, but from your post (and thinking about it further) I suspect I'm going to get a list when I do a get_custom for an is_multiple text field, not a string with separator characters in it.

I should have done more checking before asking.
Starson17 is offline   Reply With Quote
Old 07-18-2010, 08:35 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: 11,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Starson17 View Post
I haven't checked yet, but from your post (and thinking about it further) I suspect I'm going to get a list when I do a get_custom for an is_multiple text field, not a string with separator characters in it.
You are correct. You get a list, and you must give a list.
chaley is offline   Reply With Quote
Advert
Old 07-18-2010, 11:47 AM   #18
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Are there any cases where a datatype comments field can have a len(comments) == 0 and comments != False?

I have a test in the non-custom comments field of:

Code:
if not dest_mi.comments or len(dest_mi.comments) == 0:
I can't recall if I did this, not knowing any better, or if Kovid added it because I didn't. In Python, wouldn't the comments field always be False if its length was zero?
Starson17 is offline   Reply With Quote
Old 07-18-2010, 11:55 AM   #19
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,703
Karma: 6658935
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Starson17 View Post
Are there any cases where a datatype comments field can have a len(comments) == 0 and comments != False?

I have a test in the non-custom comments field of:

Code:
if not dest_mi.comments or len(dest_mi.comments) == 0:
I can't recall if I did this, not knowing any better, or if Kovid added it because I didn't. In Python, wouldn't the comments field always be False if its length was zero?
The python manual says:
Quote:
In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: False, None, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true.
Thus the first test will return True if the string is None or empty, and therefore obviates the need for the second.

I often use the test 'if str: to test if the string has an 'interesting' value.
chaley is offline   Reply With Quote
Old 07-19-2010, 08:06 AM   #20
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
New code to handle the User defined fields during merge was uploaded over the weekend.
Starson17 is offline   Reply With Quote
Advert
Old 07-22-2010, 10:27 AM   #21
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by Starson17 View Post
New code to handle the User defined fields during merge was uploaded over the weekend.
Fixed in branch trunk. The fix will be in the next release.
Starson17 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Losing books/formats is not normal.-Chaley theducks Calibre 7 10-02-2010 11:11 AM
Suggestion: Selecting a user-defined Category should show all of the books in it Daemon Calibre 6 08-23-2010 01:19 PM
Jobs Queue, Merging, Metadata, I think that's it.... rabidrobot Calibre 2 08-17-2010 07:31 PM
User Defined Columns jjansen Calibre 3 03-17-2010 05:33 PM
User Defined Fonts gr8npwrfl Ectaco jetBook 1 01-21-2010 08:35 AM


All times are GMT -4. The time now is 10:11 AM.


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