Closed vladrevers closed 5 months ago
Separately made a PR #10, so that some commits do not wait for others to be finalized.
@coderabbitai review
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@vladrevers I made some changes. What do you think?
It looks good, it may be worth swapping the third format with the first one, as the YYYY-MM-DD variant is the most frequent and it will be earlier than the output, but this is already micro-optimization...
"%Y", # YYYY
"%Y-%m", # YYYY-MM
"%Y-%m-%d", # YYYY-MM-DD
↓
"%Y-%m-%d", # YYYY-MM-DD
"%Y-%m", # YYYY-MM
"%Y", # YYYY
Yeah it's completely negligible in terms of performances.
@devnoname120 an external warning appears even with valid variants such as "2014", "2014-01"; with "2014-01-01" it is not present.
$HOME/.cache/pypoetry/virtualenvs/play-book-pdf-tool-7b70b7UK-py3.10/lib/python3.10/site-packages/pikepdf/models/metadata.py:520: UserWarning: The DocumentInfo field /CreationDate could not be updated from XMP
.
~The pikepdf is updated, I looked in the metadata of the pdf that was created half a year ago when the incomplete date was added - pikepdf 7.1.1.~
@vladrevers Do you mean that it works in pikepdf = "7.1.1"
or do you mean that it works if you update this dependency?
Edit: OK, the problem is because PikePDF uses datetime.fromisoformat()
, and it sucks like most of Python's standard library.
@vladrevers Do you mean that it works in
pikepdf = "7.1.1"
or do you mean that it works if you update this dependency?
~Worked with 7.1.1~
@vladrevers Can you open an issue on the pikepdf
repository? You can link in the issue this page that shows that 2014
and 2014-01
are accepted formats for the Date
XMP Data Type: https://developer.adobe.com/xmp/docs/XMPNamespaces/XMPDataTypes/#date
Worked with 7.1.1
Pikepdf 7.1.1 has the same exact problem so I doubt that.
Pikepdf 7.1.1 has the same exact problem so I doubt that.
hmm, yes, I just looked again in that pdf, I apparently then indicated the full date
@vladrevers Can you open an issue on the
pikepdf
repository?
Honestly wouldn't want to, I have problems with both English and Python)
@vladrevers As far as I understand it doesn't prevent the PDF from being created (it will only lack this legacy metadata). Can you confirm?
Can you confirm?
Yes, it does not interfere with the creation of PDF, just in the final PDF file will not be this property
instead of separating and then joining. Helps to avoid an error if there is only a year in the line.
Summary by CodeRabbit
xmp:CreateDate
metadata in PDF files to directly use thepub_date
field with improved formatting.