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

User story/1152 as a user i want to automatically download the videos from my otcamera upon connecting my usb stick #141

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c889903
WIP
randy-seng Jan 26, 2023
64379d2
WIP
randy-seng Jan 26, 2023
7f68dd2
WIP
randy-seng Jan 26, 2023
175571b
Add test data mocking the OTCamera's video folder
randy-seng Jan 26, 2023
4ef8ea5
Create new usb copy info csv file if it does not exist yet
randy-seng Jan 26, 2023
86b3240
WIP: Wire LEDs with actions
randy-seng Jan 26, 2023
fa95e29
Rename function
randy-seng Feb 16, 2023
0981309
Validate copy information parsed from csv file for inconsistencies
randy-seng Feb 17, 2023
f76f494
Turn off OTCamera when releasing power button
randy-seng Feb 17, 2023
b06c95d
Fix typo
randy-seng Feb 17, 2023
f98b60a
WIP: Wire usb copy script to OTCamera run script
randy-seng Feb 17, 2023
47119d4
Call super constructor for correct initialization of Observer class
randy-seng Feb 17, 2023
c159c60
Fix callbacks not being registered
randy-seng Feb 17, 2023
2f2d54f
Do not shutdown when debug flag is enabled
randy-seng Feb 21, 2023
3817411
Wait for power button release event only when physical power button i…
randy-seng Feb 21, 2023
7ef4da8
Configure power button
randy-seng Feb 21, 2023
53758aa
Use wifi LED in addition to the power and recording LED to indicate t…
randy-seng Feb 21, 2023
f97be3d
Add docstrings
randy-seng Feb 21, 2023
b46a826
Add builder method for usb copier
randy-seng Feb 21, 2023
f3ac296
Provide missing arguments
randy-seng Feb 21, 2023
17829f0
Add usb mount and unmount logic
randy-seng Feb 21, 2023
f14a55f
Allow existing mount directory
randy-seng Feb 21, 2023
0c6ed6c
Fix usb flash drive not being mounted
randy-seng Feb 21, 2023
9ecb5b1
Fix errorneous call to mount command
randy-seng Feb 21, 2023
a29e0a8
Change mount ownership from root to current user
randy-seng Feb 21, 2023
8bd6e10
Require fstab entry to have access to usb mount device
randy-seng Feb 21, 2023
6a16046
Add newly captured that are not on listen in the copy info CSV
randy-seng Feb 21, 2023
25cf34c
Don't close log when in debug mode
randy-seng Feb 21, 2023
a6209a7
Fix raspberry pi boot up problem
randy-seng Feb 22, 2023
cd92a21
Add usb mount point to config
randy-seng Feb 22, 2023
e0dee8a
Add usb mount point to config
randy-seng Feb 22, 2023
1ab58c2
Sort videos when updating copy information
randy-seng Feb 22, 2023
039f2e4
Change led blink behaviour on shutdown
randy-seng Feb 22, 2023
8f36eb8
Change video datastructure to set
randy-seng Feb 22, 2023
21c7065
Fix runtime error of set changing size
randy-seng Feb 22, 2023
c072734
Fix not existing method called
randy-seng Feb 22, 2023
d67f59f
Fix runtime error on set. Should work now!
randy-seng Feb 22, 2023
38fee6b
Fix typo
briemla Mar 20, 2023
5da1417
Move usb device path to config
randy-seng Mar 20, 2023
aca310d
Use existing user variable name instead of hardcoding it to otc
randy-seng Mar 20, 2023
7196506
Apply change requests
randy-seng Mar 20, 2023
22fda6d
Fix wrong evaluation shutdown request flag
randy-seng Mar 20, 2023
81dd0f1
Remove unused import
randy-seng Mar 20, 2023
848affb
Remove ignored button callback
randy-seng Mar 20, 2023
086947c
Merge branch 'master' into user-story/1152-as-a-user-i-want-to-automa…
randy-seng Mar 20, 2023
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
3 changes: 3 additions & 0 deletions OTCamera/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ def read_text_file(text_file: Path) -> str:
"""Path to the HTML to be displayed when OTCamera is offline"""
NUM_LOG_FILES_HTML = 2
"""Number of log files to be displayed on the status website"""
USB_MOUNT_POINT = "~/mnt/usb"
randy-seng marked this conversation as resolved.
Show resolved Hide resolved
USB_DEVICE = "/dev/sda1"

# Microsoft Teams WebHook
USE_MS_TEAMS_WEBHOOK = False
Expand All @@ -351,6 +353,7 @@ def read_text_file(text_file: Path) -> str:
"""The number of max failed HTTP Requests send attempts."""

VIDEO_DIR = str(Path(VIDEO_DIR).expanduser().resolve())
USB_MOUNT_POINT = str(Path(USB_MOUNT_POINT).expanduser().resolve())
PREVIEW_PATH = str(Path(PREVIEW_PATH).expanduser().resolve())
TEMPLATE_HTML_PATH = str(Path(TEMPLATE_HTML_PATH).expanduser().resolve())
INDEX_HTML_PATH = str(Path(INDEX_HTML_PATH).expanduser().resolve())
Expand Down
7 changes: 6 additions & 1 deletion raspi-files/install_otcamera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ apt install gldriver-test libgl1-mesa-dri -y
sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g"
sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/g"

echo " Setting power safing variables"
echo " Setting power saving variables"
RCLOCAL="/etc/rc.local"
cp $RCLOCAL $RCLOCAL.backup
sed $RCLOCAL -i -e "/^exit 0/i /usr/bin/tvservice -o"

echo " Setting USB mount access permissions"
FSTAB="/etc/fstab"
cp $FSTAB $FSTAB.backup
echo "/dev/sda1 /home/$SUDO_USER/mnt/usb auto noauto,uid=otc,gid=otc,umask=022 0 0" >> $FSTAB

echo "#### Setting up OTCamera"

echo " Installing packages"
Expand Down
15 changes: 13 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,23 @@ def parse_args() -> Path:
config.parse_user_config("~/user_config.yaml")


def usb_device_exists(usb_device: str) -> bool:
"""Whether a usb device at `usb_device` exists."""

return Path(usb_device).exists()


def main():
parse_args()

import OTCamera.record as record
if usb_device_exists(config.USB_DEVICE):
import usb_flash_drive_copy

usb_flash_drive_copy.main(config.VIDEO_DIR, config.USB_MOUNT_POINT)
else:
import OTCamera.record as record

record.main()
record.main()


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions tests/data/example_videos_folder/example_video_1.h264
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ajlsdkfjalksdjfklajsdlkfjklasdjfkl
laksdjflkasdjfklaj
3 changes: 3 additions & 0 deletions tests/data/example_videos_folder/example_video_2.h264
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
alskdjfaklsjef
alskdjfklasjdklf
asldkfjlaksdjf
4 changes: 4 additions & 0 deletions tests/data/otcamera-dev01_usb-copy-info.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
filename,copied,delete
otcamera-dev01_FR20_2022-11-03_15-26-27.h264,no,no
otcamera-dev01_FR20_2022-11-10_17-13-22.h264,no,no
otcamera-dev01_FR20_2022-11-10_17-31-16.h264,no,no
Loading