We know the game and we're gonna play it
This commit is contained in:
91
grpoppro
91
grpoppro
@@ -445,6 +445,43 @@ function getHistory {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSeries {
|
||||||
|
# Two requests to the api
|
||||||
|
basics "$1"
|
||||||
|
getInternalID "$simpleurl"
|
||||||
|
season="$2"
|
||||||
|
episode="$3"
|
||||||
|
response="$(curlRequest "$apiurl/uploads/playlists/$internalid.txt")"
|
||||||
|
streamurl="$(echo "$response" \
|
||||||
|
| jq '.[]' \
|
||||||
|
| grep "mp4" \
|
||||||
|
| grep "${season}x${episode}" \
|
||||||
|
| head -n1 \
|
||||||
|
| 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')"
|
||||||
|
message "Loading $capitalized_title at season $season on episode $episode"
|
||||||
|
play
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMovie {
|
||||||
|
# Two requests to the api
|
||||||
|
if [[ "$1" == *"tt"* ]]; then
|
||||||
|
simpleurl="$1"
|
||||||
|
else
|
||||||
|
basics "$1" # Gets the title, performs one request to imdb and gets the complete url
|
||||||
|
fi
|
||||||
|
getInternalID "$simpleurl" # Gets the complete url and performs one request to get the internal id or inform us it does not exist
|
||||||
|
getMovieStreamUrl "$internalid" # Gets the internal id and performs one request to get the stream url
|
||||||
|
title="${title//%20/ }"
|
||||||
|
capitalized_title="$(echo "$title" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)}1')"
|
||||||
|
message "Loading $capitalized_title"
|
||||||
|
play # It uses mpv to stream the file
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
### Program starts here ###
|
### Program starts here ###
|
||||||
|
|
||||||
# Ensure curl-impersonate is installed
|
# Ensure curl-impersonate is installed
|
||||||
@@ -469,6 +506,15 @@ fi
|
|||||||
|
|
||||||
[[ "$#" -lt 1 ]] && usage
|
[[ "$#" -lt 1 ]] && usage
|
||||||
[[ "$#" -gt 3 ]] && usage
|
[[ "$#" -gt 3 ]] && usage
|
||||||
|
[[ "$#" -eq 3 ]] && getSeries "$@"
|
||||||
|
[[ "$#" -eq 1 ]] \
|
||||||
|
&& [[ "$1" != "--open" ]] \
|
||||||
|
&& [[ "$1" != "--menu" ]] \
|
||||||
|
&& [[ "$1" != "--resume" ]] \
|
||||||
|
&& [[ "$1" != "--finish" ]] \
|
||||||
|
&& [[ "$1" != "--select" ]] \
|
||||||
|
&& [[ "$1" != "--history" ]] \
|
||||||
|
&& getMovie "$@"
|
||||||
|
|
||||||
[[ "$1" == "--open" ]] && openInBrowser "$@"
|
[[ "$1" == "--open" ]] && openInBrowser "$@"
|
||||||
[[ "$1" == "--menu" ]] && menuSearch
|
[[ "$1" == "--menu" ]] && menuSearch
|
||||||
@@ -477,49 +523,4 @@ fi
|
|||||||
[[ "$1" == "--select" ]] && resumeSeries
|
[[ "$1" == "--select" ]] && resumeSeries
|
||||||
[[ "$1" == "--history" ]] && getHistory
|
[[ "$1" == "--history" ]] && getHistory
|
||||||
|
|
||||||
# One arguement and it contains the imdb id
|
|
||||||
# Two requests to the api
|
|
||||||
if [[ "$1" == *"tt"* ]] && [[ "$#" -eq 1 ]] && [[ "$1" != "--menu" ]] && [[ "$1" != "--resume" ]] && [[ "$1" != "--finish" ]] && [[ "$1" != "--select" ]] && [[ "$1" != "--history" ]]; then
|
|
||||||
simpleurl="$1"
|
|
||||||
getInternalID "$simpleurl"
|
|
||||||
getMovieStreamUrl "$internalid"
|
|
||||||
play
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Series URL
|
|
||||||
if [[ "$#" -eq 3 ]]; then
|
|
||||||
# Two requests to the api
|
|
||||||
basics "$1"
|
|
||||||
getInternalID "$simpleurl"
|
|
||||||
season="$2"
|
|
||||||
episode="$3"
|
|
||||||
response="$(curlRequest "$apiurl/uploads/playlists/$internalid.txt")"
|
|
||||||
streamurl="$(echo "$response" \
|
|
||||||
| jq '.[]' \
|
|
||||||
| grep "mp4" \
|
|
||||||
| grep "${season}x${episode}" \
|
|
||||||
| head -n1 \
|
|
||||||
| 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')"
|
|
||||||
message "Loading $capitalized_title at season $season on episode $episode"
|
|
||||||
play
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Movies URL
|
|
||||||
if [[ "$#" -eq 1 ]] && [[ "$1" != "--menu" ]] && [[ "$1" != "--resume" ]] && [[ "$1" != "--finish" ]] && [[ "$1" != "--select" ]] && [[ "$1" != "--history" ]]; then
|
|
||||||
# Two requests to the api
|
|
||||||
basics "$1" # Gets the title, performs one request to imdb and gets the complete url
|
|
||||||
getInternalID "$simpleurl" # Gets the complete url and performs one request to get the internal id or inform us it does not exist
|
|
||||||
getMovieStreamUrl "$internalid" # Gets the internal id and performs one request to get the stream url
|
|
||||||
title="${title//%20/ }"
|
|
||||||
capitalized_title="$(echo "$title" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)}1')"
|
|
||||||
message "Loading $capitalized_title"
|
|
||||||
play # It uses mpv to stream the file
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user