Skip to main content

A Linux-specific tool for naming PDF files

Project description

PDF Namer

PDF Namer is a Python CLI application that processes PDF documents and renames them based on AI-generated descriptions. This tool is designed to help organize and manage collections of PDF documents by extracting meaningful information and creating standardized filenames.

Features

  • Process single PDF files or entire directories recursively
  • Generate meaningful filenames using OpenAI's GPT models
  • Multiprocessing support for faster batch processing
  • Customizable number of worker processes
  • Language selection for filename generation

Installation

  1. Clone this repository:

    git clone https://github.com/llabusch93/pdf-namer.git
    cd pdf-namer
    
  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  3. Install the required dependencies:

    pip install -r requirements.txt
    
  4. Set up your OpenAI API key as an environment variable:

    export OPENAI_API_KEY=your_api_key_here
    

Usage

To process a single PDF file:

pdf-namer /path/to/your/file.pdf

To process all PDF files in a directory recursively:

pdf-namer /path/to/your/directory

To specify the number of worker processes:

pdf-namer /path/to/your/directory --workers 5

To specify the language for filename generation:

pdf-namer /path/to/your/file.pdf --language english

How it works

  1. The program checks if the input is a single file or a directory.
  2. For each PDF file: a. The text is extracted from the PDF. b. The extracted text is sent to OpenAI's GPT model to generate a meaningful filename. c. The file is renamed using the generated filename.
  3. If processing a directory, multiple files are processed concurrently using Python's multiprocessing module.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Laurence Labusch (laurence.labusch@gmail.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_namer-0.2.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_namer-0.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file pdf_namer-0.2.0.tar.gz.

File metadata

  • Download URL: pdf_namer-0.2.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pdf_namer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 08f7c6d0d9f9db6ec335c260d381d09cc911a492eddfb334c40ac07165054e7f
MD5 fd4119999c1b6c948371b44b1efe5fbd
BLAKE2b-256 b08f5c84b8a6e60cda0659b219f396050bbf6d83e3bb1710835b30477a4685f5

See more details on using hashes here.

File details

Details for the file pdf_namer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pdf_namer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pdf_namer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22d30cbcaba812e11594ae3aac4d605a673bd9717618bc1fa95f75f75b033864
MD5 09b7e39312b13e482217d767d5e6ee7d
BLAKE2b-256 ff6c26c81bff1bb3a4ebfe88789366a615504d40a65e048bd88a4c69fc7a1504

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page