mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
update code formatting
This commit is contained in:
parent
37f60ffb21
commit
55470e87e9
@ -22,7 +22,6 @@ IS_DOWNLOAD=0
|
|||||||
quit="6. Quit"
|
quit="6. Quit"
|
||||||
options="1. Stream|2. Download|3. Continue|4. Play from File|5. Sync History|$quit"
|
options="1. Stream|2. Download|3. Continue|4. Play from File|5. Sync History|$quit"
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# Functions #
|
# Functions #
|
||||||
#############
|
#############
|
||||||
@ -232,7 +231,6 @@ find_videos() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
# Main #
|
# Main #
|
||||||
########
|
########
|
||||||
@ -382,4 +380,3 @@ case "$selection" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
39
db.sh
39
db.sh
@ -9,45 +9,6 @@ log() {
|
|||||||
printf "%s\n" "$1"
|
printf "%s\n" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_search_history() {
|
|
||||||
cnt=0
|
|
||||||
temp_db="/tmp/aniwrapper_tmp_history.sqlite3"
|
|
||||||
while read -r line; do
|
|
||||||
anime_name=$(awk -F '|' '{print $2}' <<<"$line")
|
|
||||||
res=$(sqlite3 -noheader "$DIR/$DB" <<<"SELECT anime_name FROM search_history WHERE anime_name = '$anime_name'")
|
|
||||||
if [[ "${res/ //}" == "" ]]; then
|
|
||||||
log "Adding $line to search history..."
|
|
||||||
search_date=$(awk -F '|' '{print $3}' <<<"$line")
|
|
||||||
sqlite3 "$DIR/$DB" <<<"INSERT INTO search_history(anime_name, search_date) VALUES('$anime_name', '$search_date')"
|
|
||||||
if [[ "$?" -ne 0 ]]; then
|
|
||||||
log "Error inserting row $line"
|
|
||||||
fi
|
|
||||||
((++cnt))
|
|
||||||
fi
|
|
||||||
done <<<"$(sqlite3 -noheader "$temp_db" <<<"SELECT DISTINCT * FROM search_history")"
|
|
||||||
log "Inserted $cnt rows into search_history table"
|
|
||||||
}
|
|
||||||
|
|
||||||
sync_watch_history() {
|
|
||||||
cnt=0
|
|
||||||
temp_db="/tmp/aniwrapper_tmp_history.sqlite3"
|
|
||||||
while read -r line; do
|
|
||||||
anime_name=$(awk -F '|' '{print $2}' <<<"$line")
|
|
||||||
res=$(sqlite3 -noheader "$DIR/$DB" <<<"SELECT anime_name FROM watch_history WHERE anime_name = '$anime_name'")
|
|
||||||
if [[ "${res/ //}" == "" ]]; then
|
|
||||||
log "Adding $line to watch history..."
|
|
||||||
episode_num=$(awk -F '|' '{print $3}' <<<"$line")
|
|
||||||
watch_date=$(awk -F '|' '{print $NF}' <<<"$line")
|
|
||||||
sqlite3 "$DIR/$DB" <<<"INSERT INTO watch_history(anime_name, episode_number, watch_date) VALUES('$anime_name', '$episode_num', '$watch_date')"
|
|
||||||
if [[ "$?" -ne 0 ]]; then
|
|
||||||
log "Error inserting row $line"
|
|
||||||
fi
|
|
||||||
((++cnt))
|
|
||||||
fi
|
|
||||||
done <<<"$(sqlite3 -noheader "$temp_db" <<<"SELECT DISTINCT * FROM watch_history")"
|
|
||||||
log "Inserted $cnt rows into watch_history table"
|
|
||||||
}
|
|
||||||
|
|
||||||
while getopts 'cdrqCs' OPT; do
|
while getopts 'cdrqCs' OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
c)
|
c)
|
||||||
|
Loading…
Reference in New Issue
Block a user