Whatever will be, will be 8{
This commit is contained in:
@@ -53,6 +53,11 @@ To continue unfinished series episode
|
|||||||
grpoppro --finish
|
grpoppro --finish
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To open in browser
|
||||||
|
```sh
|
||||||
|
grpoppro --open \"Name of movie or tv series\"
|
||||||
|
```
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
* curl
|
* curl
|
||||||
|
|||||||
45
grpoppro
45
grpoppro
@@ -63,7 +63,7 @@ function getInternalID() {
|
|||||||
"$simpleurl"
|
"$simpleurl"
|
||||||
)"
|
)"
|
||||||
if echo "$response" | grep -q "id='el-content'></div>"; then
|
if echo "$response" | grep -q "id='el-content'></div>"; then
|
||||||
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "No file found" || echo -e "\n\tNo file found" && exit
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "No file found" || echo -e "\n\tNo file found" && exit 0
|
||||||
fi
|
fi
|
||||||
internalid="$(echo "$response" | grep news_id | awk '{print $5}' | awk -F\' '{print $2}')"
|
internalid="$(echo "$response" | grep news_id | awk '{print $5}' | awk -F\' '{print $2}')"
|
||||||
}
|
}
|
||||||
@@ -77,13 +77,13 @@ function getIMDBID() {
|
|||||||
# imdbid="$(curl -s "http://imdb.konsthol.eu/find?q=$title" | grep -io ' href=['"'"'"][^"'"'"']*['"'"'"]' | grep title | head -n1 | sed -e 's/^ //' -e 's/href="\/title\///' -e 's/"//')"
|
# imdbid="$(curl -s "http://imdb.konsthol.eu/find?q=$title" | grep -io ' href=['"'"'"][^"'"'"']*['"'"'"]' | grep title | head -n1 | sed -e 's/^ //' -e 's/href="\/title\///' -e 's/"//')"
|
||||||
if ! [[ "$imdbid" == *"tt"* ]]; then
|
if ! [[ "$imdbid" == *"tt"* ]]; then
|
||||||
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Film or show not found in imdb" || echo -e "\n\tFilm or show not found in imdb"
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Film or show not found in imdb" || echo -e "\n\tFilm or show not found in imdb"
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
echo -e "\n\tUsage: $(basename "$0") \"name of film or show\" [season] [episode(ex 01 02 .. 10 11)]\n\tOr $(basename "$0") [--menu|--resume|--finish]"
|
echo -e "\n\tUsage:\n\n\t$(basename "$0") \"name of film or show\" [season] [episode(ex 01 02 .. 10 11)]\n\tOr $(basename "$0") [--menu|--resume|--finish]\n\tOr $(basename "$0") --open \"name of film or show\""
|
||||||
exit
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function play {
|
function play {
|
||||||
@@ -105,7 +105,6 @@ function sourceData {
|
|||||||
|
|
||||||
[[ "$#" -lt 1 ]] && usage
|
[[ "$#" -lt 1 ]] && usage
|
||||||
[[ "$#" -gt 3 ]] && usage
|
[[ "$#" -gt 3 ]] && usage
|
||||||
[[ "$#" -eq 2 ]] && usage
|
|
||||||
|
|
||||||
#Standard Stuff
|
#Standard Stuff
|
||||||
|
|
||||||
@@ -120,7 +119,10 @@ function menuSearch {
|
|||||||
# Two requests to the api
|
# Two requests to the api
|
||||||
[[ "$INTERACTIVE" == "on" ]] && title=$(echo "" | wofi --dmenu --insensitive --prompt="Search Series" --width=300 --height=50)
|
[[ "$INTERACTIVE" == "on" ]] && title=$(echo "" | wofi --dmenu --insensitive --prompt="Search Series" --width=300 --height=50)
|
||||||
[[ "$INTERACTIVE" == "off" ]] && [[ -z "$title" ]] && read -r -p "Search Series: " title
|
[[ "$INTERACTIVE" == "off" ]] && [[ -z "$title" ]] && read -r -p "Search Series: " title
|
||||||
[[ -z "$title" ]] && exit
|
if [[ -z "$title" ]]; then
|
||||||
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing given" || echo "Nothing given"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
title="${title// /%20}"
|
title="${title// /%20}"
|
||||||
getIMDBID "$title"
|
getIMDBID "$title"
|
||||||
simpleurl="$apiurl/embed/$imdbid/"
|
simpleurl="$apiurl/embed/$imdbid/"
|
||||||
@@ -139,7 +141,7 @@ function menuSearch {
|
|||||||
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | awk -F\" '{print $8}' | awk -F/ '{print $NF}' | awk -F. '{print $1}' | eval "$menu"\""$title"\")"
|
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | awk -F\" '{print $8}' | awk -F/ '{print $NF}' | awk -F. '{print $1}' | eval "$menu"\""$title"\")"
|
||||||
if [[ -z "$seasonEpisode" ]]; then
|
if [[ -z "$seasonEpisode" ]]; then
|
||||||
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing Selected" || echo "Nothing Selected"
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing Selected" || echo "Nothing Selected"
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | grep "${seasonEpisode}" | head -n1 | awk -F\" '{print $8}')"
|
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | grep "${seasonEpisode}" | head -n1 | awk -F\" '{print $8}')"
|
||||||
dumpData "$title" "$seasonEpisode"
|
dumpData "$title" "$seasonEpisode"
|
||||||
@@ -149,7 +151,10 @@ function menuSearch {
|
|||||||
|
|
||||||
function resume {
|
function resume {
|
||||||
# Zero requests to the api
|
# Zero requests to the api
|
||||||
[ ! -f "$GRPOPPRO_DATA_FILE" ] && echo "Nothing to resume" && exit
|
if [[ ! -f "$GRPOPPRO_DATA_FILE" ]]; then
|
||||||
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing to resume" || echo "Nothing to resume"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
sourceData
|
sourceData
|
||||||
title=$lastSeriesPlayed
|
title=$lastSeriesPlayed
|
||||||
while true
|
while true
|
||||||
@@ -158,7 +163,7 @@ function resume {
|
|||||||
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | awk -F\" '{print $8}' | awk -F/ '{print $NF}' | awk -F. '{print $1}' | sed -n -e "0,/$lastSeasonEpisodePlayed/!p" | eval "$menu"\""$title"\")"
|
seasonEpisode="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | awk -F\" '{print $8}' | awk -F/ '{print $NF}' | awk -F. '{print $1}' | sed -n -e "0,/$lastSeasonEpisodePlayed/!p" | eval "$menu"\""$title"\")"
|
||||||
if [[ -z "$seasonEpisode" ]]; then
|
if [[ -z "$seasonEpisode" ]]; then
|
||||||
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing Selected" || echo "Nothing Selected"
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing Selected" || echo "Nothing Selected"
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | grep "${seasonEpisode}" | head -n1 | awk -F\" '{print $8}')"
|
streamurl="$(grep "mp4" "$GRPOPPRO_PLAYLIST_FILE" | grep "${seasonEpisode}" | head -n1 | awk -F\" '{print $8}')"
|
||||||
dumpData "$title" "$seasonEpisode"
|
dumpData "$title" "$seasonEpisode"
|
||||||
@@ -168,7 +173,10 @@ function resume {
|
|||||||
|
|
||||||
function resumeUnfinishedEpisode {
|
function resumeUnfinishedEpisode {
|
||||||
# Zero requests to the api
|
# Zero requests to the api
|
||||||
[ ! -f "$GRPOPPRO_DATA_FILE" ] && echo "Nothing to resume" && exit
|
if [[ ! -f "$GRPOPPRO_DATA_FILE" ]]; then
|
||||||
|
[[ "$INTERACTIVE" == "on" ]] && notify-send -t 2000 "Nothing to resume" || echo "Nothing to resume"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
sourceData
|
sourceData
|
||||||
streamurl="$lastEpisodePlayedURL"
|
streamurl="$lastEpisodePlayedURL"
|
||||||
[[ "$OSTYPE" != "linux-gnu" ]] && INTERACTIVE="off" && streamurl="${streamurl//https/http}"
|
[[ "$OSTYPE" != "linux-gnu" ]] && INTERACTIVE="off" && streamurl="${streamurl//https/http}"
|
||||||
@@ -177,6 +185,15 @@ function resumeUnfinishedEpisode {
|
|||||||
resume
|
resume
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openInBrowser {
|
||||||
|
# One request to the api
|
||||||
|
basics "$2"
|
||||||
|
getInternalID "$simpleurl"
|
||||||
|
xdg-open "$simpleurl"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ "$1" == "--open" ]] && openInBrowser "$@"
|
||||||
[[ "$1" == "--menu" ]] && menuSearch
|
[[ "$1" == "--menu" ]] && menuSearch
|
||||||
[[ "$1" == "--resume" ]] && resume
|
[[ "$1" == "--resume" ]] && resume
|
||||||
[[ "$1" == "--finish" ]] && resumeUnfinishedEpisode
|
[[ "$1" == "--finish" ]] && resumeUnfinishedEpisode
|
||||||
@@ -187,7 +204,7 @@ if [[ "$1" == *"tt"* ]] && [[ "$#" -eq 1 ]] && [[ "$1" != "--menu" ]] && [[ "$1"
|
|||||||
getInternalID "$simpleurl"
|
getInternalID "$simpleurl"
|
||||||
getMovieStreamUrl "$internalid"
|
getMovieStreamUrl "$internalid"
|
||||||
play
|
play
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Series URL
|
# Series URL
|
||||||
@@ -205,7 +222,7 @@ if [[ "$#" -eq 3 ]]; then
|
|||||||
-H "Upgrade-Insecure-Requests: 1" \
|
-H "Upgrade-Insecure-Requests: 1" \
|
||||||
"$apiurl/uploads/playlists/$internalid.txt" | grep "mp4" | grep "${season}x${episode}" | head -n1 | awk -F\" '{print $8}')"
|
"$apiurl/uploads/playlists/$internalid.txt" | grep "mp4" | grep "${season}x${episode}" | head -n1 | awk -F\" '{print $8}')"
|
||||||
play
|
play
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Movies URL
|
# Movies URL
|
||||||
@@ -215,5 +232,7 @@ if [[ "$#" -eq 1 ]] && [[ "$1" != "--menu" ]] && [[ "$1" != "--resume" ]]; then
|
|||||||
getInternalID "$simpleurl" # Gets the complete url and performs one request to get the internal id or inform us it does not exist
|
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
|
getMovieStreamUrl "$internalid" # Gets the internal id and performs one request to get the stream url
|
||||||
play # It uses mpv to stream the file
|
play # It uses mpv to stream the file
|
||||||
exit
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user