most of program1 is done, shape of program2, actual app to be started
This commit is contained in:
25
model/register_video.sh
Normal file
25
model/register_video.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
# register_video \
|
||||
# file_name raw_file duration mp4_file \
|
||||
# rotated_file thumbnail_file record_datetime \
|
||||
# day_of_week record_time \
|
||||
# lat long address
|
||||
register_video() {
|
||||
local file_name=$1
|
||||
local raw_file=$2
|
||||
local duration=$3
|
||||
local mp4_file=$4
|
||||
local rotated_file=$5
|
||||
local thumbnail_file=$6
|
||||
local record_datetime=${7:-$(date +%s)}
|
||||
local day_of_week=${8:-$(date +'%A')}
|
||||
local lat=${9:-0.000000}
|
||||
local long=${10:-0.000000}
|
||||
local address=${11:-Unknown}
|
||||
if [ -z "$raw_file" ] || [ -z "$mp4_file" ]; then
|
||||
echo "Error: raw_file and mp4_file are required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sqlite3 $DANCE_VIDEOS_DB "INSERT OR REPLACE INTO videos (file_name, raw_file, duration, mp4_file, rotated_file, thumbnail_file, record_datetime, day_of_week, lat, long, address) VALUES('$file_name','$raw_file', '$duration', '$mp4_file', '$rotated_file', '$thumbnail_file', $record_datetime, '$day_of_week', $lat, $long, '$address')"
|
||||
}
|
||||
export -f register_video
|
||||
14
model/videos.sql
Normal file
14
model/videos.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE IF NOT EXISTS videos (
|
||||
file_name VARCHAR(255) PRIMARY KEY,
|
||||
raw_file VARCHAR(255) UNIQUE,
|
||||
duration DECIMAL(10,2),
|
||||
mp4_file VARCHAR(255),
|
||||
rotated_file VARCHAR(255),
|
||||
thumbnail_file VARCHAR(255),
|
||||
record_datetime TIMESTAMP,
|
||||
day_of_week VARCHAR(50),
|
||||
record_time TIME GENERATED ALWAYS AS (TIME(record_datetime)) VIRTUAL,
|
||||
lat DECIMAL(10,6),
|
||||
long DECIMAL(11,7),
|
||||
address VARCHAR(255)
|
||||
);
|
||||
Reference in New Issue
Block a user