Skip to content

feat: add optional filename_format parameter to download_videos()#1211

Open
SamStorer wants to merge 1 commit intofronzbot:devfrom
SamStorer:prepare-changes
Open

feat: add optional filename_format parameter to download_videos()#1211
SamStorer wants to merge 1 commit intofronzbot:devfrom
SamStorer:prepare-changes

Conversation

@SamStorer
Copy link
Copy Markdown

@SamStorer SamStorer commented Apr 5, 2026

  • 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)

- 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)
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.

1 participant