-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
New option for file name capitalization handling #450
Open
alterxyz
wants to merge
1
commit into
jmathai:master
Choose a base branch
from
alterxyz:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you proposing that text within
[]
's gets special treatment? Is the goal here that, for example, thei
inimg_0001.jpg
does not get capitalized?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your reply.
Initially, I wanted to keep the original filename unchanged, but capitalize the first letter of the city name in the filename so it looks good. For example, a photo named
iOS_IMG_0144.Heic
would be renamed to:The
iOS
remains the same, while Heic is changed to heic to align with the requirements of other parts of this project.After customizing my own naming rules, I thought it would be helpful to let people know that they can easily split and modify their filenames. I chose the "]" character as a good separator based on my naming rules.
For example, adding another elif statement and using the rsplit() function in the following code can help people to convert the filename extension to lowercase while keeping the rest of the filename in uppercase:
Perhaps I should commit this code that is more suitable for others, rather than the one that is just for myself?
As a beginner in coding, please feel free to point out any issues with my code or ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for explaining, that makes sense.
This parsing logic is one of the more complex parts of this code base (as seen by the ratio of comments to code in
get_file_name
. Uppercasing the entire file name is easy to do here because we don't have to be precise - we just uppercase the whole thing.If we want to capitalize specific parts of the file name it might more suitable to do it higher up in this function. Either in the for loop starting at line 151 or after the for loop when we interpolate into the templated string around line 210.
What do you think?