Skip to content

Commit

Permalink
Merge pull request #396 from radioburst/fix/multicam_snapshot_url
Browse files Browse the repository at this point in the history
fix snapshot url for multicam plugin
  • Loading branch information
giloser authored Mar 6, 2022
2 parents eb93953 + 2dbb8cf commit d8fa9ac
Showing 1 changed file with 25 additions and 19 deletions.
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

0 comments on commit d8fa9ac

Please sign in to comment.