MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Library Management (https://www.mobileread.com/forums/forumdisplay.php?f=236)
-   -   How Do I Refresh Calibre ID Numbers? (https://www.mobileread.com/forums/showthread.php?t=233323)

usr 02-08-2014 02:12 PM

How Do I Refresh Calibre ID Numbers?
 
So, as part of the set-in-stone directory and file naming scheme (the reasoning for which, by the way, I don't buy) Calibre includes its "id number" at the end of the directories. If you have to remove a book, and later add more, the numbers continue to increase (leaving gaps).

How can I get Calibre to refresh these ids? It seems this functionality would be a basic element of library maintenance...no?

Thanks for the help!

itimpi 02-08-2014 02:24 PM

The id numbers are never re-used so it is normal to have gaps. The numbers actually relate to Id's internal to the database structure and it is typical of databases to never re-use them.

In normal use most users never worry about the Id values - is there some reason they concern you.

unboggling 02-08-2014 02:37 PM

Quote:

Originally Posted by usr (Post 2759172)
How can I get Calibre to refresh these ids? It seems this functionality would be a basic element of library maintenance...no?

I don't worry about it. But to refresh all library-unique ID numbers, under library icon switch/create library, create an empty library at the new location with option checked to copy structure from current library. Switch back to old library. Select all books and Copy to Library into the new library. Voila, the new library's books are all ID numbered consecutively without gaps. Now remove the old library from calibre, then in the file system delete the old library's library folder.

But, as itimpi implied, why bother? You shouldn't be messing around inside the Library folder anyway. See: Want to change the folder structure of the Calibre library?, sticky by Manichean, spoiler content by Worldwalker.

usr 02-08-2014 02:46 PM

Hmmm...I imagine it's a combination of me (at the moment) having to do a lot of combining the same book in multiple formats (I don't like converting, I like having the retails of whatever formats I can get) and the fact that I'm a bit OCD (so it's driving me crazy that the numbers would indicate I have thrice the number of books I actually have).

By the way, I know that's the purpose of the id numbers, but iterating over the books and adjusting the id numbers as part of database maintenance would in no way harm their functionality as ids. If anything, it would optimize it because some functions (I'm sure) would iterate over id numbers sequentially. So, for every id number without a corresponding entry Calibre would have to identify the situation and move to the next number.

theducks 02-08-2014 02:50 PM

Another voice:

{ID} is just for bookkeeping (ooo, a pun :p )

You may need ID if you are using the CLI. The CLI also has tools to return the ID from other CLI activities so there is little reason to actually be IN the folder.

You may want ID for device file (duplicate?) management

Calibre reports 2books on device, having {ID} at the end of the template may help.

As for Gaps, so what. This is not {Series_index}, where a gap means another book to buy :rolleyes:

DoctorOhh 02-09-2014 02:51 AM

Quote:

Originally Posted by usr (Post 2759187)
Hmmm...I imagine it's a combination of me (at the moment) having to do a lot of combining the same book in multiple formats (I don't like converting, I like having the retails of whatever formats I can get) and the fact that I'm a bit OCD (so it's driving me crazy that the numbers would indicate I have thrice the number of books I actually have).

It may be driving you crazy, but as indicated the numbers have no correlation to the total amount of books in your library and do not indicate you have any particular number of books. Obviously you have a need that I do not. In four years of using calibre the need to look at these numbers has never come up.

Quote:

Originally Posted by usr (Post 2759187)
By the way, I know that's the purpose of the id numbers, but iterating over the books and adjusting the id numbers as part of database maintenance would in no way harm their functionality as ids.

Doing this very probably would cause books on the device to no longer match books in the library.

Quote:

Originally Posted by usr (Post 2759187)
If anything, it would optimize it because some functions (I'm sure) would iterate over id numbers sequentially. So, for every id number without a corresponding entry Calibre would have to identify the situation and move to the next number.

I doubt there would be anything to gain since the numbers are simply unique identifiers and most likely treated as strings.

LadyKate 02-09-2014 08:35 AM

Funny how the directory structure bugs almost every new user of Calibre.

For me it kept me from really "USING" Calibre as more than a conversion program.

Once you buy into the idea that Calibre is primarily a database that contains ebooks as part of it's record and that the directory structure is the database itself it becomes easier to ignore that directory entirely.

I tend to complete the quality checking and corrections of the books, title, author name, tags etc and then use modify epub to write the new metadata into the epub. To read the books I then do a save to disk to a library location (double checking the directories of dual author titles) and organize that directory to be copied to a micro sd to use on my tablet.

By doing this I can indulge my ocd about the library while leaving the "database" alone. As for it taking more disk space, well I just picked up a new 4TB usb drive for 160.00 cdn and you really need a backup or three of an important library to be safe.

theducks 02-09-2014 12:58 PM

If you want to KNOW how many books(titles) you have.
Look at the Status Line in the GUI.
This will even show the amount of the whole when using a VL
[2129 books, 1 selected, 4901 total]

BetterRed 02-09-2014 05:09 PM

:offtopic: - as well as the integer book id, I think calibre also assigns a UUID to each book, which is written as a ID in the opf that is embedded into EPUBs at least - you can see the value if you press 'I' on a book

Just out of curiosity what is it for?

BR

eschwartz 02-09-2014 05:11 PM

Quote:

Originally Posted by BetterRed (Post 2760104)
:offtopic: - as well as the integer book id, I think calibre also assigns a UUID to each book, which is written as a ID in the opf that is embedded into EPUBs at least - you can see the value if you press 'I' on a book

Just out of curiosity what is it for?

BR

Matching books on your device, I believe.

Terisa de morgan 02-09-2014 05:34 PM

I've looked at this thread because of a reason which is not related to OCD but future problems: which is the maximum id? If it's more that 2^32 or 2^64, I can forget it, I'll never reach it in my life. If it isn't, it can be a problem when the id reaches its limits.

itimpi 02-09-2014 05:36 PM

It will be at least 2^32, and may well be 2^64 - I cannot remember off-hand which it is.

BetterRed 02-09-2014 05:44 PM

Quote:

Originally Posted by eschwartz (Post 2760109)
Matching books on your device, I believe.

That's what I had sort of assumed until I saw the following from DoctorOhh in respect of 'resequencing' the id column in all the books (as suggested by this threads OP)

Quote:

Originally Posted by DoctorOhh (Post 2759572)
Doing this very probably would cause books on the device to no longer match books in the library.

I cant recall under what circumstances, but an existing book can get a new value in its id column, but its UUID remains unchanged, thats what made me think the UUID was the synching link.

I only keep what I'm reading on my device so I don't use calibre synching. I copy other things to it with my file manager so why not copy books.

BR

Terisa de morgan 02-09-2014 05:46 PM

Quote:

Originally Posted by itimpi (Post 2760131)
It will be at least 2^32, and may well be 2^64 - I cannot remember off-hand which it is.

Thank you.

BetterRed 02-09-2014 05:54 PM

Quote:

Originally Posted by itimpi (Post 2760131)
It will be at least 2^32, and may well be 2^64 - I cannot remember off-hand which it is.

If calibre uses SQLite2 and book.id is an INTEGER PRIMARY KEY then I think its maximum value is 2,147,483,647 = see https://www.sqlite.org/datatypes.html

A 2 billion book calibre library - nuh, not in all our lifetimes laid end to end :rofl:

BR


All times are GMT -4. The time now is 06:09 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.