def galleries_install(gallery_path, fspath, htpasswd=None, interactive=False, **args): gallery = load_gallery(gallery_path) with GalleryInstaller(fspath, interactive) as installer: installer.install(gallery) if htpasswd: access.manage(gallery_name=gallery.name, fspath=fspath, htpasswd=htpasswd, access_command='init') if args['set_albums_cover']: for a in gallery.albums: album.setcover(gallery_name=gallery.name, album_name=a.label, image_name=args['set_albums_cover'], fspath=fspath)
def access_manage(galleries_name_pattern, fspath, **args): galleries = search_galleries(fspath) for gallery in galleries: if fnmatch.fnmatch(gallery.name, galleries_name_pattern): access.manage(gallery_name=gallery.name, fspath=fspath, **args)