Skip to content

Commit

Permalink
Add delete functionality and timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
infinitel8p committed Aug 22, 2024
1 parent 8dea1c7 commit bd1721a
Show file tree
Hide file tree
Showing 185 changed files with 292 additions and 9,760 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Integrations:
- [DS3231 Real Time Clock Module](https://amzn.eu/d/ikNTko8)

## Setup & Usage
Follow the instructions on our [documentation](https://dev.infinitel8p.com/Security-Cam/) to set up the hardware and find out how to use it.
Follow the instructions in our [documentation](https://dev.infinitel8p.com/Security-Cam/) to set up the hardware and find out how to use it.

## Future Enhancements
- **Web Interface**: A user-friendly interface to view recorded videos. **_WIP_**.
Expand Down
5 changes: 5 additions & 0 deletions client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ def stream_video():

return send_file(video_path, as_attachment=True, download_name=os.path.basename(video_path), mimetype='video/mp4')

@app.route('/delete_video', methods=['POST'])
def delete_video_route():
video_path = request.json.get('video_path')
response, status_code = archive_helpers.delete_video(video_path)
return jsonify(response), status_code

if __name__ == "__main__":
app.run(host='0.0.0.0', port=5005, debug=True)
11 changes: 10 additions & 1 deletion client/modules/archive_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,13 @@ def get_videos():
videos.append(os.path.join(root, file))

return videos


def delete_video(video_path):
if not video_path or not os.path.exists(video_path):
return {"error": "Video not found"}, 404

try:
os.remove(video_path)
return {"message": "Video deleted successfully"}, 200
except Exception as e:
return {"error": str(e)}, 500
2 changes: 1 addition & 1 deletion client/modules/stream_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_frames():
if not success:
break

timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
timestamp = datetime.now().strftime("%d-%m-%Y %H:%M:%S")
cv2.putText(frame, timestamp, (10, frame.shape[0] - 10),
cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 255), 2, cv2.LINE_AA)

Expand Down
1 change: 1 addition & 0 deletions server/build/BUILD_ID
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6x2vHpvHUvqap4botkmAI
44 changes: 30 additions & 14 deletions server/build/app-build-manifest.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
{
"pages": {
"/page": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/page.js"
"/_not-found/page": [
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/fd9d1056-62aaf4b921c84028.js",
"static/chunks/23-0c40d6df9b62e9bb.js",
"static/chunks/main-app-6f229fdf4f3d16ab.js",
"static/chunks/app/_not-found/page-94c683a891433c6f.js"
],
"/layout": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/css/app/layout.css",
"static/chunks/app/layout.js"
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/fd9d1056-62aaf4b921c84028.js",
"static/chunks/23-0c40d6df9b62e9bb.js",
"static/chunks/main-app-6f229fdf4f3d16ab.js",
"static/css/d74bb7f086d37408.css",
"static/chunks/88-d743b1e99f054a94.js",
"static/chunks/app/layout-ecb85f0e8e87e8db.js"
],
"/archive/page": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/archive/page.js"
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/fd9d1056-62aaf4b921c84028.js",
"static/chunks/23-0c40d6df9b62e9bb.js",
"static/chunks/main-app-6f229fdf4f3d16ab.js",
"static/chunks/app/archive/page-3d706d5ccb70cb8c.js"
],
"/page": [
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/fd9d1056-62aaf4b921c84028.js",
"static/chunks/23-0c40d6df9b62e9bb.js",
"static/chunks/main-app-6f229fdf4f3d16ab.js",
"static/chunks/app/page-0de3a76f5b98a31c.js"
],
"/settings/page": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/settings/page.js"
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/fd9d1056-62aaf4b921c84028.js",
"static/chunks/23-0c40d6df9b62e9bb.js",
"static/chunks/main-app-6f229fdf4f3d16ab.js",
"static/chunks/app/settings/page-53845fa6e687af05.js"
]
}
}
1 change: 1 addition & 0 deletions server/build/app-path-routes-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"/_not-found/page":"/_not-found","/archive/page":"/archive","/favicon.ico/route":"/favicon.ico","/page":"/","/settings/page":"/settings"}
25 changes: 19 additions & 6 deletions server/build/build-manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
{
"polyfillFiles": [
"static/chunks/polyfills.js"
"static/chunks/polyfills-78c92fac7aa8fdd8.js"
],
"devFiles": [],
"ampDevFiles": [],
"lowPriorityFiles": [
"static/development/_buildManifest.js",
"static/development/_ssgManifest.js"
"static/6x2vHpvHUvqap4botkmAI/_buildManifest.js",
"static/6x2vHpvHUvqap4botkmAI/_ssgManifest.js"
],
"rootMainFiles": [
"static/chunks/webpack.js",
"static/chunks/main-app.js"
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/fd9d1056-62aaf4b921c84028.js",
"static/chunks/23-0c40d6df9b62e9bb.js",
"static/chunks/main-app-6f229fdf4f3d16ab.js"
],
"pages": {
"/_app": []
"/_app": [
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/framework-f66176bb897dc684.js",
"static/chunks/main-ed23d165475d7128.js",
"static/chunks/pages/_app-6a626577ffa902a4.js"
],
"/_error": [
"static/chunks/webpack-d0ceac4fb78a3613.js",
"static/chunks/framework-f66176bb897dc684.js",
"static/chunks/main-ed23d165475d7128.js",
"static/chunks/pages/_error-1be831200e60c5c0.js"
]
},
"ampFirstPages": []
}
1 change: 1 addition & 0 deletions server/build/cache/eslint/.cache_1oeva8s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/home/pi/Security-Cam/server/src/app/archive/page.tsx":"1","/home/pi/Security-Cam/server/src/app/layout.tsx":"2","/home/pi/Security-Cam/server/src/app/page.tsx":"3","/home/pi/Security-Cam/server/src/app/settings/page.tsx":"4","/home/pi/Security-Cam/server/src/components/BTDeviceList.tsx":"5","/home/pi/Security-Cam/server/src/components/ClientVideoPlayer.tsx":"6","/home/pi/Security-Cam/server/src/components/DirectoryPicker.tsx":"7","/home/pi/Security-Cam/server/src/components/Navbar.tsx":"8","/home/pi/Security-Cam/server/src/components/Navitem.tsx":"9","/home/pi/Security-Cam/server/src/components/SystemMonitor.tsx":"10","/home/pi/Security-Cam/server/src/components/WiFiDeviceList.tsx":"11","/home/pi/Security-Cam/server/src/lib/helpers.ts":"12","/home/pi/Security-Cam/server/src/types/BTDeviceTypes.ts":"13"},{"size":4942,"mtime":1724356822335,"results":"14","hashOfConfig":"15"},{"size":707,"mtime":1724355300901,"results":"16","hashOfConfig":"15"},{"size":1127,"mtime":1724355300901,"results":"17","hashOfConfig":"15"},{"size":3472,"mtime":1724355300901,"results":"18","hashOfConfig":"15"},{"size":640,"mtime":1724355300905,"results":"19","hashOfConfig":"15"},{"size":1416,"mtime":1724236567976,"results":"20","hashOfConfig":"15"},{"size":2010,"mtime":1724355300905,"results":"21","hashOfConfig":"15"},{"size":773,"mtime":1724356513235,"results":"22","hashOfConfig":"15"},{"size":409,"mtime":1724223021345,"results":"23","hashOfConfig":"15"},{"size":1862,"mtime":1724236591536,"results":"24","hashOfConfig":"15"},{"size":652,"mtime":1724355300905,"results":"25","hashOfConfig":"15"},{"size":476,"mtime":1724355300905,"results":"26","hashOfConfig":"15"},{"size":55,"mtime":1724355300905,"results":"27","hashOfConfig":"15"},{"filePath":"28","messages":"29","suppressedMessages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"x28yrk",{"filePath":"31","messages":"32","suppressedMessages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"37","messages":"38","suppressedMessages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","suppressedMessages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","suppressedMessages":"45","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"46","messages":"47","suppressedMessages":"48","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"49","messages":"50","suppressedMessages":"51","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"52","messages":"53","suppressedMessages":"54","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"55","messages":"56","suppressedMessages":"57","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"58","messages":"59","suppressedMessages":"60","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"61","messages":"62","suppressedMessages":"63","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"64","messages":"65","suppressedMessages":"66","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/pi/Security-Cam/server/src/app/archive/page.tsx",[],[],"/home/pi/Security-Cam/server/src/app/layout.tsx",[],[],"/home/pi/Security-Cam/server/src/app/page.tsx",[],[],"/home/pi/Security-Cam/server/src/app/settings/page.tsx",[],[],"/home/pi/Security-Cam/server/src/components/BTDeviceList.tsx",[],[],"/home/pi/Security-Cam/server/src/components/ClientVideoPlayer.tsx",["67"],[],"/home/pi/Security-Cam/server/src/components/DirectoryPicker.tsx",["68"],[],"/home/pi/Security-Cam/server/src/components/Navbar.tsx",[],[],"/home/pi/Security-Cam/server/src/components/Navitem.tsx",[],[],"/home/pi/Security-Cam/server/src/components/SystemMonitor.tsx",[],[],"/home/pi/Security-Cam/server/src/components/WiFiDeviceList.tsx",[],[],"/home/pi/Security-Cam/server/src/lib/helpers.ts",[],[],"/home/pi/Security-Cam/server/src/types/BTDeviceTypes.ts",[],[],{"ruleId":"69","severity":1,"message":"70","line":35,"column":17,"nodeType":"71","endLine":39,"endColumn":19},{"ruleId":"72","severity":1,"message":"73","line":25,"column":8,"nodeType":"74","endLine":25,"endColumn":37,"suggestions":"75"},"@next/next/no-img-element","Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element","JSXOpeningElement","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'fetchDirectories'. Either include it or remove the dependency array.","ArrayExpression",["76"],{"desc":"77","fix":"78"},"Update the dependencies array to be: [directoriesUrl, currentPath, fetchDirectories]",{"range":"79","text":"80"},[786,815],"[directoriesUrl, currentPath, fetchDirectories]"]
Binary file modified server/build/cache/webpack/client-development/0.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/client-development/1.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/client-development/2.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/client-development/3.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/client-development/index.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/client-development/index.pack.gz.old
Binary file not shown.
Binary file modified server/build/cache/webpack/client-production/0.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/client-production/1.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/client-production/2.pack
Binary file not shown.
Binary file not shown.
Binary file modified server/build/cache/webpack/client-production/index.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/client-production/index.pack.old
Binary file not shown.
Binary file modified server/build/cache/webpack/edge-server-production/index.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/edge-server-production/index.pack.old
Binary file not shown.
Binary file modified server/build/cache/webpack/server-development/0.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/server-development/1.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/server-development/2.pack.gz
Binary file not shown.
Binary file modified server/build/cache/webpack/server-development/index.pack.gz
Binary file not shown.
Binary file not shown.
Binary file modified server/build/cache/webpack/server-production/0.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/server-production/1.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/server-production/2.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/server-production/index.pack
Binary file not shown.
Binary file modified server/build/cache/webpack/server-production/index.pack.old
Binary file not shown.
1 change: 1 addition & 0 deletions server/build/export-marker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"hasExportPathMap":false,"exportTrailingSlash":false,"isNextImageImported":false}
1 change: 1 addition & 0 deletions server/build/images-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[16,32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":60,"formats":["image/webp"],"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"inline","remotePatterns":[],"unoptimized":false,"sizes":[640,750,828,1080,1200,1920,2048,3840,16,32,48,64,96,128,256,384]}}
1 change: 1 addition & 0 deletions server/build/next-minimal-server.js.nft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"files":["../node_modules/styled-jsx/index.js","../node_modules/styled-jsx/package.json","../node_modules/styled-jsx/dist/index/index.js","../node_modules/react/package.json","../node_modules/react/index.js","../node_modules/client-only/package.json","../node_modules/react/cjs/react.production.min.js","../node_modules/client-only/index.js","../node_modules/styled-jsx/style.js","../node_modules/next/dist/compiled/next-server/server.runtime.prod.js","../node_modules/next/package.json","../node_modules/next/dist/server/body-streams.js","../node_modules/next/dist/lib/picocolors.js","../node_modules/next/dist/shared/lib/constants.js","../node_modules/next/dist/server/web/utils.js","../node_modules/next/dist/client/components/app-router-headers.js","../node_modules/next/dist/server/lib/trace/tracer.js","../node_modules/next/dist/server/lib/trace/constants.js","../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../node_modules/next/dist/shared/lib/modern-browserslist-target.js","../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../node_modules/next/dist/shared/lib/runtime-config.external.js","../node_modules/next/dist/compiled/lru-cache/package.json","../node_modules/next/dist/compiled/node-html-parser/package.json","../node_modules/next/dist/compiled/ws/package.json","../node_modules/@swc/helpers/_/_interop_require_default/package.json","../node_modules/next/dist/client/components/async-local-storage.js","../node_modules/next/dist/compiled/lru-cache/index.js","../node_modules/next/dist/compiled/node-html-parser/index.js","../node_modules/next/dist/compiled/ws/index.js","../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../node_modules/@swc/helpers/package.json","../node_modules/next/dist/compiled/jsonwebtoken/package.json","../node_modules/next/dist/shared/lib/error-source.js","../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../node_modules/next/dist/compiled/jsonwebtoken/index.js","../node_modules/next/dist/compiled/debug/package.json","../node_modules/next/dist/lib/semver-noop.js","../node_modules/next/dist/compiled/debug/index.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/app-page/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/app-page/module.compiled.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/amp-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/app-router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/entrypoints.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/head-manager-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/hooks-client-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/html-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/image-config-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/loadable.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/router-context.js","../node_modules/next/dist/server/future/route-modules/pages/vendored/contexts/server-inserted-html.js","../node_modules/next/dist/server/future/route-modules/pages/module.compiled.js"]}
1 change: 1 addition & 0 deletions server/build/next-server.js.nft.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/build/prerender-manifest.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/build/prerender-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":4,"routes":{"/favicon.ico":{"initialHeaders":{"cache-control":"public, max-age=0, must-revalidate","content-type":"image/x-icon","x-next-cache-tags":"_N_T_/layout,_N_T_/favicon.ico/layout,_N_T_/favicon.ico/route,_N_T_/favicon.ico"},"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data;.*"}],"initialRevalidateSeconds":false,"srcRoute":"/favicon.ico","dataRoute":null},"/":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data;.*"}],"initialRevalidateSeconds":false,"srcRoute":"/","dataRoute":"/index.rsc"},"/settings":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data;.*"}],"initialRevalidateSeconds":false,"srcRoute":"/settings","dataRoute":"/settings.rsc"},"/archive":{"experimentalBypassFor":[{"type":"header","key":"Next-Action"},{"type":"header","key":"content-type","value":"multipart/form-data;.*"}],"initialRevalidateSeconds":false,"srcRoute":"/archive","dataRoute":"/archive.rsc"}},"dynamicRoutes":{},"notFoundRoutes":[],"preview":{"previewModeId":"f4f893af980a4ebc80dc9a17564b4eef","previewModeSigningKey":"7ba5cc34267be0b7caf65317149fcd5e7e2aa712455e641a06b0c0dba525ca6d","previewModeEncryptionKey":"bfc661cb0c89c787fa08597bc3c59f1ddb71aa5ead6398e37f4b03cd346f7b56"}}
Loading

0 comments on commit bd1721a

Please sign in to comment.