From 8a531d1818757bfbd1784c9cdc7ad6d6076a2384 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Sun, 21 Nov 2021 21:43:48 -0800 Subject: [PATCH] update logging in search_history function --- ani-cli | 327 +++++++++++++++++++++++++++----------------------------- 1 file changed, 156 insertions(+), 171 deletions(-) diff --git a/ani-cli b/ani-cli index 0445b65..edcb672 100755 --- a/ani-cli +++ b/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'") if [[ "${res/ //}" == "" ]]; then 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')" if [[ "$?" -ne 0 ]]; then err "Error inserting row $line" @@ -205,7 +205,7 @@ sync_search_history() { ((++cnt)) fi 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() { @@ -235,21 +235,6 @@ sync_watch_history() { log "Episode: $episode_num found in the db... skipping" fi 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")" log "Inserted $cnt rows into watch_history table" } @@ -473,17 +458,17 @@ open_episode() { video_url=$(get_links "$dpage_url") case $video_url in - *streamtape*) - # If direct download not available then scrape streamtape.com - BROWSER=${BROWSER:-firefox} - printf "scraping streamtape.com\n" - video_url=$(curl -s "$video_url" | sed -n -E ' + *streamtape*) + # If direct download not available then scrape streamtape.com + BROWSER=${BROWSER:-firefox} + printf "scraping streamtape.com\n" + video_url=$(curl -s "$video_url" | sed -n -E ' /^