Add multi-camera support - #433
Open
KapJI wants to merge 3 commits into
Open
Conversation
KapJI
marked this pull request as draft
March 30, 2026 09:02
KapJI
force-pushed
the
multi-camera
branch
4 times, most recently
from
April 8, 2026 15:04
4de3d14 to
2fb2778
Compare
nlef
reviewed
Apr 8, 2026
| self._status_message = sent_messages[0] | ||
| for photo in photos: | ||
| photo.seek(0) | ||
| await message.update_existing_media_group(sent_messages, photos) |
Owner
There was a problem hiding this comment.
Looks like an update to a media group I just sent.
Perhaps this is unnecessary?
Contributor
Author
There was a problem hiding this comment.
The idea here is that initial media group post doesn't have reply_markup to show Update button, I'm testing if it can be added by update. I'm still testing this.
KapJI
marked this pull request as ready for review
April 8, 2026 23:40
KapJI
marked this pull request as draft
April 9, 2026 07:46
KapJI
marked this pull request as ready for review
April 27, 2026 23:14
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.
This is the first, intentionally small PR extracted from the larger
multi-camerabranch. The original branch also included status albums, notification albums, timelapse changes, and unfinished-lapse recovery, but those parts were removed from this PR and kept for follow-up PRs to make the review more manageable. This PR only adds the configuration and runtime plumbing needed to construct multiple cameras, then wires that into/videocamera selection.What changes
Multi-camera configuration
Existing single-camera configs keep working:
[camera]is still the default camera.Additional cameras can be configured with named sections:
ConfigWrappernow exposes:cameras: all parsed camera configs, keyed by camera name.default_camera: the first configured camera, orNonewhen no camera is configured.status_cameras/timelapse_cameras: filtered camera config maps. This PR still keeps status notifications and timelapse single-camera, but they now pick the first available runtime camera from the corresponding filtered list.[camera default]is rejected and ignored. The default camera remains[camera]; a named section calleddefaultwould otherwise be ambiguous and could shadow the real default.Camera sections without a
hostare parsed but no runtimeCameraobject is created for them. This lets users keep disabled/incomplete camera sections in config without making startup fail.The old internal
ConfigWrapper.cameracompatibility alias is removed. Remaining single-camera consumers use selected runtimeCameraobjects instead. The existing config key remainsfourcc, but the code exposes it asvideo_codeconCameraConfig/Camerabecause timelapse assembly reads it from the selected camera.Camera construction
camera.pynow has acreate_camera(...)factory. It centralizes backend selection and skips unavailable cameras:mjpeg,ffmpeg, andraw_streamare constructed from their own camera config.opencvis skipped when OpenCV is not available.None.This replaces the single
camera_wrapglobal inmain.pywith acameras: dict[str, Camera]runtime map.Single-camera code paths are preserved by passing one selected camera into existing
TimelapseandNotifierconstructors. For each path, the bot picks the first configureduse_for_timelapse/use_for_statuscamera that was successfully constructed at runtime. Those constructors now acceptCamera | None, so a no-camera config can start cleanly and fall back to text-only notifications/status where needed./videoselection/videokeeps the old behavior when exactly one camera is available.With multiple cameras:
/videoshows an inline camera-selection keyboard./video <name>records from the named camera directly.When no camera is available,
/videoreplies withNo camera is configured.Stale camera-selection callbacks also produce a user-facing message instead of only logging.What this PR does not include
These pieces were present in the larger branch, but are intentionally removed from this PR and will be sent separately:
/statusalbums.Keeping those out makes this PR a small foundation layer rather than another all-in-one feature branch.
Test plan
Coverage includes:
[camera]config still registers as the default camera.[camera <name>]sections are parsed and keyed by name.[camera default]reports a parsing error and is ignored, both standalone and when[camera]is also present.[camera]section produces no runtime default camera.fourccis exposed internally asvideo_codec, andConfigWrapper.camerais no longer present./videoshows camera-selection buttons with multiple cameras./videowithout available cameras reports that no camera is configured.Implements #51