mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
improvements
This commit is contained in:
parent
27d4dd5ec3
commit
9be6dccf79
7
ani-cli
7
ani-cli
@ -406,9 +406,10 @@ find_media() {
|
||||
fi
|
||||
|
||||
span=$(generate_span "Current directory: $inp")
|
||||
inputlist=$(generate_inputlist "$inp")
|
||||
watched_files=$(generate_file_watchedlist "$inp")
|
||||
logger "watched files -> $watched_files"
|
||||
# run in parallel in background?
|
||||
inputlist=$(generate_inputlist "$inp" &)
|
||||
watched_files=$(generate_file_watchedlist "$inp" &)
|
||||
wait
|
||||
selection=$(rofi -dmenu -only-match -async-pre-read 33 -config "$ROFI_CFG" \
|
||||
-l 12 -i -sep '|' -mesg "$span" -a "$watched_files" \
|
||||
-p "Enter selection" <<< "${inputlist[@]}")
|
||||
|
@ -48,7 +48,6 @@ Options:
|
||||
-f <path_to_directory> (no trailing slash) specify starting directory for play for file mode
|
||||
-Q <query> query the history database
|
||||
"
|
||||
exit 0
|
||||
}
|
||||
|
||||
logger() {
|
||||
@ -109,6 +108,7 @@ parse_args() {
|
||||
case "$OPT" in
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
v)
|
||||
VERBOSE=1
|
||||
@ -177,7 +177,7 @@ parse_args() {
|
||||
IS_CUSTOM_THEME=1
|
||||
;;
|
||||
*)
|
||||
logger "Invalid option"
|
||||
help_text
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@ -286,8 +286,7 @@ main() {
|
||||
quit
|
||||
;;
|
||||
*)
|
||||
logger "Invalid choice..."
|
||||
exit 1
|
||||
help_text
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
6
setup.sh
6
setup.sh
@ -43,11 +43,13 @@ run_setup() {
|
||||
log "Directory created"
|
||||
fi
|
||||
|
||||
log "CREATING/UPDATING HISTORY DATABASE TABLES"
|
||||
if [[ ! -f "$DIR/$DB" ]]; then
|
||||
log "CREATING HISTORY DATABASE"
|
||||
sqlite3 "$DIR/$DB" < sql/search_history_tbl.sql
|
||||
sqlite3 "$DIR/$DB" < sql/watch_history_tbl.sql
|
||||
sqlite3 "$DIR/$DB" < sql/file_history.sql
|
||||
log "FINISHED CREATING/UPDATING THE TABLES"
|
||||
log "FINISHED CREATING DB"
|
||||
fi
|
||||
|
||||
if [[ ! -d "$DIR/themes" ]]; then
|
||||
log "themes directory does not exist in filesystem... Creating and moving themes"
|
||||
|
@ -1,32 +1,3 @@
|
||||
DROP TABLE IF EXISTS temp_file_history;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS temp_file_history (
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
directory varchar(200) NOT NULL,
|
||||
filename varchar(200) NOT NULL,
|
||||
watch_date DATETIME NOT NULL,
|
||||
CHECK (LENGTH(directory) > 0),
|
||||
CHECK (LENGTH(filename) > 0),
|
||||
UNIQUE (directory, filename)
|
||||
);
|
||||
|
||||
-- make sure table has been set up at least once
|
||||
CREATE TABLE IF NOT EXISTS file_history (
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
directory varchar(200) NOT NULL,
|
||||
filename varchar(200) NOT NULL,
|
||||
watch_date DATETIME NOT NULL,
|
||||
CHECK (LENGTH(directory) > 0),
|
||||
CHECK (LENGTH(filename) > 0),
|
||||
UNIQUE (directory, filename)
|
||||
);
|
||||
|
||||
|
||||
INSERT OR IGNORE INTO temp_file_history
|
||||
SELECT * FROM file_history;
|
||||
|
||||
DROP TABLE file_history;
|
||||
|
||||
CREATE TABLE file_history (
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
directory varchar(200) NOT NULL,
|
||||
@ -36,9 +7,6 @@ CREATE TABLE file_history (
|
||||
CHECK (LENGTH(filename) > 0),
|
||||
UNIQUE (directory, filename)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX dir_filename_idx ON file_history (directory, filename);
|
||||
|
||||
INSERT INTO file_history
|
||||
SELECT * FROM temp_file_history;
|
||||
|
||||
DROP TABLE temp_file_history;
|
||||
|
@ -1,26 +1,3 @@
|
||||
DROP TABLE IF EXISTS temp_search_history;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS temp_search_history (
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name varchar(200) NOT NULL,
|
||||
search_date DATETIME NOT NULL,
|
||||
CHECK (LENGTH(anime_name) > 0),
|
||||
UNIQUE (anime_name, search_date)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS search_history (
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name varchar(200) NOT NULL,
|
||||
search_date DATETIME NOT NULL,
|
||||
CHECK (LENGTH(anime_name) > 0),
|
||||
UNIQUE (anime_name, search_date)
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO temp_search_history
|
||||
SELECT * FROM search_history;
|
||||
|
||||
DROP TABLE IF EXISTS search_history;
|
||||
|
||||
CREATE TABLE search_history (
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name varchar(200) NOT NULL,
|
||||
@ -31,8 +8,3 @@ CREATE TABLE search_history (
|
||||
|
||||
CREATE UNIQUE INDEX anime_search_idx ON search_history (anime_name, search_date);
|
||||
|
||||
INSERT INTO search_history
|
||||
SELECT * FROM temp_search_history;
|
||||
|
||||
DROP TABLE temp_search_history;
|
||||
|
||||
|
@ -1,41 +1,12 @@
|
||||
DROP TABLE IF EXISTS temp_watch_history;
|
||||
CREATE TABLE temp_watch_history (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name VARCHAR(200) NOT NULL,
|
||||
episode_number INTEGER NOT NULL,
|
||||
watch_date DATETIME NOT NULL,
|
||||
CHECK(LENGTH(anime_name) > 0),
|
||||
CHECK(episode_number > 0),
|
||||
UNIQUE(anime_name, episode_number, watch_date)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS watch_history (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name VARCHAR(200) NOT NULL,
|
||||
episode_number INTEGER NOT NULL,
|
||||
watch_date DATETIME NOT NULL,
|
||||
CHECK(LENGTH(anime_name) > 0),
|
||||
CHECK(episode_number > 0),
|
||||
UNIQUE(anime_name, episode_number, watch_date)
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO temp_watch_history
|
||||
SELECT * FROM watch_history;
|
||||
|
||||
DROP TABLE watch_history;
|
||||
|
||||
CREATE TABLE watch_history (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name VARCHAR(200) NOT NULL,
|
||||
episode_number INTEGER NOT NULL,
|
||||
id integer PRIMARY KEY AUTOINCREMENT,
|
||||
anime_name varchar(200) NOT NULL,
|
||||
episode_number integer NOT NULL,
|
||||
watch_date DATETIME NOT NULL,
|
||||
CHECK (LENGTH(anime_name) > 0),
|
||||
CHECK (episode_number > 0),
|
||||
UNIQUE (anime_name, episode_number, watch_date)
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS watch_anime_episode_idx ON watch_history (anime_name, episode_number);
|
||||
|
||||
INSERT INTO watch_history
|
||||
SELECT * FROM temp_watch_history;
|
||||
|
||||
DROP TABLE IF EXISTS temp_watch_history;
|
||||
|
Loading…
Reference in New Issue
Block a user