Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 17, 2025

This PR implements two highly requested features that enhance file organization and naming flexibility:

🗂️ Feature 1: Custom Attachments Directory Naming

Adds support for customizing the attachments directory name using post properties, similar to how post_dirname_format works for post directories.

New Configuration Option:

KTOOLBOX_JOB__POST_STRUCTURE__ATTACHMENTS_DIRNAME_FORMAT={title}

Example Usage:

# Use post title as attachments folder name
KTOOLBOX_JOB__POST_STRUCTURE__ATTACHMENTS_DIRNAME_FORMAT={title}

# Use post ID and title combined  
KTOOLBOX_JOB__POST_STRUCTURE__ATTACHMENTS_DIRNAME_FORMAT={id}_{title}

# Use published date and title
KTOOLBOX_JOB__POST_STRUCTURE__ATTACHMENTS_DIRNAME_FORMAT={published}_{title}

Result:

Post_Directory/
├─ content.txt
├─ post.json
└─ Title_of_Post/         # Instead of "attachments"
   ├─ 1.jpg
   └─ 2.png

🔢 Feature 2: Sequential Filename Indentation

Adds the ability to preserve original filenames while using sequential numbering, addressing the limitation where sequential_filename=True completely replaced original names.

New Configuration Option:

KTOOLBOX_JOB__SEQUENTIAL_FILENAME_INDENTATION=True

Comparison:

  • Without indentation: 1.png, 2.jpg, 3.gif
  • With indentation: 1_OriginalImage.png, 2_PhotoFile.jpg, 3_Animation.gif

🔧 Implementation Details

  • Backward Compatible: All existing functionality preserved, new features are opt-in
  • Integrates Seamlessly: Works with existing features like sequential_filename_excludes, filename_format, etc.
  • Minimal Changes: Surgical modifications following the codebase patterns
  • Comprehensive Testing: 15 new test cases covering various scenarios and edge cases
  • Full Documentation: Updated FAQ, configuration guide, and auto-generated reference docs

🧪 Testing

All tests pass including:

  • 8 test cases for custom attachments directory naming
  • 7 test cases for sequential filename indentation
  • All existing functionality regression tests
  • Live demo showing features working individually and together

📖 Documentation

  • Added FAQ entries with detailed examples and use cases
  • Updated configuration guide with practical examples
  • Enhanced docstrings for auto-generated reference documentation

Both features address real user needs for better file organization and naming flexibility, while maintaining the simplicity and reliability that KToolBox users expect.

Fixes #350.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits September 17, 2025 08:26
Co-authored-by: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com>
Co-authored-by: Ljzd-PRO <63289359+Ljzd-PRO@users.noreply.github.com>
Copilot AI changed the title [WIP] 2 Possible Additional Features Add custom attachments directory naming and sequential filename indentation features Sep 17, 2025
Copilot AI requested a review from Ljzd-PRO September 17, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 Possible Additional Features

2 participants