Prepares JVB script to be part of one common parsing script.

main
Yasen Pramatarov 2024-05-26 22:01:54 +03:00
parent 58ecdde699
commit 9dc952a624
1 changed files with 5 additions and 4 deletions

View File

@ -11,8 +11,8 @@ DB="./jitsi-stats.db"
### ###
# SQLite queries # SQLite queries
db_get_state='SELECT filename, filetime, filesize, position, inode FROM state WHERE id = 1;' db_get_state="SELECT filename, filetime, filesize, position, inode FROM state WHERE jitsi_component = 'JVB';"
db_set_state_template="UPDATE state SET time=datetime('now'), filename='%s', filetime='%s', filesize='%s', position='%s', inode='%s' WHERE id = 1;" db_set_state_template="UPDATE state SET time=datetime('now'), filename='%s', filetime='%s', filesize='%s', position='%s', inode='%s' WHERE jitsi_component = 'JVB';"
db_insert_template="INSERT INTO conferences (conference_name, conference_id, start, end) VALUES ('%s', '%s', '%s', '%s');" db_insert_template="INSERT INTO conferences (conference_name, conference_id, start, end) VALUES ('%s', '%s', '%s', '%s');"
db_create=" db_create="
DROP TABLE IF EXISTS conferences; DROP TABLE IF EXISTS conferences;
@ -26,6 +26,7 @@ CREATE TABLE conferences (
DROP TABLE IF EXISTS state; DROP TABLE IF EXISTS state;
CREATE TABLE state ( CREATE TABLE state (
id INTEGER PRIMARY_KEY, id INTEGER PRIMARY_KEY,
jitsi_component TEXT,
time TEXT, time TEXT,
filename TEXT, filename TEXT,
filetime INTEGER, filetime INTEGER,
@ -33,11 +34,11 @@ CREATE TABLE state (
position INTEGER CHECK(typeof(position)='integer'), position INTEGER CHECK(typeof(position)='integer'),
inode INTEGER inode INTEGER
); );
INSERT OR REPLACE INTO state (id, time, filename, filetime, filesize, position, inode) VALUES (1, '1970-01-01 00:00:00.000', '', 0, 0, 0, 0);" INSERT OR REPLACE INTO state (id, jitsi_component, time, filename, filetime, filesize, position, inode) VALUES (1, 'JVB', '1970-01-01 00:00:00.000', '', 0, 0, 0, 0);"
db_flush=" db_flush="
DELETE FROM conferences; DELETE FROM conferences;
DELETE FROM state; DELETE FROM state;
INSERT OR REPLACE INTO state (id, time, filename, filetime, filesize, position, inode) VALUES (1, '1970-01-01 00:00:00.000', '', 0, 0, 0, 0);" INSERT OR REPLACE INTO state (id, jitsi_component, time, filename, filetime, filesize, position, inode) VALUES (1, 'JVB', '1970-01-01 00:00:00.000', '', 0, 0, 0, 0);"
help="Usage:\n\t$0 [OPTION]\nOptions:\n\t--create-db|-d - create the database\n\t--flush|-f - flush the tables\n\t--check|-c - check for new data\n\t--parse|-p [-v] - parse the logs [verbosely]" help="Usage:\n\t$0 [OPTION]\nOptions:\n\t--create-db|-d - create the database\n\t--flush|-f - flush the tables\n\t--check|-c - check for new data\n\t--parse|-p [-v] - parse the logs [verbosely]"