Better json parsing

This commit is contained in:
2025-01-01 22:08:50 +02:00
parent d31276ac8b
commit e39c099f6c

View File

@@ -304,8 +304,8 @@ function menuSearch {
)"
title="${title//_/ }"
title="${title//-/ }"
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
| awk -F\" '{print $8}' \
seasonEpisode="$(jq '.[]' "$GRPOPPRO_PLAYLIST_FILE" \
| grep "mp4" \
| awk -F/ '{print $NF}' \
| awk -F. '{print $1}' \
| eval "$menu"\""$title" \"
@@ -314,10 +314,11 @@ function menuSearch {
message "Nothing Selected"
exit 0
fi
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
streamurl="$(jq '.[]' "$GRPOPPRO_PLAYLIST_FILE" \
| grep "mp4" \
| grep "${seasonEpisode}" \
| head -n1 \
| awk -F\" '{print $8}'
| awk -F\" '{print $4}'
)"
dumpData "$title" "$seasonEpisode"
play
@@ -336,8 +337,8 @@ function resume {
while true
do
sourceData
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
| awk -F\" '{print $8}' \
seasonEpisode="$(jq '.[]' "$GRPOPPRO_PLAYLIST_FILE" \
| grep "mp4" \
| awk -F/ '{print $NF}' \
| awk -F. '{print $1}' \
| sed -n -e "0,/$lastSeasonEpisodePlayed/!p" \
@@ -347,10 +348,10 @@ function resume {
message "Nothing Selected"
exit 0
fi
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" \
streamurl="$(jq '.[]' "$GRPOPPRO_PLAYLIST_FILE" \
| grep "${seasonEpisode}" \
| head -n1 \
| awk -F\" '{print $8}'
| awk -F\" '{print $4}'
)"
dumpData "$title" "$seasonEpisode"
play
@@ -495,10 +496,11 @@ if [[ "$#" -eq 3 ]]; then
episode="$3"
response="$(curlRequest "$apiurl/uploads/playlists/$internalid.txt")"
streamurl="$(echo "$response" \
| jq '.[]' \
| grep "mp4" \
| grep "${season}x${episode}" \
| head -n1 \
| awk -F\" '{print $8}'
| awk -F\" '{print $4}'
)"
title="${title//%20/ }"
capitalized_title="$(echo "$title" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)}1')"