MicheleCotrufo / pdf-renamer

A python tool to automatically rename the pdf files of scientific publications by looking up the publication metadata on the web.
123 stars 18 forks source link

Square brackets and other characters in title #12

Closed E-11-V closed 2 months ago

E-11-V commented 1 year ago

Hi!

I am so thankful for this, it's an amazing tool; thank you!

I am having issues with renaming pdfs that contain characters invalid for file renaming, such as square brackets, colons and the like. It seems like the script fails to rename the file and it just moves on to the next file. I am sure there is a pretty easy way around this but I actually am starting to learn python these days and have literally no clue.

Thanks a lot!!

MicheleCotrufo commented 1 year ago

Hi, thanks for your feedback. Can you send me an example of a pdf file that creates this issue? Also, which versions of the packages pdf-renamer, pdf2bib and pdf2doi do you have?

E-11-V commented 1 year ago

VErsions (1.0rc9), (1.1rc4) and (1.5rc8) respectively.

This is one of the files.

[ff31e7d3-ade6-426a-80f7-24d6dfac000d.pdf] (https://github.com/MicheleCotrufo/pdf-renamer/files/10943987/ff31e7d3-ade6-426a-80f7-24d6dfac000d.pdf)

This is the error message. [pdf-renamer]: The new file name is C:\Users\Utente*\Hispania Sacra - 2016 - Rodriguez-San Pedro Bezares - La dualidad de Teresa de Jesus y el proyecto de "Jesuitas descalzos".pdf [pdf-renamer]: Some error occured while trying to rename this file: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\Users\Utente\Desktop\TEst\ff31e7d3-ade6-426a-80f7-24d6dfac000d.pdf' -> 'C:\Users\*\Hispania Sacra - 2016 - Rodriguez-San Pedro Bezares - La dualidad de Teresa de Jesus y el proyecto de "Jesuitas descalzos".pdf'

Anything that leaves out "", <>, /, : and other characters that cannot be used in file names would be perfect and more than enough to fix this. I just don't know how to do it :s

Thank you!

E-11-V commented 1 year ago

Hi! Any news on this? Thanks a lot!

MicheleCotrufo commented 3 months ago

Sorry that it took me so long to look into this :) I am working on fixing this and other bugs. I just uploaded a rc version. I verified on my end that I can now rename that particular paper without getting an error. Can you install it and verify that this issue is now fixed? pip install pdf-renamer==1.1rc2

MicheleCotrufo commented 2 months ago

I will mark this as fixed (see details of the version 1.1 that was just released https://github.com/MicheleCotrufo/pdf-renamer/releases/tag/v1.1 ), feel free to re-open it if you still have this issue