Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 04-01-2016, 06:06 AM   #1
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,243
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
[Library Closed Plugin] Backup configuration folder(s)

When calibre is closed this plugin makes a backup copy of the calibre configuration folder. A backup isn't made if calibre is closed before an automatic restart.

Configuration:
To configure the plugin, go to calibre's Preferences / Plugins / Library Closed plugins. Either double-click on the plugin or select this plugin and press the "Customize plugin" button, then fill in the boxes as you wish. Documentation is in the tooltips for the entry boxes.

Notes:
  • Backups are per-configuration, not per-library.
  • The plugin automatically deletes old configuration backups. Go to the plugin configuration to set the number of days to keep backups. The default is to keep all backups for 3 days then keep the last backup of the day for 10 more days.
  • If you delete the JSON configuration file for this plugin, the existing backup files won't ever be automatically deleted. If you restore your calibre configuration folder then configuration backup files made after the backup you restored won't ever be automatically deleted. From time to time you should check to see if there are unwanted backup files.
  • You must manually clean any backups made before installing version 1.0.3.
  • To restore a backup, use your favorite archive utility to expand the archive into the calibre configuration folder. Exactly how you do this depends on the utility. For example, using the built-in Windows 11 archive manager you would:
    1. Navigate to the folder containing the configuration backup zip files.
    2. Right-click on the desired zip archive and select "Extract all".
    3. Use the "Browse" button to navigate to the existing calibre configuration folder. This is usually
      Quote:
      C:\Users\{your name}\AppData\Roaming\calibre
      You can find the path of the configuration folder in calibre using Preferences / Miscellaneous / Open calibre configuration folder.
    4. Click "Extract".
    5. Allow overwrite of existing files.
    If you want to be ultra-sure, delete the contents of the existing calibre configuration folder before restoring the backup. Only do this if you are sure both that your backup zip is valid and of the steps to do a restore. One way to be sure is to restore the zip to a new folder, rename the existing configuration folder, then rename the new folder to the name the configuration folder had.
  • Requires Calibre 5.35 or later.

Version History:
Spoiler:

Version 1.1.2: (08/Feb/2025):
Changes:
  • Added translation support and the Spanish translation (thanks to @Dunhill)
Version 1.1.0: (05/Feb/2025):
I consider this to be a stable release. The change rate should slow down.
Changes:
  • Allow calibre version 5.35 and newer.
  • Add timed print debugging statements
  • Add the archive size to the debug output.
Version 1.0.4: (05/Feb/2025):
Changes:
  • Stop throwing exceptions and failing when deleting a backup file that is supposed to be there but isn't.
  • Add another line to the configuration dialog showing the full path to the backup folder.
  • Internal restructuring to make my IDE, and therefore me, happier. This shouldn't have changed any behavior.
Version 1.0.3: (03/Feb/2025):
Changes:
  • Addition of automatic removal of old backup files. The number of days to
    keep is controlled by two new configuration values. Note: backups
    made before this version is installed won't be automatically removed.
  • Addition of a button to open the backup folder.
  • Improvement in tooltips.
Version 1.0.2: (03/Feb/2025):
Changes:
  • Improvement in tooltips
Version 1.0.1: (02/Feb/2025):
Initial beta version.
Attached Files
File Type: zip Backup Configuration Folder_1_1_2.zip (22.6 KB, 539 views)

Last edited by chaley; 02-08-2025 at 05:13 AM.
chaley is offline   Reply With Quote
Old 07-30-2017, 01:43 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,243
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
[Reserved for future use]

Last edited by chaley; 02-06-2025 at 07:37 AM.
chaley is offline   Reply With Quote
Advert
Old 01-07-2025, 09:08 PM   #3
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,348
Karma: 29268000
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Backup configuration folder(s)

A plugin to create zip archive of calibre's configuration folder at a designated location that would run when calibre is explicitly closed (i.e. not for a restart) - be good if it included a timestamp in the archive name - e.g. "20240108 120321 calibre config backup".

I know it can be done in a script but . . .

BR
BetterRed is offline   Reply With Quote
Old 01-08-2025, 12:14 PM   #4
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,512
Karma: 7086475
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by BetterRed View Post
A plugin to create zip archive of calibre's configuration folder at a designated location that would run when calibre is explicitly closed (i.e. not for a restart) - be good if it included a timestamp in the archive name - e.g. "20240108 120321 calibre config backup".

I know it can be done in a script but . . .

BR
I use the attached script on Windows. Maybe it's useful for plugin developers to create a cross-platform equivalent:
Attached Files
File Type: bat Calibre Config Backup.bat (547 Bytes, 70 views)
Comfy.n is offline   Reply With Quote
Old 01-08-2025, 05:27 PM   #5
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,348
Karma: 29268000
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by Comfy.n View Post
I use the attached script on Windows. Maybe it's useful for plugin developers to create a cross-platform equivalent:
- a plugin would have to allow for the CALIBRE_CONFIG_DIRECTORY Environment variable - you shouldn't be surprised to know I use it

BR
BetterRed is offline   Reply With Quote
Advert
Old 01-08-2025, 05:32 PM   #6
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,512
Karma: 7086475
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by BetterRed View Post
you shouldn't be surprised to know I use it

