Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 12-02-2014, 11:16 AM   #1
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
Running calibre-server with auto add

If I'm running two instances of calibre-server (on a mac), how do I tell two different libraries to look at two different auto add directories, respectively. I have one book library, and then a different pdf library that I want to keep separate. I would like each library to have their own auto add directory. Is this possible? Thanks! Just starting with calibre, so lots to learn.
Hiryu is offline   Reply With Quote
Old 12-02-2014, 09:19 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Auto-add is handled by the calibre GUI (like, the main program) not the server.

If you want to run the GUI unattended in a scipted manner just to auto-add books, you can also simply use:
Code:
calibredb add --with-library=/path/to/library/ --recurse /path/to/scripted/add/folder/
Repeat as needed, with whatever combinations of libraries and add folders.

Alternatively, you can specify the environment variable "CALIBRE_CONFIG_DIRECTORY" and start the GUI and manually configure auto-add folders and default library for each config_dir, then script it to start up and shutdown at regular intervals... but I prefer my method above.

Yep, there's lots of cool stuff you can do via the command-line, in the finest unix tradition you can do practically everything with fine-grained control using the cli.
For even more options, see: http://manual.calibre-ebook.com/gene...cli-index.html and the calibredb command particularly.

Welcome to MobileRead, and welcome to calibre.
eschwartz is offline   Reply With Quote
Advert
Old 12-04-2014, 07:06 PM   #3
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
Thank you so much. I am also unfamiliar with syntax for CLI commands. I'm running calibre on a Mac, would it be any different? I've seen people use = and " and [ to encapsulate the path...not sure what is correct. using = as you posted, my shell script hangs when i try to run it. using " i don't see anything happening in terms of auto add when i put files in the designated autoadd folder (in dropbox)

I've written two shell scripts so that it can run on start.

First one is:
/Applications/calibre.app/Contents/MacOS/calibredb add --with-library "/Volumes/Ministack/Calibre Library" --recurse "/Users/Dropbox/Books/"

Second one is:
/Applications/calibre.app/Contents/MacOS/calibre-server -p 2700 --with-library "/Volumes/Ministack/Calibre Library" --restriction general --daemonize


Is my logic correct, or am I missing something here? thank you again, and thanks for the quick response! looking for some more advice here.
Hiryu is offline   Reply With Quote
Old 12-04-2014, 07:14 PM   #4
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Wrong path to the command-line tools. It is a real pity that you cannot install them to the path anymore...

Code:
/Applications/calibre.app/Contents/console.app/Contents/MacOS/calibredb add --with-library="/Volumes/Ministack/Calibre Library" --recurse "/Users/Dropbox/Books/"
The equals sign signifies that the parameter value follows, and the quotes captures paths with spaces -- you use both.
eschwartz is offline   Reply With Quote
Old 12-04-2014, 07:23 PM   #5
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
wow thanks -- so this should work?

/Applications/calibre.app/Contents/console.app/Contents/MacOS/calibredb add --with-library "/Volumes/Ministack/Calibre Library" --recurse "/Users/Dropbox/Books/"

[setting the auto folder for the books library]

/Applications/calibre.app/Contents/MacOS/calibre-server -p 2700 --with-library "/Volumes/Ministack/Calibre Library" --restriction general --daemonize

