These are some development specific notes for particular releases. They are both for the developers of pdftitle or -although not intended- integrators of pdftitle as a library to other projects.
- build system is changed from setup.py to pyproject.toml, build system is still setuptools.
get_title_from_doc
method can be used with PDFDocument objectsGetTitleParameters
class is added to not change the signature ofget_title_from_...
methods everytime a new option is added.- new use_metadata parameters are added.
metadata.py
containing title extraction methods from the metadata is added.
pdftitle.py
is moved from the root folder of the project topdftitle
directory- some functionality in
pdftitle.py
are moved into separate files (device.py
,interpreter.py
) - custom logging functionality is removed and standard logging is implemented. the logging config is initialized in
run
, thus ifget_title_from_{file,io}
is used, the logging config should be explicitly initalized beforehand. - pdftitle specific exceptions are moved and raised as PDFTitleException (it was Exception before)
- global variables are removed, thus the signature of
get_title_from_file
andget_title_from_io
functions are changed to include the parameters (fixes #33) get_title_from_io
method is splitted into multiple methods (one method for each algorithm etc.), but these are not supposed to be used publicly (all are__
prefixed)get_title_from_io
andget_title_from_file
are also imported in__init__.py
- running pdftitle command only handles PDFTitleException gracefully (prints stack trace and exits with non-zero error code). it was handling Exception gracefully before.
- type hints are added for public methods
- most if not all string formatting is converted to f-strings
- title case, ligature conversion and changing file name are not performed in
get_title_from_{file, io}
methods.title.title()
,pdftitle.convert_ligatures(title)
andpdftitle.change_file_name(pdf_file, new_name)
methods should be called explicitly afterwards.