BR
oh, I'm really glad to know that
Comfy.n is offline   Reply With Quote
Old 02-01-2025, 06:09 PM   #7
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 804
Karma: 409966
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by BetterRed View Post
A plugin to create zip archive of calibre's configuration folder at a designated location that would run when calibre is explicitly closed (i.e. not for a restart) - be good if it included a timestamp in the archive name - e.g. "20240108 120321 calibre config backup".

I know it can be done in a script but . . .

BR
Here I made a script to backup the config folder. I run it in Linux with the command python3 backup_calibre.py. This script must be given executable permissions with the command chmod +x backup_calibre.py
I hope it is useful
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	44
Size:	145.9 KB
ID:	213363  
Attached Files
File Type: py backup_calibre.py (3.1 KB, 26 views)
dunhill is offline   Reply With Quote
Old 02-02-2025, 04:38 AM   #8
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,450
Karma: 12559681
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by dunhill View Post
Here I made a script to backup the config folder. I run it in Linux with the command python3 backup_calibre.py. This script must be given executable permissions with the command chmod +x backup_calibre.py
I hope it is useful
Thank you very much! I'll make it run in my cygwin.
Terisa de morgan is offline   Reply With Quote
Old 02-02-2025, 11:29 AM   #9
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 804
Karma: 409966
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by Terisa de morgan View Post
Thank you very much! I'll make it run in my cygwin.
If you want to adapt it for a plugin I have left the script for your use.
You have more experience than me in making plugins.
dunhill is offline   Reply With Quote
Old 02-02-2025, 01:15 PM   #10
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,450
Karma: 12559681
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by dunhill View Post
If you want to adapt it for a plugin I have left the script for your use.
You have more experience than me in making plugins.
I've got the script but I wasn't really thinking on converting it on a plugin because any plugin should run with calibre open, and making a copy of that folder while calibre is still making use of some files perhaps it's not the best idea. Perhaps I'm wrong, I'm not sure.
Terisa de morgan is offline   Reply With Quote
Old 02-02-2025, 01:25 PM   #11
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,243
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
I've got the script but I wasn't really thinking on converting it on a plugin because any plugin should run with calibre open, and making a copy of that folder while calibre is still making use of some files perhaps it's not the best idea. Perhaps I'm wrong, I'm not sure.
Why when calibre is opened? You could do the config save in a library closed plugin, giving you a sequence of backups. This wouldn't distinguish between explicit closes and config change restarts. It wouldn't be hard to build. Saving in a zip file would help save space and support some naming convention.

Last edited by chaley; 02-02-2025 at 03:38 PM.
chaley is offline   Reply With Quote
Old 02-02-2025, 05:25 PM   #12
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 804
Karma: 409966
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
The script I sent was written in python but I added a tkinter interface. Now I modified it to qt6 but I can't put it together in a plugin. I managed to add it to actions chain as a module but not as an action.
Here I leave the modification to qt6.
Attached Files
File Type: py backup_calibreqt.py (3.9 KB, 19 views)

Last edited by dunhill; 02-02-2025 at 05:28 PM.
dunhill is offline   Reply With Quote
Old 02-03-2025, 10:58 AM   #13
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,243
Karma: 7955067
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Here is a LibraryClosedPlugin that backs up the configuration folder to a zip file when calibre is closed. It ignores library change events and configuration change restarts. It is configured using Preferences / Plugins / Library closed / Backup Configuration Folder then Customize Plugin. The defaults are probably sufficient for most people.

I've tested it on my config that uses CALIBRE_CONFIG_DIRECTORY. I haven't tried it without the ENV variable because everything I run uses it.

Thanks to @dunhill for the shutil.make_archive() pointer. Using it simplified things a lot.

I'll add this to the plugin index if there is sufficient interest.

Edit: See the first post for the newest version of the plugin.

Last edited by chaley; 02-04-2025 at 06:32 PM.
chaley is offline   Reply With Quote
Old 02-03-2025, 11:12 AM   #14
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,512
Karma: 7086475
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by chaley View Post
Here is a LibraryClosedPlugin that backs up the configuration folder to a zip file when calibre is closed. It ignores library change events and configuration change restarts. It is configured using Preferences / Plugins / Library closed / Backup Configuration Folder then Customize Plugin. The defaults are probably sufficient for most people.

I've tested it on my config that uses CALIBRE_CONFIG_DIRECTORY. I haven't tried it without the ENV variable because everything I run uses it.

Thanks to @dunhill for the shutil.make_archive() pointer. Using it simplified things a lot.

I'll add this to the plugin index if there is sufficient interest.
Nice! Just tested it on Windows:

Click image for larger version

Name:	MWSnap 2025-02-03, 12_10_48.png
Views:	51
Size:	14.3 KB
ID:	213397
Comfy.n is offline   Reply With Quote
Old 02-03-2025, 12:07 PM   #15
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,025
Karma: 77739302
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|Seems to work fine on my calibre install on a Chromebook. Would be nice to have an easy means to select backup location in the configuration dialog; had to type in the path I wanted (I know... 3rd world problem)
PeterT is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
backup function for the configuration folder? Martin Calibre 18 08-18-2023 05:03 AM
Is there a way to backup my settings/configuration? birkmaggs Calibre 8 04-21-2023 11:26 PM
Configuration backup kshane9 Library Management 2 11-17-2017 03:11 PM
Change location of configuration folder macnab69 Library Management 10 11-04-2015 10:22 AM
Local backup folder is located where? pewterbot9 enTourage Archive 1 12-30-2010 03:16 PM


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


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