Open btywoniuk opened 2 years ago
Thank you for reporting this.
Which OS do you use, and which version of pdf-renamer
do you have?
I think this is due to two separate problems. First, it looks like the bibtex infos of this paper are somehow corrupted. pdf-renamer
uses pdf2bib
, which in turn sends queries to dx.doi.org to get the bibtex info associated to a DOI. For some reason, the title
entry of the bibtex info is polluted with some weird latex code
title = "Magnetic field dependent two-photon absorption properties in monolayer
$\less$mml:math xmlns:mml="http://www.w3.org/1998/Math/{MathML}"$\greater$$\less$mml:msub$\greater$$\less$mml:mi$\greater${MoS}$\less$/mml:mi$\greater$$\less$mml:mn$\greater$2$\less$/mml:mn$\greater$$\less$/mml:msub$\greater$$\less$/mml:math$\greater$"
Luckily pdf-renamer
has some internal routine to get rid of the weird $ stuff. I tested it on my computer and the file gets successfully renamed to 2022-05 - Physical Review B - Magnetic field dependent two-photon absorption properties in monolayer mmlmath xmlnsmml=httpwww.w3.org1998MathMathMLmmlm.pdf
. The title still looks ugly, but again this is due to the content of the bibtex info, and there's not much that can be done to fix it automatically without making big assumptions on what is a valid title.
It looks like, on your computer, (1) the $ parts are not removed, and (2) the filename does not get shortened to a max of 150 characters. Since your OS does not like this long filename, it raises that error. I don't see why the routine to check for the $ and shorten the filename would not work on your computer, unless you are using an older version of the script?
When I run:
~/Library/Python/3.10/bin/renamepdf -f "{YYYY}-{MM} - {J} - {T} - {A3etal}" -max_length_filename 150 PhysRevB.105.195301.pdf
I'm getting: