Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 03-12-2014, 11:16 AM   #1
scooterfrog
Enthusiast
scooterfrog began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Jun 2010
Device: Ipad
sync calibre libraries between 2 computers WIN

I saw this asked numers of times and sawhintes athow to do but i didnt see it solved.
here is my use case
2 computers windows on the same network
2 copies of the library files
on computer makes edits to library, adds books etc
oine computer serves via command line calibre-server
book files backed up / synced via allwaysync

solution steps
check if the master calibre db is newer than the server file
if it is older do nothing
if it newer kill calibre server(s) or calibre gui
copy file
restart server

here is my solution in vbs
Code:
' use this program to keep 2 calibre libraries db files in sync.  the librariy should be synced by so other method
' I used allwaysync

Const OverwriteExisting = TRUE
Dim objShell
dim objFSO
dim MasterFile 
dim ServerFile
 
Set objShell = WScript.CreateObject( "WScript.Shell" )
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set MasterFile = objFSO.GetFile("\\FREEDMANZOO\Users\zookeeper\Documents\Calibre Library\metadata.db")
Set ServerFile = objFSO.GetFile("\\TOASTER\Backup\zookeeper.bk\Documents\Calibre Library\metadata.db")

dtmMasterDate = MasterFile.DateLastModified
dtmServerDate = ServerFile.DateLastModified

If dtmMasterDate > dtmServerDate Then
'kill all processes with clibre in the name aon the computer withthe ip address
	strComputer = "192.168.0.125" 	
	StrProcessName = "calibre"
	'x= msgbox ("out of sync Master:" & dtmMasterDate & " > Server: " & strComputer & "  File: " & dtmServerDate)
	strComputer = "192.168.0.125" 	
	StrProcessName = "calibre"
	fct_KillProcess strProcessName, strComputer 
' copy the file
    objFSO.CopyFile  MasterFile.Path, ServerFile.Path, OverwriteExisting
'restart the server hidden .  you could restart more than one server by adding ne lines
	x= objShell.run ("""C:\Program Files (x86)\Calibre2\calibre-server.exe""", 0, false)
	Set objShell = Nothing
else
	'x= msgbox ("Server DB is up to date")
End If

Public Function fct_KillProcess(strProcessName, strComputer) 
		Dim objWMI 
		Dim colServices 
		Dim objService 
		Dim strServicename 
		Dim ret 

		Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
		Set colServices = objWMI.InstancesOf("win32_process") 

		For Each objService In colServices 
			strServicename = LCase(Trim(CStr(objService.Name) & "")) 
			If InStr(1, strServicename, LCase(strProcessName), vbTextCompare) > 0 Then 
				ret = objService.Terminate 
			End If 
		Next 
		Set colServices = Nothing 
		Set objWMI = Nothing 
End Function
scooterfrog is offline  
Old 03-14-2014, 05:34 AM   #2
ST-One
Addict
ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.ST-One can program the VCR without an owner's manual.
 
ST-One's Avatar
 
Posts: 283
Karma: 182106
Join Date: Aug 2010
Device: Icarus8, Kindle DXG
Personally, I use Dropbox. Much easier.
ST-One is offline  
Advert
Old 03-18-2014, 03:44 PM   #3
scooterfrog
Enthusiast
scooterfrog began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Jun 2010
Device: Ipad
Quote:
Originally Posted by ST-One View Post
Personally, I use Dropbox. Much easier.
but that wont allow you to leave the content server running because i locks the file.

thats what i was trying to solve.
scooterfrog is offline  
Old 03-18-2014, 04:08 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: 85400180
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 scooterfrog View Post
but that wont allow you to leave the content server running because i locks the file.

thats what i was trying to solve.
You could do this: http://calibre2opds.com

Stick the calibre synced folder in the Dropbox Public folder, and you don't need the content server.
eschwartz is offline  
Old 03-21-2014, 09:21 AM   #5
scooterfrog
Enthusiast
scooterfrog began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Jun 2010
Device: Ipad
i thought about that but i thought this solution was better
scooterfrog is offline  
Advert
Closed Thread


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
keeping 2 calibre libraries in sync benkay Library Management 2 09-03-2013 04:22 PM
Different libraries on 2 computers - how to merge? Statch Calibre 4 09-02-2013 04:34 PM
Syncing Calibre Libraries between two computers timmmccoy Related Tools 2 08-13-2012 10:11 AM
[Q] Calibre settings sync between computers using dropbox Dopedangel Related Tools 8 12-21-2010 07:44 AM
Sync two calibre libraries esears Calibre 16 02-18-2010 07:39 PM


All times are GMT -4. The time now is 10:51 AM.


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