mmcc-xx / WhosAtMyFeeder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

View Video link does not work

empireshades opened this issue · comments

On the main page of the webUI, I click on a thumbnail image and the snapshot window pops up, but when I try to click the View Video link in the bottom left hand corner, I just get a broken video image. This appears to be coming from an internal flask re-routing logic where whosatmyfeeder makes a request to frigate to fetch the video and then send it to the user directly here:

WhosAtMyFeeder/webui.py

Lines 52 to 69 in 787c665

@app.route('/frigate/<frigate_event>/snapshot.jpg')
def frigate_snapshot(frigate_event):
frigate_url = config['frigate']['frigate_url']
try:
# Fetch the image from frigate
print("Getting snapshot from Frigate", flush=True)
response = requests.get(f'{frigate_url}/api/events/{frigate_event}/snapshot.jpg', stream=True)
if response.status_code == 200:
# Serve the image to the client using Flask's send_file()
return send_file(response.raw, mimetype=response.headers['Content-Type'])
else:
# Return the single transparent pixel image from the local file if the actual image is not found
return send_from_directory('static/images', '1x1.png', mimetype='image/png')
except Exception as e:
# If there's any issue fetching the image, return a 500 error
print(f"Error fetching image from frigate: {e}", flush=True)
abort(500)
When I examine the frigate api logs, it appears to have fetched correctly with a 200 so I'm not sure why this isn't working but it seems like it's breaking in line 62: return send_file(response.raw, mimetype=response.headers['Content-Type']). Any ideas? Thanks.