Skip to content

Commit

Permalink
機能追加: WebUI
Browse files Browse the repository at this point in the history
- SD-Cardへの録画がある場合にRAM-Diskに一旦書き込みをせずに直接SD-Cardに記録する機能のon/offの追加
- NASへの録画がある場合にNASのmountを常時監視する機能のon/offの追加
  • Loading branch information
mnakada committed Mar 5, 2024
1 parent e20dd91 commit f08e091
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
3 changes: 3 additions & 0 deletions overlay_rootfs/atom_patch/system_bin/mount_cifs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ STORAGE_CIFS=$(awk -F "=" '/STORAGE_CIFS *=/ {print $2}' $HACK_INI)
STORAGE_CIFSSERVER=$(awk -F "=" '/STORAGE_CIFSSERVER *=/ {gsub(/\/$/, "", $2); print $2}' $HACK_INI)
STORAGE_CIFSUSER=$(awk -F "=" '/STORAGE_CIFSUSER *=/ {print $2}' $HACK_INI)
STORAGE_CIFSPASSWD=$(awk -F "=" '/STORAGE_CIFSPASSWD *=/ {print $2}' $HACK_INI)
STORAGE_CIFSALWAYSMOUNT=$(awk -F "=" '/STORAGE_CIFSALWAYSMOUNT *=/ {print $2}' $HACK_INI)

[ "$1" = "watchdog" -a ! "$STORAGE_CIFSALWAYSMOUNT" = "on" ] && exit 0

if [ "$STORAGE_CIFS" = "on" -o "$STORAGE_CIFS" = "alarm" -o "$STORAGE_CIFS" = "record" ] && [ "$STORAGE_CIFSSERVER" != "" ]; then
mount | grep "$STORAGE_CIFSSERVER" > /dev/null && exit
Expand Down
1 change: 1 addition & 0 deletions overlay_rootfs/scripts/set_crontab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BEGIN {
printf("* * * * * /scripts/health_check.sh\n");
printf("* * * * * /scripts/lighttpd.sh watchdog >> /media/mmc/atomhack.log\n");
printf("* * * * * /scripts/rtspserver.sh watchdog >> /media/mmc/atomhack.log\n");
printf("* * * * * /atom_patch/system_bin/mount_cifs watchdog >> /media/mmc/atomhack.log\n");
}
/REBOOT_SCHEDULE *=/ {
Expand Down
7 changes: 5 additions & 2 deletions overlay_rootfs/scripts/set_icamera_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

HACK_INI=/tmp/hack.ini
STORAGE_SDCARD=$(awk -F "=" '/STORAGE_SDCARD *=/ {print $2}' $HACK_INI)
STORAGE_SDCARD_DIRECT_WRITE=$(awk -F "=" '/STORAGE_SDCARD_DIRECT_WRITE *=/ {print $2}' $HACK_INI)
FRAMERATE=$(awk -F "=" '/FRAMERATE *=/ {print $2}' $HACK_INI)
BITRATE_MAIN_AVC=$(awk -F "=" '/BITRATE_MAIN_AVC *=/ {print $2}' $HACK_INI)
BITRATE_SUB_HEVC=$(awk -F "=" '/BITRATE_SUB_HEVC *=/ {print $2}' $HACK_INI)
Expand All @@ -10,9 +11,11 @@ MINIMIZE_ALARM_CYCLE=$(awk -F "=" '/MINIMIZE_ALARM_CYCLE *=/ {print $2}' $HACK_I
AWS_VIDEO_DISABLE=$(awk -F "=" '/AWS_VIDEO_DISABLE *=/ {print $2}' $HACK_INI)

PERIODIC="ram"
[ "$STORAGE_SDCARD" = "on" -o "$STORAGE_SDCARD" = "record" ] && PERIODIC="sd"
ALARM="ram"
[ "$STORAGE_SDCARD" = "on" -o "$STORAGE_SDCARD" = "alarm" ] && ALARM="sd"
if [ "$STORAGE_SDCARD_DIRECT_WRITE" = "on" ] ; then
[ "$STORAGE_SDCARD" = "on" -o "$STORAGE_SDCARD" = "record" ] && PERIODIC="sd"
[ "$STORAGE_SDCARD" = "on" -o "$STORAGE_SDCARD" = "alarm" ] && ALARM="sd"
fi
/scripts/cmd mp4write $PERIODIC $ALARM

[ "$MINIMIZE_ALARM_CYCLE" = "on" ] && /scripts/cmd alarm 30
Expand Down
10 changes: 8 additions & 2 deletions web/source/vue/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<SettingSwitch i18n="recording.SDCard.motionRecording" v-model="storage_sdcard_alarm" :onOff="false" />
<SettingSwitch v-if="storage_sdcard" i18n="recording.SDCard.networkAccess" :titleOffset="2" v-model="config.STORAGE_SDCARD_PUBLISH" />
<SettingInput v-if="storage_sdcard" i18n="recording.SDCard.savePath" :titleOffset="2" :span="10" type="text" v-model="config.STORAGE_SDCARD_PATH" @input="FixPath('STORAGE_SDCARD_PATH')" />
<SettingSwitch v-if="storage_sdcard" i18n="recording.SDCard.directWrite" :titleOffset="2" v-model="config.STORAGE_SDCARD_DIRECT_WRITE" />
<SettingSwitch v-if="storage_sdcard" i18n="recording.SDCard.automaticDeletion" :titleOffset="2" v-model="config.STORAGE_SDCARD_REMOVE" />
<SettingInputNumber v-if="storage_sdcard && config.STORAGE_SDCARD_REMOVE === 'on'" i18n="recording.SDCard.daysToKeep" :titleOffset="2" :span="3" v-model="config.STORAGE_SDCARD_REMOVE_DAYS" :min="1" />
<SettingButton v-if="storage_sdcard" i18n="recording.SDCard.seeAllFiles" :span="4">
Expand All @@ -79,6 +80,7 @@
<SettingInput v-if="storage_cifs" i18n="recording.NAS.networkPath" :titleOffset="2" :span="10" type="text" v-model="config.STORAGE_CIFSSERVER" @input="FixPath('STORAGE_CIFSSERVER')" />
<SettingInput v-if="storage_cifs" i18n="recording.NAS.account" :titleOffset="2" type="text" v-model="config.STORAGE_CIFSUSER" />
<SettingInput v-if="storage_cifs" i18n="recording.NAS.password" :titleOffset="2" type="password" v-model="config.STORAGE_CIFSPASSWD" show-password />
<SettingSwitch v-if="storage_cifs" i18n="recording.NAS.alwaysMount" :titleOffset="2" v-model="config.STORAGE_CIFSALWAYSMOUNT" />
<SettingInput v-if="storage_cifs" i18n="recording.NAS.savePath" :titleOffset="2" :span="10" type="text" v-model="config.STORAGE_CIFS_PATH" @input="FixPath('STORAGE_CIFS_PATH')" />
<SettingSwitch v-if="storage_cifs" i18n="recording.NAS.automaticDeletion" :titleOffset="2" v-model="config.STORAGE_CIFS_REMOVE" />
<SettingInputNumber v-if="storage_cifs && config.STORAGE_CIFS_REMOVE === 'on'" i18n="recording.NAS.daysToKeep" :titleOffset="2" :span="3" v-model="config.STORAGE_CIFS_REMOVE_DAYS" :min="1" />
Expand Down Expand Up @@ -228,13 +230,15 @@
STORAGE_SDCARD_PATH: '%Y%m%d/%H%M%S',
STORAGE_SDCARD_REMOVE: 'off',
STORAGE_SDCARD_REMOVE_DAYS: 30,
STORAGE_SDCARD_DIRECT_WRITE: 'on',
STORAGE_CIFS: 'off', // on(alarm & record), alarm, record, off
STORAGE_CIFS_PATH: '%Y%m%d/%H%M%S',
STORAGE_CIFS_REMOVE: 'off',
STORAGE_CIFS_REMOVE_DAYS: 30,
STORAGE_CIFSSERVER: '',
STORAGE_CIFSUSER: '',
STORAGE_CIFSPASSWD: '',
STORAGE_CIFSALWAYSMOUNT: 'on',
TIMELAPSE: 'off',
TIMELAPSE_SCHEDULE: '0 4 * * 0:1:2:3:4:5:6', // -> /var/spool/crontabs/root
TIMELAPSE_PATH: '%Y%m%d%H%M',
Expand Down Expand Up @@ -715,9 +719,11 @@
}
if(this.config.STORAGE_SDCARD !== this.oldConfig.STORAGE_SDCARD) {
let periodic = 'ram';
if((this.config.STORAGE_SDCARD === 'on') || (this.config.STORAGE_SDCARD === 'record')) periodic = 'sd';
let alarm = 'ram';
if((this.config.STORAGE_SDCARD === 'on') || (this.config.STORAGE_SDCARD === 'alarm')) alarm = 'sd';
if(this.config.STORAGE_SDCARD_DIRECT_WRITE === 'on') {
if((this.config.STORAGE_SDCARD === 'on') || (this.config.STORAGE_SDCARD === 'record')) periodic = 'sd';
if((this.config.STORAGE_SDCARD === 'on') || (this.config.STORAGE_SDCARD === 'alarm')) alarm = 'sd';
}
execCmds.push(`mp4write ${periodic} ${alarm}`);
}
if(parseInt(this.config.FRAMERATE) !== parseInt(this.oldConfig.FRAMERATE)) {
Expand Down
6 changes: 6 additions & 0 deletions web/source/vue/i18n-en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ recording:
savePath:
title: Save PATH
tooltip: Describes the PATH to be recorded in the format specification of strftime. valid only for alarm_record
directWrite:
title: Direct Recording
tooltip: Normally, the recording is made once on the RAM-DISK and then copied to the SD-Card, but to save RAM, the recording is made directly on the SD-Card.
automaticDeletion:
title: Automatic Recording Deletion
tooltip: Automatically delete recordings from SD card
Expand Down Expand Up @@ -66,6 +69,9 @@ recording:
savePath:
title: Save PATH
tooltip: enter the storage PATH after the network name in strftime format ending with the file extension.
alwaysMount:
title: always mount
tooltip: Monitor the NAS to mount periodically.
automaticDeletion:
title: Automatic Recording Deletion
tooltip: Automatically delete recordings from the CIFS Server
Expand Down
6 changes: 6 additions & 0 deletions web/source/vue/i18n-ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ recording:
networkAccess:
title: ネットワークアクセス
tooltip: ATOMCamのSD-CardをCIFS(smb) serverとしてLAN内に公開します
directWrite:
title: 録画をSD-Cardに直接記録
tooltip: 通常は一旦RAM-DISKに録画した後SD-Cardにコピーしますが、RAMの節約のため直接SD-Cardに記録します
savePath:
title: 保存するPATH
tooltip: 録画するPATHをstrftimeの書式指定で記述します。最後に拡張子が付加されます。alarm_recordのみに有効
Expand Down Expand Up @@ -66,6 +69,9 @@ recording:
savePath:
title: 保存するPATH
tooltip: ネットワークPATH以降の録画するPATHをstrftimeの書式指定で記述します。最後に拡張子が付加されます
alwaysMount:
title: 常時マウント
tooltip: 定期的にNASをmountするように監視します
automaticDeletion:
title: ファイルの自動削除
tooltip: CIFS Serverに録画したファイルを自動的に削除します
Expand Down

0 comments on commit f08e091

Please sign in to comment.