feat: add optional filename_format parameter to download_videos()#1211
Open
SamStorer wants to merge 1 commit intofronzbot:devfrom
Open
feat: add optional filename_format parameter to download_videos()#1211SamStorer wants to merge 1 commit intofronzbot:devfrom
SamStorer wants to merge 1 commit intofronzbot:devfrom
Conversation
- Add _format_filename_default() method to encapsulate default filename formatting
- Add filename_format parameter to download_videos() allowing custom filename generation
- Update _parse_downloaded_items() to accept and use custom format function
- Maintain full backward compatibility (defaults to existing slugified format)
- Add comprehensive documentation and examples
- Add test cases for custom format functions
Usage example:
def custom_fmt(created_at, camera_name, path):
dt = datetime.datetime.fromisoformat(created_at).astimezone(
pytz.timezone('US/Eastern')
)
clean_name = camera_name.replace(' ', '')
return os.path.join(path, f'{dt:%Y%m%d_%H%M%S}_{clean_name}.mp4')
await blink.download_videos(path, filename_format=custom_fmt)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Usage example: