Skip to content
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

fix snapshot url for multicam plugin #396

Merged
merged 1 commit into from
Mar 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions octoprint_telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,32 +1982,38 @@ def _send_msg(
self._logger.debug("multicam_profiles : " + str(curr))
for li in curr:
try:
self._logger.debug(
"multicam profile: " + str(li)
)
snapshot_url = li.get("URL")
snapshot_url = li.get("snapshot") # try to get the snapshot url
self._logger.debug(
"multicam url : " + str(snapshot_url)
)

defsnap = self._settings.global_get(
["webcam", "snapshot"]
)
defstream = self._settings.global_get(
["webcam", "stream"]
)
streamname = defstream.rsplit("/", 1).pop()
snapname = defsnap.rsplit("/", 1).pop()
if streamname in snapshot_url:

if not snapshot_url: # if snapshot url is not stored try to create it
self._logger.debug(
str(streamname)
+ " found so should be replaced by "
+ str(snapname)
"multicam profile: " + str(li)
)
snapshot_url = snapshot_url.replace(
streamname, snapname
snapshot_url = li.get("URL")
self._logger.debug(
"multicam url : " + str(snapshot_url)
)

defsnap = self._settings.global_get(
["webcam", "snapshot"]
)
defstream = self._settings.global_get(
["webcam", "stream"]
)
streamname = defstream.rsplit("/", 1).pop()
snapname = defsnap.rsplit("/", 1).pop()
if streamname in snapshot_url:
self._logger.debug(
str(streamname)
+ " found so should be replaced by "
+ str(snapname)
)
snapshot_url = snapshot_url.replace(
streamname, snapname
)

self._logger.debug(
"Snapshot URL: " + str(snapshot_url)
)
Expand Down