Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Because of subdirectories, adding a new project requires restarting Sipi #281

Open
benjamingeer opened this issue Jan 31, 2019 · 1 comment
Assignees
Milestone

Comments

@benjamingeer
Copy link
Contributor

Knora PR dasch-swiss/dsp-api#1191 puts a Knora project ID in the IIIF URL, and stores each project's images in a different directory. We also want to use Sipi's subdir_levels feature inside each of these project directories. But Sipi only creates subdirectories on startup, which means that every time we add a new project, we have to restart Sipi. Could Sipi add the subdirectories on the fly?

Maybe there could be a function like helper.filename_hash, which just returned the hashed directory path, without the filename. Then there could be a function like server.fs.mkdir to create a directory and all of its parent directories if they don't exist. Then a Lua script could do something like this:

project_dir = config.imgroot .. '/' .. project_id
success, hash_path = helper.filename_hash_path(filename)
hash_path_in_project_dir = project_dir .. '/' .. hash_path
server.fs.mkdirs(hash_path_in_project_dir)
file_path = hash_path_in_project_dir .. '/' .. filename
success, error_msg = uploaded_image:write(file_path)
@benjamingeer
Copy link
Contributor Author

After discussion with @lrosenth and @subotic: the directories will be created at startup, but there will also be a new Sipi admin route for adding a new project directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants