View Single Post
Old 11-02-2023, 10:04 PM   #11
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,200
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
This can be automated by downloading the zip files into calibre plugins folder:

Code:
import os

from calibre.gui2.dialogs.plugin_updater import get_plugin_updates_available
from calibre.constants import (
    DEBUG, __appname__, __version__
)
from calibre.utils.https import get_https_resource_securely
from calibre.utils.config import config_dir

plugin_dir = os.path.join(config_dir, 'plugins')
exclude_update = []

def update_plugins():
    total_updates = 0
    for plugin in get_plugin_updates_available():
        if plugin.name in exclude_update:
            print(f'Skip updating plugin: {plugin.name}')
            continue
        print(f'Updating plugin: {plugin.name}')
        raw = get_https_resource_securely(plugin.zip_url, headers={'User-Agent':f'{__appname__} {__version__}'})
        plugin_path = os.path.join(plugin_dir, f'{plugin.name}.zip')
        total_updates += 1
        with open(plugin_path, 'wb') as f:
            f.write(raw)
    if total_updates:
        print(f'Updated {total_updates} plugins. Restart calibre now')
    else:
        print('No plugins updated')


if __name__ == '__main__':
    update_plugins()
After running the command, you will need to restart calibre. Also don't forget to backup your calibre plugins folder in case something goes wrong.

Last edited by capink; 11-03-2023 at 01:19 AM.
capink is offline   Reply With Quote