mikedmor / OctoPrint_MultiCam

Extends the Control tab of OctoPrint, allowing the ability to switch between multiple webcam feeds.
45 stars 19 forks source link

Fix timelapse in 1.9.0+ #66

Closed matiasjrossi closed 10 months ago

matiasjrossi commented 10 months ago

Default timelapse plugin in Octoprint 1.9+ wasn’t working with MultiCam provided cameras, this makes it functional.

Looking at commit history, it seems this is relatively new code and never worked. The problem originates in an inconsistency on the type of the argument for take_webcam_snapshot() in WebcamProviderPlugin. In octoprint/plugin/types.py:

    def take_webcam_snapshot(self, webcamName):
        """
        Used to take a JPEG snapshot of the webcam. This method may raise an exception, you can expect failures to be handled.

         :param string webcamName: The name of the webcam to take a snapshot of as given by the configurations

        Returns:
            An iterator over bytes of the JPEG image
        “""

However, in octoprint/timelapse.py, a ProvidedWebcam is passed:

            self._logger.debug(
                f"Going to capture {filename} from {self._webcam.config.name} provided by {self._webcam.providerIdentifier}"
            )
            snapshot = self._webcam.providerPlugin.take_webcam_snapshot(self._webcam)

This changes the plugin to use ProvidedWebcam, thus not requiring a change to Octoprint (although it probably would make sense to make the plugin interface align with Timelapse’s usage).

mikedmor commented 10 months ago

Thank you matiasjrossi, These changes look good to me and have been merged and are now available in version 0.4.1