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