Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --name-format and --direct options #22

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NonVideri
Copy link

The PR adds two options:

  • --name-format sets the format for output file names. By default no format is set, and generic names from config.py are used. Supported values:
    • slug: Book title slug (e.g. "the-4-hour-workweek")
    • title: Book title (e.g. "The 4-Hour Workweek")
    • title-upper: Book title in uppercase (e.g. "THE 4-HOUR WORKWEEK")
    • id: Book ID (e.g. "617be9b56cee07000723559e")
  • --direct saves files directly in the parent folder, instead of creating a new folder for the book. Requires --file-format to be set.

@NicoWeio
Copy link
Owner

NicoWeio commented Sep 20, 2023

Thanks for your pull request!
Rather than having explicit options, I'd like to accept a template, like how Instaloader does it. This way,

  • We wouldn't need to add new logic to allow accessing of other (future) attributes
  • Near-arbitrary directory structures become possible
  • We wouldn't need to introduce a --direct flag; instead, the default template would contain the current behavior of creating subdirectories.

The only downside is that uppercase doesn't come for free; one would have to pass uppercase versions to the formatter separately or create a custom formatter. But I don't personally see the need for uppercase in the first place; maybe you have an example of a use case?
Do you agree with my suggestions? And would you be willing to implement them?

@NonVideri
Copy link
Author

NonVideri commented Sep 21, 2023

@NicoWeio I agree that the template would be a superior option. I am, however, still relatively new at Python, so I'm not confident in my ability to implement this more advanced version in a clean, Pythonic & efficient way, in a timely manner. (Please do a proper CR if you're thinking of merging this one!)

As for the uppercase, I added it for my particular use case — I have a knowledge base where I mark external notes with ALL CAPS FILENAMES to distinguish them from the internal ones.

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 participants