10-23-2012, 09:39 AM | #1 |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
Updating metadata with capitals
I'm trying to update some metadata fields (titles, authors and series) from a plugin.
I'm using a Metainformation object to fill the metadata, and then updating it like that: Code:
mi = Metainformation(None) mi.title = "My title" mi.authors = ["Some autor"] mi.series = "My series" self.db.set_metadata(book_id, mi) I mean for example: I have a book titled "Mi new book". If I want to change this to "Mi New Book", it doesn't work, and old value for title stays ("Mi new book", without capitals). How can I solve this? Last edited by Pepin33; 10-23-2012 at 12:26 PM. |
10-24-2012, 06:06 AM | #2 |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
Anybody knows where is the problem?
The db.set_metadata works OK when using a full different string. But if the only difference is some capital letters in the string, old value isn't changed. Is it intended? |
10-24-2012, 06:09 AM | #3 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you are trying to change only the title why dont you use set_title instead of set_metadata?
|
10-24-2012, 06:18 AM | #4 | |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
Quote:
And I don't understand why metadata fields are not changed when capital chars at the strings are changed. Last edited by Pepin33; 10-24-2012 at 06:21 AM. |
|
10-24-2012, 06:50 AM | #5 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Works for me
Code:
calibre-debug -c "from calibre.library import db; db = db(); id = list(db.all_ids())[-1]; orig = db.title(id, True); upper = orig.upper(); db.set_title(id, upper); print orig, db.title(id, True)" |
10-24-2012, 07:27 AM | #6 |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
You're right, kovidgoyal. The problem is not with titles, the problem only happens with authors and series. And it doesn't seem to be a db.setmetadata() problem, neither.
Looking at debug window, I see a "get categories: item xxx is not in series list" when trying to update the xxx serie in a book to XXX. I'll look at that. Thanks for your help, and sorry for the inconvenience. |
10-24-2012, 07:45 AM | #7 |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
And with autors, I just see set_metadata() calls _set_authors, who has a allow_case_change=False by default, so this is why it doesn't change. But it is not a way for changing this calling set_metadata function, so I suposse I must use set_authors instead...
|
10-29-2012, 11:48 AM | #8 |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
Mmmmm... I still have some problems.
I change my strategy, and instead of using db.set_metadata(), I'm using db.set_title(), db.set_authors(), db.set_series(), etc. But I still have a problem when using db.set_series(). If I update series in some books, I have some errors at debug window (get categories: item xxx is not in series list - xxx is series name). I think this errors are because I'm changing series at the metadata of a book who shares series with others books. Maybe I need to do some thing after setting series to refresh series in other books? |
10-31-2012, 10:23 AM | #9 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
set_series is sufficient, you dont need to do anything else. See for example the series editing code in library/models.py which is used by the main calibre booklist.
|
10-31-2012, 11:48 AM | #10 | |
Zealot
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
|
Quote:
If it is sufficient only using set_series(), then the problem is coming from another code. I'll look at the models.py file. Thanks again for your help! |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
KF8 Metadata not updating when sent to a KT | Wedgezilla | Calibre | 4 | 06-17-2012 01:54 PM |
Updating Metadata in Bulk | Turt99 | Calibre | 5 | 06-07-2010 03:19 PM |
Updating Metadata without and ISBN | herbycanopy | Calibre | 7 | 05-22-2010 01:16 AM |
DR800 updating metadata externally | Mr. X | iRex | 7 | 04-10-2010 12:14 PM |
Error on updating metadata in 0.6.44 | jomaweb | Calibre | 3 | 03-06-2010 12:05 PM |