Improve parsing of peerflix

This commit is contained in:
coolneng 2022-11-26 23:47:55 +01:00
parent 2bafe12889
commit 36cffdcd00
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ player=mpv
data_file=$HOME/Documents/IT/peerflix-db.csv data_file=$HOME/Documents/IT/peerflix-db.csv
parse_csv() { parse_csv() {
show_name=$(echo "$1" | cut -d "=" -f 3 | awk -F "S[0-9]|[S|s]eason" '{print $1}' | tr -d "[:digit:]%" | tr +. " " | sed -e 's/[[:space:]]*$//') show_name=$(echo "$1" | cut -d "=" -f 3 | awk -F "S[0-9]|[S|s]eason|[C|c]omplete" '{print $1}' | tr -d "[:digit:]%" | tr +. " " | sed -e 's/[[:space:]]*$//')
episode=$(awk -F ',' -v var="$show_name" '$1 ~ var {print $2}' "$data_file") episode=$(awk -F ',' -v var="$show_name" '$1 ~ var {print $2}' "$data_file")
line_number=$(awk -F ',' -v var="$show_name" '$1 ~ var {print NR}' "$data_file") line_number=$(awk -F ',' -v var="$show_name" '$1 ~ var {print NR}' "$data_file")
} }