mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
fix colorscheme for seearched anime and watched ep
This commit is contained in:
parent
e0df1a8dbf
commit
63450b38ec
44
ani-cli
44
ani-cli
@ -121,14 +121,17 @@ check_db() {
|
|||||||
# Return number of matches for anime/episode in db
|
# Return number of matches for anime/episode in db
|
||||||
# echo "$1 $2"
|
# echo "$1 $2"
|
||||||
if [[ "$2" == "search" ]]; then
|
if [[ "$2" == "search" ]]; then
|
||||||
stmt="SELECT DISTINCT COUNT(*) FROM search_history \
|
stmt="SELECT DISTINCT COUNT(*) \
|
||||||
WHERE anime_name = '$1'"
|
FROM search_history \
|
||||||
|
WHERE anime_name = '$1';"
|
||||||
res="$(printf '%s\n' $stmt | sqlite3 -noheader $history_db | tail -1)"
|
res="$(printf '%s\n' $stmt | sqlite3 -noheader $history_db | tail -1)"
|
||||||
# echo "QUERY RESULT $res"
|
# echo "QUERY RESULT $res"
|
||||||
return "$res"
|
return "$res"
|
||||||
else
|
else
|
||||||
stmt="SELECT DISTINCT COUNT(*) FROM watch_history \
|
stmt="SELECT DISTINCT COUNT(*) \
|
||||||
WHERE anime_name = '$1' AND episode_number = $2"
|
FROM watch_history \
|
||||||
|
WHERE anime_name = '$1' \
|
||||||
|
AND episode_number = $2;"
|
||||||
res="$(printf '%s\n' $stmt | sqlite3 -noheader $history_db | tail -1)"
|
res="$(printf '%s\n' $stmt | sqlite3 -noheader $history_db | tail -1)"
|
||||||
# echo "QUERY RESULT $res"
|
# echo "QUERY RESULT $res"
|
||||||
return "$res"
|
return "$res"
|
||||||
@ -140,12 +143,12 @@ update_date() {
|
|||||||
datetime=$(date +'%Y-%m-%d %H:%M:%S')
|
datetime=$(date +'%Y-%m-%d %H:%M:%S')
|
||||||
if [[ "$2" == "search" ]]; then
|
if [[ "$2" == "search" ]]; then
|
||||||
stmt="UPDATE search_history SET search_date = '$datetime' \
|
stmt="UPDATE search_history SET search_date = '$datetime' \
|
||||||
WHERE anime_name = '$1'" &&
|
WHERE anime_name = '$1';" &&
|
||||||
return 0 || return 1
|
return 0 || return 1
|
||||||
else
|
else
|
||||||
stmt="UPDATE watch_history SET watch_date = '$datetime' \
|
stmt="UPDATE watch_history SET watch_date = '$datetime' \
|
||||||
WHERE anime_name = '$1' \
|
WHERE anime_name = '$1' \
|
||||||
AND episode_number = $2" &&
|
AND episode_number = $2;" &&
|
||||||
return 0 || return 1
|
return 0 || return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -171,12 +174,12 @@ insert_history() {
|
|||||||
else
|
else
|
||||||
if [[ "$2" == "search" ]]; then
|
if [[ "$2" == "search" ]]; then
|
||||||
stmt="INSERT INTO search_history(anime_name, search_date) \
|
stmt="INSERT INTO search_history(anime_name, search_date) \
|
||||||
VALUES('$1', '$datetime')"
|
VALUES('$1', '$datetime');"
|
||||||
printf "%s\n" "$stmt" | sqlite3 -noheader "$history_db"
|
printf "%s\n" "$stmt" | sqlite3 -noheader "$history_db"
|
||||||
else
|
else
|
||||||
stmt="INSERT INTO \
|
stmt="INSERT INTO \
|
||||||
watch_history(anime_name, episode_number, watch_date) \
|
watch_history(anime_name, episode_number, watch_date) \
|
||||||
VALUES('$1', '$2', '$datetime')"
|
VALUES('$1', '$2', '$datetime');"
|
||||||
printf "%s\n" "$stmt" | sqlite3 -noheader "$history_db"
|
printf "%s\n" "$stmt" | sqlite3 -noheader "$history_db"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -187,7 +190,9 @@ get_search_query() {
|
|||||||
# Query the anime to stream/download
|
# Query the anime to stream/download
|
||||||
|
|
||||||
# Get search history
|
# Get search history
|
||||||
stmt="SELECT DISTINCT anime_name FROM search_history"
|
stmt="SELECT DISTINCT anime_name \
|
||||||
|
FROM search_history \
|
||||||
|
ORDER BY search_date DESC;"
|
||||||
# cnt_stmt="SELECT DISTINCT COUNT(*) FROM search_history"
|
# cnt_stmt="SELECT DISTINCT COUNT(*) FROM search_history"
|
||||||
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
||||||
# hist=$(echo "$stmt" | sqlite3 -noheader "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
# hist=$(echo "$stmt" | sqlite3 -noheader "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
||||||
@ -305,9 +310,8 @@ episode_selection() {
|
|||||||
printf "Range of episodes can be specified: start_number end_number\n"
|
printf "Range of episodes can be specified: start_number end_number\n"
|
||||||
printf "%s\n" "Anime ID: $anime_id"
|
printf "%s\n" "Anime ID: $anime_id"
|
||||||
stmt="SELECT DISTINCT episode_number \
|
stmt="SELECT DISTINCT episode_number \
|
||||||
FROM watch_history WHERE anime_name = '$anime_id'"
|
FROM watch_history \
|
||||||
# cnt_stmt="SELECT DISTINCT COUNT(*) \
|
WHERE anime_name = '$anime_id';"
|
||||||
# FROM watch_history WHERE anime_name = '$anime_id'"
|
|
||||||
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
||||||
# hist=$(echo "$stmt" | sqlite3 "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
# hist=$(echo "$stmt" | sqlite3 "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
||||||
if [[ "$VERBOSE" -eq 1 ]]; then
|
if [[ "$VERBOSE" -eq 1 ]]; then
|
||||||
@ -324,7 +328,7 @@ episode_selection() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# printf "WATCH HISTORY: %s\n" "$watch_history"
|
printf "WATCH HISTORY: %s\n" "$watch_history"
|
||||||
# cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db" | tail -1)
|
# cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 "$history_db" | tail -1)
|
||||||
# printf "NUM EPISODES: $last_ep_number"
|
# printf "NUM EPISODES: $last_ep_number"
|
||||||
# get user choice and set the start and end
|
# get user choice and set the start and end
|
||||||
@ -353,7 +357,8 @@ open_episode() {
|
|||||||
if [ $episode -lt 1 ] || [ $episode -gt $last_ep_number ]; then
|
if [ $episode -lt 1 ] || [ $episode -gt $last_ep_number ]; then
|
||||||
err "Episode out of range"
|
err "Episode out of range"
|
||||||
stmt="SELECT DISTINCT episode_number \
|
stmt="SELECT DISTINCT episode_number \
|
||||||
FROM watch_history WHERE anime_name = '$anime_id'"
|
FROM watch_history \
|
||||||
|
WHERE anime_name = '$anime_id';"
|
||||||
# hist=$(echo "$stmt" | sqlite3 "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
# hist=$(echo "$stmt" | sqlite3 "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
||||||
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
||||||
if [[ "$VERBOSE" -eq 1 ]]; then
|
if [[ "$VERBOSE" -eq 1 ]]; then
|
||||||
@ -393,6 +398,7 @@ open_episode() {
|
|||||||
" "$logfile" >"${logfile}.new" && mv "${logfile}.new" "$logfile"
|
" "$logfile" >"${logfile}.new" && mv "${logfile}.new" "$logfile"
|
||||||
|
|
||||||
setsid -f $player_fn --http-header-fields="Referer: $dpage_url" "$video_url" >/dev/null 2>&1
|
setsid -f $player_fn --http-header-fields="Referer: $dpage_url" "$video_url" >/dev/null 2>&1
|
||||||
|
# $player_fn --http-header-fields="Referer: $dpage_url" "$video_url"
|
||||||
else
|
else
|
||||||
printf "Downloading episode $episode ...\n"
|
printf "Downloading episode $episode ...\n"
|
||||||
printf "%s\n" "$video_url"
|
printf "%s\n" "$video_url"
|
||||||
@ -455,15 +461,17 @@ shift $((OPTIND - 1))
|
|||||||
########
|
########
|
||||||
|
|
||||||
if [[ "$list_history" -eq 1 ]]; then
|
if [[ "$list_history" -eq 1 ]]; then
|
||||||
stmt="SELECT DISTINCT anime_name FROM search_history"
|
stmt="SELECT DISTINCT anime_name \
|
||||||
cnt_stmt="SELECT DISTINCT COUNT(*) FROM search_history"
|
FROM search_history \
|
||||||
|
ORDER BY search_date DESC"
|
||||||
|
# cnt_stmt="SELECT DISTINCT COUNT(*) FROM search_history"
|
||||||
# hist=$(echo "$stmt" | sqlite3 "$history_db")
|
# hist=$(echo "$stmt" | sqlite3 "$history_db")
|
||||||
# hist=$(echo "$stmt" | sqlite3 -noheader "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
# hist=$(echo "$stmt" | sqlite3 -noheader "$history_db" | awk '{ if ( NR > 2 ) { print } }')
|
||||||
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
hist=$(echo "$stmt" | sqlite3 -noheader "$history_db")
|
||||||
cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 -noheader "$history_db")
|
# cnt=$(printf "%s\n" "$cnt_stmt" | sqlite3 -noheader "$history_db")
|
||||||
printf "%s\n" "${hist[@]}" |
|
printf "%s\n" "${hist[@]}" |
|
||||||
rofi -config "$config_dir"/meh.rasi \
|
rofi -config "$config_dir"/meh.rasi \
|
||||||
-dmenu -l "$cnt" -i -p "Search History"
|
-dmenu -l 12 -i -p "Search History"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -88,7 +88,9 @@ element.alternate.urgent {
|
|||||||
}
|
}
|
||||||
element.alternate.active {
|
element.alternate.active {
|
||||||
background-color: @alternate-active-background;
|
background-color: @alternate-active-background;
|
||||||
text-color: @alternate-active-foreground;
|
/* text-color: @alternate-active-foreground; */
|
||||||
|
text-color: #51afef;
|
||||||
|
border-color: #51afef;
|
||||||
}
|
}
|
||||||
scrollbar {
|
scrollbar {
|
||||||
width: 4px ;
|
width: 4px ;
|
||||||
|
Loading…
Reference in New Issue
Block a user