A Python CLI tool designed to organize your ebook collection (PDF, EPUB, MOBI) by Topic and Difficulty.
- Topic Classification: Automatically sorts books into categories like
Python,Go,DevOps,Data_AI,Database, etc., based on filenames and content analysis. - Difficulty Scoring: Uses the Flesch-Kincaid Grade Level to classify books as
Easy,Medium, orHard. - Language Detection: Identifies non-English books and sorts them separately (e.g.,
Topic/Language_ZH). - Safe Operation: Default mode COPIES files to prevent data loss. Experimental
--moveflag available.
-
Clone the repository:
git clone https://github.com/yourusername/ebook-sorter.git cd ebook-sorter -
Create a virtual environment:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
Basic usage (Copies files):
python main.py /path/to/source_directory /path/to/output_directoryMove files (Delete from source):
python main.py /path/to/source_directory /path/to/output_directory --move- Scanning: Recursively finds all
.pdf,.epub, and.mobifiles in the source directory. - Text Extraction: Extracts text from the first few pages of each book.
- Topic Detection: Checks for keywords in the filename first, then scans the extracted text for topic-specific terminology.
- Difficulty Analysis: Calculates the readability score of the text.
- Organization: Moves or copies the file to
Output_Dir/<Topic>/<Difficulty>/<Filename>.
PyMuPDF(fitz): PDF text extractionEbookLib&BeautifulSoup4: EPUB parsingtextstat: Readability scoringlangdetect: Language identificationtqdm: Progress bars
MIT