mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
update logging in search_history function
This commit is contained in:
parent
7ee540601e
commit
8a531d1818
19
ani-cli
19
ani-cli
@ -197,7 +197,7 @@ sync_search_history() {
|
|||||||
res=$(sqlite3 -noheader "$HISTORY_DB" <<<"SELECT anime_name FROM search_history WHERE anime_name = '$anime_name'")
|
res=$(sqlite3 -noheader "$HISTORY_DB" <<<"SELECT anime_name FROM search_history WHERE anime_name = '$anime_name'")
|
||||||
if [[ "${res/ //}" == "" ]]; then
|
if [[ "${res/ //}" == "" ]]; then
|
||||||
search_date=$(awk -F '|' '{print $3}' <<<"$line")
|
search_date=$(awk -F '|' '{print $3}' <<<"$line")
|
||||||
printf "%s\n" "Adding ($anime_name|$search_date) to watch history..."
|
log "Adding ($anime_name|$search_date) to search history..."
|
||||||
sqlite3 "$HISTORY_DB" <<<"INSERT INTO search_history(anime_name, search_date) VALUES('$anime_name', '$search_date')"
|
sqlite3 "$HISTORY_DB" <<<"INSERT INTO search_history(anime_name, search_date) VALUES('$anime_name', '$search_date')"
|
||||||
if [[ "$?" -ne 0 ]]; then
|
if [[ "$?" -ne 0 ]]; then
|
||||||
err "Error inserting row $line"
|
err "Error inserting row $line"
|
||||||
@ -205,7 +205,7 @@ sync_search_history() {
|
|||||||
((++cnt))
|
((++cnt))
|
||||||
fi
|
fi
|
||||||
done <<<"$(sqlite3 -noheader "$temp_db" <<<"SELECT DISTINCT * FROM search_history")"
|
done <<<"$(sqlite3 -noheader "$temp_db" <<<"SELECT DISTINCT * FROM search_history")"
|
||||||
printf "%s\n" "Inserted $cnt rows into search_history table"
|
log "Inserted $cnt rows into search_history table"
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_watch_history() {
|
sync_watch_history() {
|
||||||
@ -235,21 +235,6 @@ sync_watch_history() {
|
|||||||
log "Episode: $episode_num found in the db... skipping"
|
log "Episode: $episode_num found in the db... skipping"
|
||||||
fi
|
fi
|
||||||
done <<<"${episodes[@]}"
|
done <<<"${episodes[@]}"
|
||||||
# for episode in "${eps[@]}"; do
|
|
||||||
# printf "\t%s\n" "ep: $episode"
|
|
||||||
# done
|
|
||||||
# echo "EPISODES: ${episodes[*]}"
|
|
||||||
# res=$(sqlite3 -noheader "$HISTORY_DB" <<<"SELECT anime_name FROM watch_history WHERE anime_name = '$anime_name'")
|
|
||||||
# if [[ "${res/ //}" == "" ]]; then
|
|
||||||
# episode_num=$(awk -F '|' '{print $3}' <<<"$line")
|
|
||||||
# watch_date=$(awk -F '|' '{print $NF}' <<<"$line")
|
|
||||||
# printf "%s\n" "Adding ($anime_name|$episode_num|$watch_date) to watch history..."
|
|
||||||
# sqlite3 "$HISTORY_DB" <<<"INSERT INTO watch_history(anime_name, episode_number, watch_date) VALUES('$anime_name', '$episode_num', '$watch_date')"
|
|
||||||
# if [[ "$?" -ne 0 ]]; then
|
|
||||||
# err "Error inserting row $line"
|
|
||||||
# fi
|
|
||||||
# ((++cnt))
|
|
||||||
# fi
|
|
||||||
done <<<"$(sqlite3 -noheader "$temp_db" <<<"SELECT DISTINCT anime_name FROM watch_history")"
|
done <<<"$(sqlite3 -noheader "$temp_db" <<<"SELECT DISTINCT anime_name FROM watch_history")"
|
||||||
log "Inserted $cnt rows into watch_history table"
|
log "Inserted $cnt rows into watch_history table"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user