![]() |
#1 |
Enthusiast
![]() 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 |
![]() |
![]() |
#2 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 283
Karma: 182106
Join Date: Aug 2010
Device: Icarus8, Kindle DXG
|
Personally, I use Dropbox. Much easier.
|
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 26
Karma: 10
Join Date: Jun 2010
Device: Ipad
|
|
![]() |
![]() |
#4 | |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
Stick the calibre synced folder in the Dropbox Public folder, and you don't need the content server. |
|
![]() |
![]() |
#5 |
Enthusiast
![]() Posts: 26
Karma: 10
Join Date: Jun 2010
Device: Ipad
|
i thought about that but i thought this solution was better
|
![]() |
Advert | |
|
![]() |
|
![]() |
||||
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 |