-
Notifications
You must be signed in to change notification settings - Fork 1
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
I11 job split pdfs into child works #83
Conversation
Ref issue #11 * Create jobs to split pdfs into child works, using Hyrax's BatchCreateJob and CreateChildWork * Create job to add child works to parent work * Create services to split PDFs into TIFFs * Migration to create IiifPrintPendingRelationships to track child works and add to parent * Allow functionality to be added to work models by including configuration `include IiifPrint.model_configuration(pdf_split_child_model: GenericWork)` Specs are still pending completion at this point.
To test via hyku, create a Generic Work with a PDF file. This can be done via the UI or via Bulkrax. (If via bulkrax, the file name must be in the same CSV row as the work itself). Other work types are not configured to split PDFs, and should behave normally. You should see:
Note:
|
@@ -28,16 +30,20 @@ def hold_upload_paths(env) | |||
return if upload_ids.empty? | |||
uploads = Hyrax::UploadedFile.find(upload_ids) | |||
paths = uploads.map(&method(:upload_path)) | |||
@pdf_paths = paths.select { |path| path.end_with?('.pdf') } | |||
@pdf_paths = paths.select { |path| path.end_with?('.pdf', '.PDF') } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just in case there's something weird like a_file.Pdf
consider using case insensitive regex
@pdf_paths = paths.select { |path| path.match? /\.pdf$/i }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly? I was thinking a TODO may be necessary to find a way to identify PDFs differently which is why I left it this way for now. Remote URLS can contain PDF files but don't always end in .pdf (i.e. google docs links).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for answering the questions and awesome job on this feature!
blocked by #100 |
Ref #11
include IiifPrint.model_configuration(pdf_split_child_model: GenericWork)
Specs are still pending completion. Skeleton spec files have been added with TODO notes.