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

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader

Notices

Reply
 
Thread Tools Search this Thread
Old 10-02-2012, 03:44 AM   #1
Krytes
Member
Krytes began at the beginning.
 
Posts: 21
Karma: 24
Join Date: Jul 2008
Device: Hanlin V3, Kobo Touch
Post Script: Creating and populating shelves based on calibre tags

Here's my version of a script to create and populate Kobo Shelves (kobo touch firmware v. 2.1.1) based on my calibre tags. Feel free to tweak away to make it useful for you. Should be pretty self-explanatory.

Notes:
  • Put the script in your "Calibre Library" directory, connect the kobo, and run the script.
  • My Kobo is mounted in /media/KOBOeReader. Change pathToDB if yours isn't.
  • Works for epub and pdf. My files are non-drmed, don't know if drm would pose a problem.
  • My Calibre's set up to store files on the kobo in the format "Author name"/"Title - Author Name.epub", so, for example, Oliver Twist would be stored as "Charles Dickens/Oliver Twist - Charles Dickens.epub". Again, change the script to suit your needs.

tagger.py

Last edited by Krytes; 10-02-2012 at 03:48 AM.
Krytes is offline   Reply With Quote
Old 10-02-2012, 09:25 AM   #2
Sharkus
Addict
Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.
 
Sharkus's Avatar
 
Posts: 342
Karma: 1734079
Join Date: Jun 2010
Location: Toronto
Device: Kobo, Kobo WiFi, Kobo Touch, Kobo Aura, Kobo iOS Application
Does that set the "Name" and "InternalName" fields in the DB to the same value? My skills with python aren't that great so I'm unsure. If it does do this, great, if not, I'd suggest changing it so Name and InternalName are being set to the same value.

When testing the shelf sync on iOS we found if Name was set and InternalName was left blank, then the Touch would pick up the shelf, but on the next sync it seemed to create another shelf of the same name. We tracked it down to us not setting the InternalName as well as the Name. We looked at what Touch did and saw it set both, and once we did the same, everything worked as it should.

One other thing to note is that iOS now supports shelf sync, previously it was Touch only, and thus if you were to create shelves, manually, or via this script, then if you sync your Touch, the shelves will sync, and if you happen to have the iOS app, and it syncs then it will pull down these shelves. If the books are in your Kobo Library, ie; not side-loaded, you will see them populate in the shelves. If they are side-loaded, well, you may end up with an empty shelf.
If you delete that shelf on iOS then when you next sync the Touch the shelf will be removed as it's removed from the server.
Sharkus is offline   Reply With Quote
Old 10-02-2012, 10:18 AM   #3
taming
Trying for calm & polite
taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.taming ought to be getting tired of karma fortunes by now.
 
taming's Avatar
 
Posts: 4,005
Karma: 9455193
Join Date: May 2010
Location: Mostly in Canada
Device: kobo original, WiFI, Touch, Glo, and Aura
Watch for a Kobo driver that handles shelves in a very kewl way. It's very, very nice.
taming is offline   Reply With Quote
Old 10-02-2012, 10:25 AM   #4
davidfor
Wizard
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 4,233
Karma: 3677668
Join Date: Jul 2011
Location: Australia
Device: Kobo Touch, Kobo Glo
I'm not the author of the script, but I know something about this.

Quote:
Originally Posted by Sharkus View Post
Does that set the "Name" and "InternalName" fields in the DB to the same value? My skills with python aren't that great so I'm unsure. If it does do this, great, if not, I'd suggest changing it so Name and InternalName are being set to the same value.

When testing the shelf sync on iOS we found if Name was set and InternalName was left blank, then the Touch would pick up the shelf, but on the next sync it seemed to create another shelf of the same name. We tracked it down to us not setting the InternalName as well as the Name. We looked at what Touch did and saw it set both, and once we did the same, everything worked as it should.
"Name" and "InternalName" have to be the same value. If they aren't, the shelf can't be deleted on the Touch.

As a curiosity, are shelf names in the iOS app case sensitive? And does it allow leading or trailing blanks? On the Touch you can create "aaa", " aaa", "aaa " and "AAA". In the list you can't see the difference between the first three. And personally, I would prefer them not to be case sensitive.
Quote:
One other thing to note is that iOS now supports shelf sync, previously it was Touch only, and thus if you were to create shelves, manually, or via this script, then if you sync your Touch, the shelves will sync, and if you happen to have the iOS app, and it syncs then it will pull down these shelves. If the books are in your Kobo Library, ie; not side-loaded, you will see them populate in the shelves. If they are side-loaded, well, you may end up with an empty shelf.
A similar thing happens with the Touch if you do a sync followed by a factory reset. The shelves come back, but only the kepubs are on them.
Quote:
If you delete that shelf on iOS then when you next sync the Touch the shelf will be removed as it's removed from the server.
I don't have a second device to test with, but I am sure the same would happen if you used two Touches that were signed in to the same Kobo account.

For anyone who does use this script, or otherwise creates a lot of shelves, there is a performance issue. The performance of shelf related actions is dependent on the number of shelves and the number of books on the shelves. By this I mean that 10 shelves with 100 books on each is as bad as 100 shelves with 10 books on them. Kobo is improving this, but I find that a WiFi sync doesn't work with a lot of books on shelves.

As taming said, there will be a new driver in calibre soon. It should be in one of the next two builds. It will support shelves in a similar fashion to this script, but you can specify one or more columns to use for the shelves. So, you could specify the tags column and the series column. And it will support the Glo and Mini.

Last edited by davidfor; 10-02-2012 at 10:28 AM. Reason: slight edit because taming beat me.
davidfor is offline   Reply With Quote
Old 10-02-2012, 12:15 PM   #5
Krytes
Member
Krytes began at the beginning.
 
Posts: 21
Karma: 24
Join Date: Jul 2008
Device: Hanlin V3, Kobo Touch
Quote:
Originally Posted by Sharkus View Post
Does that set the "Name" and "InternalName" fields in the DB to the same value? My skills with python aren't that great so I'm unsure. If it does do this, great, if not, I'd suggest changing it so Name and InternalName are being set to the same value.

When testing the shelf sync on iOS we found if Name was set and InternalName was left blank, then the Touch would pick up the shelf, but on the next sync it seemed to create another shelf of the same name. We tracked it down to us not setting the InternalName as well as the Name. We looked at what Touch did and saw it set both, and once we did the same, everything worked as it should.

One other thing to note is that iOS now supports shelf sync, previously it was Touch only, and thus if you were to create shelves, manually, or via this script, then if you sync your Touch, the shelves will sync, and if you happen to have the iOS app, and it syncs then it will pull down these shelves. If the books are in your Kobo Library, ie; not side-loaded, you will see them populate in the shelves. If they are side-loaded, well, you may end up with an empty shelf.
If you delete that shelf on iOS then when you next sync the Touch the shelf will be removed as it's removed from the server.
Interesting, thanks.

Yes, Name and InternalName are set to the same thing.

I don't have any iOS devices or the Kobo app and have never synced my touch- all of my books are side-loaded via Calibre- so I haven't run into any problems. Are you saying that iOS now supports shelves so that manually created shelves behave properly with side-loaded books?
Krytes is offline   Reply With Quote
Old 10-02-2012, 12:19 PM   #6
Krytes
Member
Krytes began at the beginning.
 
Posts: 21
Karma: 24
Join Date: Jul 2008
Device: Hanlin V3, Kobo Touch
Quote:
Originally Posted by davidfor View Post
As taming said, there will be a new driver in calibre soon. It should be in one of the next two builds. It will support shelves in a similar fashion to this script, but you can specify one or more columns to use for the shelves. So, you could specify the tags column and the series column. And it will support the Glo and Mini.
Cool! Do you have any idea approximately when?
Krytes is offline   Reply With Quote
Old 10-02-2012, 01:02 PM   #7
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,092
Karma: 38639832
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Well... since there is a calibre release every week... either this Friday or next Friday!
PeterT is offline   Reply With Quote
Old 10-02-2012, 01:57 PM   #8
Sharkus
Addict
Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.Sharkus ought to be getting tired of karma fortunes by now.
 
Sharkus's Avatar
 
Posts: 342
Karma: 1734079
Join Date: Jun 2010
Location: Toronto
Device: Kobo, Kobo WiFi, Kobo Touch, Kobo Aura, Kobo iOS Application
Quote:
Originally Posted by davidfor View Post
"Name" and "InternalName" have to be the same value. If they aren't, the shelf can't be deleted on the Touch.
Quite. That is exactly what I had found when testing the sync against Touch. Took me a little while to figure out what was going on, and I dug around the database to see what Touch was doing and then we had an "Oh!" moment and fixed the problem.

Quote:
Originally Posted by davidfor View Post
As a curiosity, are shelf names in the iOS app case sensitive? And does it allow leading or trailing blanks? On the Touch you can create "aaa", " aaa", "aaa " and "AAA". In the list you can't see the difference between the first three. And personally, I would prefer them not to be case sensitive.

Shelf names on iOS are not case sensitive, e.g.; "AAA" and "aaa" are seen as the same thing.
Leading and trailing blanks are seemingly supported as well,
Sharkus is offline   Reply With Quote
Reply

Tags
calibre, shelves, tags

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating Calibre with books already on my Kobo peterbyron Kobo Reader 12 07-25-2012 03:44 AM
Exporting based on individual tags BookJunkieLI Library Management 7 02-22-2012 04:18 PM
Cleaning up tags based on content Olger Recipes 2 12-14-2011 10:56 PM
Creating TOC for books based on Text Files crich70 Kindle Formats 4 09-13-2010 12:47 AM
Software for creating image-based PDFs 301verbs Workshop 2 06-13-2009 12:51 PM


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


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