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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 10-23-2012, 09:39 AM   #1
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
Post 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)
It works OK. But when I update a book's string value (like title, authors or series) with same string but changing capitals, old value rest unchanged. Why?

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.
Pepin33 is offline   Reply With Quote
Old 10-24-2012, 06:06 AM   #2
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
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?
Pepin33 is offline   Reply With Quote
Advert
Old 10-24-2012, 06:09 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,795
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?
kovidgoyal is offline   Reply With Quote
Old 10-24-2012, 06:18 AM   #4
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
Quote:
Originally Posted by kovidgoyal View Post
If you are trying to change only the title why dont you use set_title instead of set_metadata?
I'm trying to change some metadata, not only the title. I'm talking about the title as example, but I'm importing some metadata from a file, son I need to change sometimes only titles, but sometimes all or parts of metadata (title, authors, series, pubdate, etc).

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.
Pepin33 is offline   Reply With Quote
Old 10-24-2012, 06:50 AM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,795
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)"
And set_metadata() just calls set_title(). So your problem is elsewhere.
kovidgoyal is offline   Reply With Quote
Advert
Old 10-24-2012, 07:27 AM   #6
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
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.
Pepin33 is offline   Reply With Quote
Old 10-24-2012, 07:45 AM   #7
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
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...
Pepin33 is offline   Reply With Quote
Old 10-29-2012, 11:48 AM   #8
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
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?
Pepin33 is offline   Reply With Quote
Old 10-31-2012, 10:23 AM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,795
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.
kovidgoyal is offline   Reply With Quote
Old 10-31-2012, 11:48 AM   #10
Pepin33
Zealot
Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.Pepin33 has a complete set of Star Wars action figures.
 
Posts: 109
Karma: 419
Join Date: Aug 2012
Location: Spain
Device: Kindle Touch
Cool

Quote:
Originally Posted by kovidgoyal View Post
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.
Ok, thanks again kovidgoyal.

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!
Pepin33 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
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


All times are GMT -4. The time now is 05:52 AM.


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