07-26-2013, 02:20 PM | #16 |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
One way to do this is to "create" the library, copy the existing metadata.db to that library (but not the books themselves), then use the command line to delete all the books in the db.
|
07-26-2013, 02:58 PM | #17 | |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
do you mean create the folder for the 'new' library?
Quote:
I will do it again, when I get back to my main calibre system 2 mora. If the from_library contains a metadata_db_prefs_backup.json should I also copy it to the to_library along with the empty metadata.db - I didn't do that on the test library I used. BR |
|
07-26-2013, 04:37 PM | #18 | ||
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
yes.
Quote:
Quote:
|
||
07-26-2013, 07:53 PM | #19 | |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
However I was in a hurry, so it's more likely it was my fat thumb stuck in the pie, will try again later today. BR |
|
07-27-2013, 04:40 AM | #20 | |
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
That said, this method is very slow. It tries to delete each of the "books" in the range, failing for most of them. It would be better to get a list of IDs in the DB and delete those. However ... I discovered that it wasn't possible to get calibredb to give you a list of only ids. I submitted a fix for that as well. Assuming Kovid accepts it, you will be able to say --fields="" to show only the ids. You would then take that output and feed it into calibredb remove, perhaps something like this on a *nix box calibredb remove `calibredb list --fields=""` |
|
07-27-2013, 05:36 AM | #21 | |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
I gave you the wrong steer before, that error I mentioned was something else that I already solved - it was my error I've not used the calibredb command before. The copy of the test database I'm using is at "C:\_Sandpit\metadata.db" Where do I put the database path in the "calibredb remove ids" command. I tried putting the db path before 'remove' and after 'ids' Could you spell it out in a code box so that I can cut and paste please - assume I want to remove books 1-10 BR ps: I am not too bothered by how long it runs, it will be in a shutdown script. Last edited by BetterRed; 07-27-2013 at 05:40 AM. |
|
07-27-2013, 02:22 PM | #22 | |||
Grand Sorcerer
Posts: 11,740
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
Code:
calibredb remove 1-51 --library-path="D:\CBH_Data\calibre.git\Library.test_small" Quote:
|
|||
07-27-2013, 10:09 PM | #23 | |||
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Quote:
Quote:
However I anticipated my original question How to Create New Library from Existing Library at the Command Line would have had a straightforward answer - you do it like this or there is no way to do that. I need to revisit why I asked the question and see if I can achieve what I want via a different route. Whilst I cringe when I think of Autoit (it upsets my puritanical mores) it's looking to be the best option. Isolating the Copy Structure from Library code into a CLI utility may have a limited lifetime given that Kovid is working on a new database schema. Thanks for your suggestions, if nothing else our discussion did allow you to detect a defect which is a plus. BR Last edited by BetterRed; 07-27-2013 at 10:30 PM. |
|||
07-27-2013, 10:18 PM | #24 |
Grand Sorcerer
Posts: 12,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Why not just make one new library in the GUI and save it as a template?
Then possibly all you need to do is to create a new directory and copy the template metadata.db into the new directory? |
07-27-2013, 11:21 PM | #25 | |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
That's what I do now mate. When I change library specific preferences or create a new VL or something like that, then I need to create a new template; but in the 'heat of the moment' I often forget to do that. Also I don't want the templates to be visible in Calibre until I really need them to effect a repair, so after creating fresh templates I then remove them from Calibre. I then I have to explain to those who look over my shoulder why I just did that So what I want to do is to automate the creation of fresh templates as part of my end-of-day process. I don't care if they are the same as yesterday's, at least when tomorrow comes I will know they are up to date as at the end of the new yesterday . If I have a disaster I want to be able to rebuild the Calibre libraries from the raw materials that I keep on my FTP server space. The templates are a part of that raw material inventory. And Calibre is a fraction of the data I would want to to rebuild in the event of disaster. I should have stated what I was trying to do in the first instance, but given the responses I got to a 17 word sentence, I suspect another couple of sentences would only added to the confusion. Cheers BR |
|
07-27-2013, 11:34 PM | #26 |
Grand Sorcerer
Posts: 12,166
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Ah well Just wasn't sure you had thought of the simple solution
|
07-28-2013, 12:15 AM | #27 |
creator of calibre
Posts: 43,853
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
07-28-2013, 12:17 AM | #28 |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
|
07-28-2013, 12:26 AM | #29 | |
null operator (he/him)
Posts: 20,567
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thinking About a kindle - But What Of My Existing Library | Doc333 | General Discussions | 50 | 04-28-2012 08:41 PM |
Is there an easy way to replicate an existing library structure? | PatNY | Library Management | 4 | 01-07-2012 01:50 PM |
Pre-existing kindle library: best practice? | kindletim | Library Management | 1 | 08-20-2011 03:50 PM |
[Old Thread] import library or export to single file add to existing library | PCreighton | Calibre | 4 | 04-10-2011 01:08 AM |
Used 505 to existing library sync error | shrktank | Sony Reader | 2 | 11-07-2009 01:10 PM |