[running the calibre server on port 2700] (and that the auto add folder has already been set above.


OR do I have to use /Applications/calibre.app/Contents/console.app/Contents/MacOS/calibre-server

to run the server from CLI as well?


Thank you truly, from a non-programmer, just trying to work my way through the logic.
Hiryu is offline   Reply With Quote
Advert
Old 12-04-2014, 07:48 PM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
All the command-line tools need to be run from the modified location I showed you.

If you check the calibre manual, it specifies that on the cli-index, as well as detailing all the options.

And sure, any time.
eschwartz is offline   Reply With Quote
Old 12-04-2014, 09:26 PM   #7
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
thanks for the tips -- I think I got it working, but can't be sure. If I don't have calibre GUI running, and I can still access the content server (from an app on my tablet or phone), I assume that I at least got the server to run through CLI! Yay for that.

As for the auto add CLI command recurse, is there a modifier or additional command to tell it to delete the books once added? I think that option is in the GUI version, and was wondering how I do that with CLI -- I looked around the manual but couldn't find it...maybe I'm just not seeing it. Thank you!
Hiryu is offline   Reply With Quote
Old 12-04-2014, 10:21 PM   #8
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Hiryu View Post
thanks for the tips -- I think I got it working, but can't be sure. If I don't have calibre GUI running, and I can still access the content server (from an app on my tablet or phone), I assume that I at least got the server to run through CLI! Yay for that.
Yes, if the server is running when the GUI isn't, the only thing that can activate it is the CLI version.

Quote:
As for the auto add CLI command recurse, is there a modifier or additional command to tell it to delete the books once added? I think that option is in the GUI version, and was wondering how I do that with CLI -- I looked around the manual but couldn't find it...maybe I'm just not seeing it. Thank you!
That option is only for Auto-add, not for the Add books selector which this command imitates.

If the books are in a dedicated holding folder, you can simply use bog-standard
Code:
rm -r /path/to/nuked/folder/
but do be careful since you don't get a do-over!
It removes everything, whether you meant to ask it to or not.
eschwartz is offline   Reply With Quote
Old 12-04-2014, 10:56 PM   #9
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
sorry for all the newbie questions. i'm a little confused. the --recurse command adds the books but isn't the auto-add command from the GUI? is there a command for the auto-add feature in CLI?

I guess, in the end if it adds all the books from the specified path, it's the same thing. The path I'm using is a temporary holding folder in dropbox, so overtime a book gets dropped there, I want calibre cli to add the books, delete them the dropbox folder, and have it show up on calibreserver pointing to the respective port.

how would i amend the script?

/Applications/calibre.app/Contents/console.app/Contents/MacOS/calibredb add --with-library="/Volumes/Ministack/Calibre Library" --recurse "/Users/IS/Dropbox/Reading Books/" rm -r "/Users/IS/Dropbox/Reading Books/"

I'm asking because I don't want to put in something and have my entire Dropbox directory deleted!
Hiryu is offline   Reply With Quote
Old 12-04-2014, 11:00 PM   #10
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
There is NO cli equivalent to auto-add. calibredb add is the cli for the Add books icon on the toolbar, which is a manual operation that does not delete books after adding.


Just put both commands on separate lines, they will be invoked as separate commands.

Code:
/Applications/calibre.app/Contents/console.app/Contents/MacOS/calibredb add --with-library=/Volumes/Ministack/Calibre\ Library --recurse /Users/IS/Dropbox/Reading\ Books/
rm -r /Users/IS/Dropbox/Reading\ Books/*
It will remove all files from the given folder, regardless of whether they are ebooks or whether they have been added to calibre -- although the previous command implies that it has been added.

Last edited by eschwartz; 12-05-2014 at 12:18 AM. Reason: only delete contents of folder, not folder itself
eschwartz is offline   Reply With Quote
Old 12-04-2014, 11:02 PM   #11
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
thanks so much -- will try it now
Hiryu is offline   Reply With Quote
Old 12-04-2014, 11:07 PM   #12
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
yeah -- it deleted the whole folder, how do i make it just delete the files inside the folder but keep the parent folder there?
Hiryu is offline   Reply With Quote
Old 12-04-2014, 11:29 PM   #13
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Hiryu View Post
yeah -- it deleted the whole folder, how do i make it just delete the files inside the folder but keep the parent folder there?
I've edited my previous post to do that instead. See above.
eschwartz is offline   Reply With Quote
Old 12-04-2014, 11:49 PM   #14
Hiryu
Member
Hiryu began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Dec 2014
Device: iOS
automator kicks back an error that says rm /path/*: No such file or directory (1)

??? so close

would it be *.*?
Hiryu is offline   Reply With Quote
Old 12-04-2014, 11:57 PM   #15
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Are there currently any files in there? The wildcard should match all, including the dot...

That error says there are no files to delete.
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Auto Add james14 Library Management 10 05-31-2014 02:49 AM
[How To] Running Calibre server as a news server sws Related Tools 0 04-09-2013 08:27 AM
Running Calibre on Server godlich Recipes 2 02-09-2012 12:57 PM
Add a book from another computer running calibre server gandor62 Library Management 2 06-29-2011 11:24 AM
Trouble running calibre-server ould Calibre 0 04-16-2010 02:18 PM


All times are GMT -4. The time now is 08:59 PM.


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