From 41b62d82a6dfc756e2682373ca1324002aa08272 Mon Sep 17 00:00:00 2001 From: DeBaschdi Date: Fri, 16 Aug 2019 14:09:27 +0200 Subject: [PATCH 1/7] tkm - use php-curl for cookie handling 1/2 --- branch-debaschdi.sh | 3 ++- epg.sh | 23 ++++++++++++++++++++++- update.sh | 3 ++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/branch-debaschdi.sh b/branch-debaschdi.sh index e4741dc..5fb5e76 100644 --- a/branch-debaschdi.sh +++ b/branch-debaschdi.sh @@ -106,7 +106,8 @@ echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/cid_json.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/chlist_printer.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/compare_menu.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/url_printer.pl 2> /dev/null - +echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/proxy.sh 2> /dev/null +echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/web_magentatv_de.php 2> /dev/nul # RADIOTIMES echo "Updating RadioTimes..." diff --git a/epg.sh b/epg.sh index e98a0b7..ecc9625 100755 --- a/epg.sh +++ b/epg.sh @@ -251,6 +251,18 @@ then ERROR="true" fi +if [ ! -e tkm/proxy.sh ] +then + printf "\nMissing file in MagentaTV folder: tkm/ch_json2xml.pl" + ERROR="true" +fi + +if [ ! -e tkm/web_magentatv_de.php ] +then + printf "\nMissing file in MagentaTV folder: tkm/chlist_printer.pl" + ERROR="true" +fi + if [ ! -e tkm/cid_json.pl ] then printf "\nMissing file in MagentaTV folder: tkm/cid_json.pl" @@ -277,10 +289,17 @@ fi if [ ! -e tkm/tkm.sh ] then - printf "\nMissing file in MagentaTV folder: tkm/swc.sh" + printf "\nMissing file in MagentaTV folder: tkm/tkm.sh" ERROR="true" fi +if [ ! -e tkm/web_magentatv_de.php ] +then + printf "\nMissing file in MagentaTV folder: tkm/web_magentatv_de.php" + ERROR="true" +fi + + if [ ! -e tkm/url_printer.pl ] then printf "\nMissing file in MagentaTV folder: tkm/url_printer.pl" @@ -1395,6 +1414,8 @@ do cp tkm/chlist_printer.pl tkm/de/ cp tkm/compare_menu.pl tkm/de/ cp tkm/url_printer.pl tkm/de/ + cp tkm/web_magentatv_de.php tkm/de/ + cp tkm/proxy.sh tkm/de/ cd tkm/de && bash settings.sh cd - > /dev/null diff --git a/update.sh b/update.sh index 0cd7ea3..def93e8 100755 --- a/update.sh +++ b/update.sh @@ -121,7 +121,8 @@ echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/cid_json.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/chlist_printer.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/compare_menu.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/url_printer.pl 2> /dev/null - +echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/proxy.sh 2> /dev/null +echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/web_magentatv_de.php 2> /dev/null # RADIOTIMES echo "Updating RadioTimes..." From f5defd7495ad67225549f56226ae7591ad87f2ef Mon Sep 17 00:00:00 2001 From: DeBaschdi Date: Fri, 16 Aug 2019 14:10:15 +0200 Subject: [PATCH 2/7] tkm - use php-curl for cookie handling 2/2 --- tkm/proxy.sh | 162 ++++++++++++++++++++++++++++ tkm/settings.sh | 35 ++----- tkm/tkm.sh | 220 ++++++++++----------------------------- tkm/url_printer.pl | 28 ++--- tkm/web_magentatv_de.php | 89 ++++++++++++++++ 5 files changed, 330 insertions(+), 204 deletions(-) create mode 100644 tkm/proxy.sh create mode 100644 tkm/web_magentatv_de.php diff --git a/tkm/proxy.sh b/tkm/proxy.sh new file mode 100644 index 0000000..0d220a8 --- /dev/null +++ b/tkm/proxy.sh @@ -0,0 +1,162 @@ +#!/bin/bash + +# default hostname +HOST=127.0.0.1 +# default port number +PORT=8000 +# script name +NAME=${0##*/} + +usage () { + cat < [:] + Available commands: + start Starts PHP built-in web server server on specified hostname:port, default is localhost:$PORT + stop Stops the PHP built-in web server + restart Stops and Starts on previously specified hostname:port + status Status of "$NAME" process + log Show the PHP built-in web server logs. Use the -f option for a live update + report bugs to me@cubny.com + $NAME homepage: +EOF +return 0 +} + +setup_colors() { + +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) + fi + if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" + else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + NORMAL="" + fi +} + +# if no command specified exit and show usage +if [[ $# < 1 ]]; then + echo $NAME: no command specified + usage + exit 1 +fi + +# if hostname:port specified override defaults +if [[ $# > 1 ]]; then + IFS=':' read -r -a hostport <<< "$2" + if [[ ! -z "${hostport[0]}" ]]; then + HOST=${hostport[0]} + fi + if [[ ! -z "${hostport[1]}" ]]; then + PORT=${hostport[1]} + fi +fi + +# pidfile contents would be hostname:port:pid +PIDFILE="$NAME".pid +LOGFILE="$NAME".log + +validate_server () { + which php &> /dev/null + if [[ $? -eq 1 ]]; then + printf "${YELLOW}Error: PHP not found. ${NORMAL}Please install PHP version 5.4 or greater!\n" + return 1 + fi + + php -h | grep -q -- '-S' + if [[ $? -eq 1 ]]; then + printf "${YELLOW}Error: PHP version must be 5.4 or greater!${NORMAL}\n" + return 1 + fi + + return 0 +} + +start_server () { + + validate_server + if [[ $? -eq 1 ]]; then + return 1 + fi + + if [[ -e "$PIDFILE" ]]; then + printf "${YELLOW}Server seems to be running!${NORMAL}\n" + echo + echo if not, there is probably a zombie "$PIDFILE" in this directory. + echo if you are sure no server is running just remove "$PIDFILE" manually and start again + return 1 + else + printf "${GREEN}"$NAME" started on $HOST:$PORT${NORMAL}\n" + php -S "$HOST":"$PORT" >> "$LOGFILE" 2>&1 & + echo "$HOST":"$PORT":$! > $PIDFILE + return 0 + fi +} + +read_pidfile() { + if [[ -e "$PIDFILE" ]]; then + PIDFILECONTENT=`cat "$PIDFILE"` + IFS=: read HOST PORT PID <<< "$PIDFILECONTENT:" + return 0 + else + return 1 + fi + +} +stop_server () { + if read_pidfile; then + kill -9 "$PID" + rm -f "$PIDFILE" + printf "${GREEN}"$NAME" stopped!${NORMAL}\n" + return 0 + else + printf "${YELLOW}"$NAME" is not running!${NORMAL}\n" + return 1 + fi +} + +status_server() { + if read_pidfile && kill -0 "$PID" ; then + printf "${BLUE}"$NAME" is running on ${HOST}:${PORT}${NORMAL}\n" + else + printf "${YELLOW}"$NAME" is not running!${NORMAL}\n" + fi +} + + +log_server() { + if read_pidfile && kill -0 "$PID" ; then + if [[ "$1" = "-f" ]]; then + TAIL_OPTS="-f" + fi + tail $TAIL_OPTS "$LOGFILE" + else + printf "${YELLOW}"$NAME" is not running!${NORMAL}\n" + fi +} + + +setup_colors + +case $1 in + start) start_server;; + stop) stop_server;; + restart) stop_server; start_server ;; + status) status_server;; + log) log_server $2;; + -h) usage ;; + --help) usage ;; + *) usage;; +esac diff --git a/tkm/settings.sh b/tkm/settings.sh index 491f93c..78ded5b 100755 --- a/tkm/settings.sh +++ b/tkm/settings.sh @@ -20,30 +20,12 @@ # along with easyepg. If not, see . # ###################################### -# LOADING COOKIE DATA / GET SESSION ID # +# START PHP PROXY SERVER # # ###################################### -printf "\rLoading cookie data..." - -# REFRESH COOKIE -rm /tmp/cookie 2> /dev/null - -# AUTH -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -d '{"userId":"Guest","mac":"00:00:00:00:00:00"}' 'https://web.magentatv.de/EPG/JSON/Login' > /dev/null - -# LOGIN -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -d '{"terminalid":"00:00:00:00:00:00","mac":"00:00:00:00:00:00","terminaltype":"WEBTV","utcEnable":1,"timezone":"UTC","userType":3,"terminalvendor":"Unknown","preSharedKeyID":"PC01P00002","cnonce":"5c6ff0b9e4e5efb1498e7eaa8f54d9fb"}' 'https://web.magentatv.de/EPG/JSON/Authenticate?SID=firstup' > /dev/null - -# GET SESSION ID -grep "CSRFSESSION" /tmp/cookie > /tmp/session && sed -i 's/\(.*\)\(CSRFSESSION\) \(.*\)/X_CSRFToken: \3/g' /tmp/session - -if ! grep -q "X_CSRFToken" /tmp/session -then - echo " FAILED" && printf "\n" - exit 0 -else - session=$( /dev/null @@ -193,7 +175,7 @@ do echo 'dialog --backtitle "[E1100] EASYEPG SIMPLE XMLTV GRABBER > MAGENTA SETTINGS > CHANNEL LIST" --title "CHANNELS" --checklist "Please choose the channels you want to grab:" 15 50 10 \' > /tmp/chmenu printf "\rFetching channel list... " - curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -X POST -H "$session" -d '{"properties":[{"name":"logicalChannel","include":"/channellist/logicalChannel/contentId,/channellist/logicalChannel/type,/channellist/logicalChannel/name,/channellist/logicalChannel/chanNo,/channellist/logicalChannel/pictures/picture/imageType,/channellist/logicalChannel/pictures/picture/href,/channellist/logicalChannel/foreignsn,/channellist/logicalChannel/externalCode,/channellist/logicalChannel/sysChanNo,/channellist/logicalChannel/physicalChannels/physicalChannel/mediaId,/channellist/logicalChannel/physicalChannels/physicalChannel/fileFormat,/channellist/logicalChannel/physicalChannels/physicalChannel/definition"}],"metaDataVer":"Channel/1.1","channelNamespace":"2","filterlist":[{"key":"IsHide","value":"-1"}],"returnSatChannel":0}' "https://web.magentatv.de/EPG/JSON/AllChannel?SID=first" > /tmp/workfile + curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?type=2' > /tmp/workfile jq '.' /tmp/workfile > /tmp/chlist printf "\rLoading channel configuration..." @@ -463,7 +445,8 @@ do elif grep -q "7" /tmp/value then clear - + printf "\rStopping Proxy Server\n" + bash proxy.sh stop echo "" echo " --------------------------------------------" echo " TELEKOM EPG SIMPLE XMLTV GRABBER " @@ -505,6 +488,8 @@ do then dialog --backtitle "[E1920] EASYEPG SIMPLE XMLTV GRABBER > MAGENTA SETTINGS > DELETE INSTANCE" --title "INFO" --msgbox "Service deleted!" 5 30 rm channels.json + printf "\rStopping Proxy Server\n" + bash proxy.sh stop echo "M" > /tmp/value # E19X0 EXIT @@ -520,6 +505,8 @@ do # ############ else + printf "\rStopping Proxy Server\n" + bash proxy.sh stop echo "M" > /tmp/value fi diff --git a/tkm/tkm.sh b/tkm/tkm.sh index dae62d3..1df3de2 100755 --- a/tkm/tkm.sh +++ b/tkm/tkm.sh @@ -49,31 +49,12 @@ fi # ###################################### -# LOADING COOKIE DATA / GET SESSION ID # +# START PHP PROXY SERVER # # ###################################### -printf "\rLoading cookie data..." - -# REFRESH COOKIE -rm /tmp/cookie 2> /dev/null - -# AUTH -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -d '{"userId":"Guest","mac":"00:00:00:00:00:00"}' 'https://web.magentatv.de/EPG/JSON/Login' > /dev/null - -# LOGIN -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -d '{"terminalid":"00:00:00:00:00:00","mac":"00:00:00:00:00:00","terminaltype":"WEBTV","utcEnable":1,"timezone":"UTC","userType":3,"terminalvendor":"Unknown","preSharedKeyID":"PC01P00002","cnonce":"5c6ff0b9e4e5efb1498e7eaa8f54d9fb"}' 'https://web.magentatv.de/EPG/JSON/Authenticate?SID=firstup' > /dev/null - -# GET SESSION ID -grep "CSRFSESSION" /tmp/cookie > /tmp/session && sed -i 's/\(.*\)\(CSRFSESSION\) \(.*\)/X_CSRFToken: \3/g' /tmp/session - -if ! grep -q "X_CSRFToken" /tmp/session -then - echo " FAILED" && printf "\n" - exit 0 -else - echo " OK" && printf "\n" - session=$( /dev/null # printf "\rFetching channel list... " -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -X POST -H "$session" -d '{"properties":[{"name":"logicalChannel","include":"/channellist/logicalChannel/contentId,/channellist/logicalChannel/type,/channellist/logicalChannel/name,/channellist/logicalChannel/chanNo,/channellist/logicalChannel/pictures/picture/imageType,/channellist/logicalChannel/pictures/picture/href,/channellist/logicalChannel/foreignsn,/channellist/logicalChannel/externalCode,/channellist/logicalChannel/sysChanNo,/channellist/logicalChannel/physicalChannels/physicalChannel/mediaId,/channellist/logicalChannel/physicalChannels/physicalChannel/fileFormat,/channellist/logicalChannel/physicalChannels/physicalChannel/definition"}],"metaDataVer":"Channel/1.1","channelNamespace":"2","filterlist":[{"key":"IsHide","value":"-1"}],"returnSatChannel":0}' "https://web.magentatv.de/EPG/JSON/AllChannel?SID=first" > /tmp/chlist +curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?type=2' > /tmp/chlist jq '.' /tmp/chlist > /tmp/workfile printf "\rChecking manifest files... " @@ -111,133 +92,53 @@ then split --lines=$(( $number + 1 )) --numeric-suffixes mani/common mani/day - rm mani/common 2> /dev/null else mv mani/common mani/day00 fi # -# CREATE STATUS BAR FOR MANIFEST FILE DOWNLOAD +# CREATE STATUS INFO FOR MANIFEST FILE DOWNLOAD # -x=$(wc -l < mani/day00) -y=20 -h=40 -if [ $x -gt $h ] -then - z5=$(expr $x / $y) - z10=$(expr $x / $y \* 2) - z15=$(expr $x / $y \* 3) - z20=$(expr $x / $y \* 4) - z25=$(expr $x / $y \* 5) - z30=$(expr $x / $y \* 6) - z35=$(expr $x / $y \* 7) - z40=$(expr $x / $y \* 8) - z45=$(expr $x / $y \* 9) - z50=$(expr $x / $y \* 10) - z55=$(expr $x / $y \* 11) - z60=$(expr $x / $y \* 12) - z65=$(expr $x / $y \* 13) - z70=$(expr $x / $y \* 14) - z75=$(expr $x / $y \* 15) - z80=$(expr $x / $y \* 16) - z85=$(expr $x / $y \* 17) - z90=$(expr $x / $y \* 18) - z95=$(expr $x / $y \* 19) - - echo "#!/bin/bash" > progressbar - - # START - echo "sed -i '2i\\" >> progressbar - echo "Progress [ ] 0%% ' mani/day00" >> progressbar - - # 5% - echo "sed -i '$z5 i\\" >> progressbar - echo "Progress [# ] 5%% ' mani/day00" >> progressbar - - # 10% - echo "sed -i '$z10 i\\" >> progressbar - echo "Progress [## ] 10%% ' mani/day00" >> progressbar - - # 15% - echo "sed -i '$z15 i\\" >> progressbar - echo "Progress [### ] 15%% ' mani/day00" >> progressbar - - # 20% - echo "sed -i '$z20 i\\" >> progressbar - echo "Progress [#### ] 20%% ' mani/day00" >> progressbar - - # 25% - echo "sed -i '$z25 i\\" >> progressbar - echo "Progress [##### ] 25%% ' mani/day00" >> progressbar - - # 30% - echo "sed -i '$z30 i\\" >> progressbar - echo "Progress [###### ] 30%% ' mani/day00" >> progressbar - - # 35% - echo "sed -i '$z35 i\\" >> progressbar - echo "Progress [####### ] 35%% ' mani/day00" >> progressbar - - # 40% - echo "sed -i '$z40 i\\" >> progressbar - echo "Progress [######## ] 40%% ' mani/day00" >> progressbar - - # 45% - echo "sed -i '$z45 i\\" >> progressbar - echo "Progress [######### ] 45%% ' mani/day00" >> progressbar - - # 50% - echo "sed -i '$z50 i\\" >> progressbar - echo "Progress [########## ] 50%% ' mani/day00" >> progressbar - - # 55% - echo "sed -i '$z55 i\\" >> progressbar - echo "Progress [########### ] 55%% ' mani/day00" >> progressbar - - # 60% - echo "sed -i '$z60 i\\" >> progressbar - echo "Progress [############ ] 60%% ' mani/day00" >> progressbar - - # 65% - echo "sed -i '$z65 i\\" >> progressbar - echo "Progress [############# ] 65%% ' mani/day00" >> progressbar - - # 70% - echo "sed -i '$z70 i\\" >> progressbar - echo "Progress [############## ] 70%% ' mani/day00" >> progressbar - - # 75% - echo "sed -i '$z75 i\\" >> progressbar - echo "Progress [############### ] 75%% ' mani/day00" >> progressbar - - # 80% - echo "sed -i '$z80 i\\" >> progressbar - echo "Progress [################ ] 80%% ' mani/day00" >> progressbar - - # 85% - echo "sed -i '$z85 i\\" >> progressbar - echo "Progress [################# ] 85%% ' mani/day00" >> progressbar - - # 90% - echo "sed -i '$z90 i\\" >> progressbar - echo "Progress [################## ] 90%% ' mani/day00" >> progressbar - - # 95% - echo "sed -i '$z95 i\\" >> progressbar - echo "Progress [################### ] 95%% ' mani/day00" >> progressbar - - # 100% - echo "sed -i '\$i\\" >> progressbar - echo "Progress [####################] 100%% ' mani/day00" >> progressbar - - sed -i 's/ i/i/g' progressbar - bash progressbar - sed -i -e 's/Progress/printf "\\rProgress/g' -e '/Progress/s/.*/&"/g' mani/day00 - rm progressbar -fi +function status_manifest_download { + #setup_scroll_area + sleep 2 2> /dev/null ; + thread=$(ps ax) + if [[ $thread =~ ^.*curl.*$ ]] ; + then + z0="[ ]" + z5="[# ]" + z10="[## ]" + z15="[### ]" + z20="[#### ]" + z25="[##### ]" + z30="[###### ]" + z35="[####### ]" + z40="[######## ]" + z45="[######### ]" + z50="[########## ]" + z55="[########### ]" + z60="[############ ]" + z65="[############# ]" + z70="[############## ]" + z75="[############### ]" + z80="[################ ]" + z85="[################# ]" + z90="[################## ]" + z95="[################### ]" + z100="[####################]" + + df=$(find mani/ -type f | wc -l) ; + ftd=$(wc -l < mani/common) ; + status=$(expr $df \* 100 / $ftd - 2) ; + if [[ $status -gt 100 || $status -eq 100 ]]; then status="100"; fi + if [[ $status -gt 0 && $status -lt 5 || $status -eq 0 ]]; then bar="$z0"; elif [[ $status -gt 5 && $status -lt 10 ]]; then bar="$z5"; elif [[ $status -gt 10 && $status -lt 15 ]] ; then bar="$z10"; elif [[ $status -gt 15 && $status -lt 20 ]] ; then bar="$z15"; elif [[ $status -gt 20 && $status -lt 25 ]] ; then bar="$z20"; elif [[ $status -gt 25 && $status -lt 30 ]] ; then bar="$z25"; elif [[ $status -gt 30 && $status -lt 35 ]] ; then bar="$z30"; elif [[ $status -gt 35 && $status -lt 40 ]] ; then bar="$z35"; elif [[ $status -gt 40 && $status -lt 45 ]] ; then bar="$z40"; elif [[ $status -gt 40 && $status -lt 50 ]] ; then bar="$z45"; elif [[ $status -gt 50 && $status -lt 55 ]] ; then bar="$z50"; elif [[ $status -gt 55 && $status -lt 60 ]] ; then bar="$z55"; elif [[ $status -gt 60 && $status -lt 65 ]] ; then bar="$z60"; elif [[ $status -gt 60 && $status -lt 70 ]] ; then bar="$z65"; elif [[ $status -gt 70 && $status -lt 75 ]] ; then bar="$z70"; elif [[ $status -gt 70 && $status -lt 80 ]] ; then bar="$z75"; elif [[ $status -gt 80 && $status -lt 85 ]] ; then bar="$z80"; elif [[ $status -gt 85 && $status -lt 90 ]] ; then bar="$z85"; elif [[ $status -gt 90 && $status -lt 95 ]] ; then bar="$z90"; elif [[ $status -gt 95 && $status -lt 100 ]] ; then bar="$z95"; elif [ $status -eq 100 ] ; then bar="$z100";fi + printf "\rProgress $bar $status%% "; + status_manifest_download ; + fi + } # @@ -257,13 +158,15 @@ done printf "\rLoading manifest files..." echo "" +status_manifest_download & + for a in {0..8..1} do bash mani/day0${a} 2> /dev/null & done wait -rm mani/day0* 2> /dev/null +rm mani/day0* 2> /dev/null && rm mani/common 2> /dev/null echo "DONE!" && printf "\n" @@ -321,31 +224,9 @@ echo "- FILE CREATION PROCESS -" && echo "" rm workfile chlist 2> /dev/null -# REFRESH COOKIE -printf "\rRefreshing cookie data..." -rm /tmp/cookie 2> /dev/null - -# AUTH -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -d '{"userId":"Guest","mac":"00:00:00:00:00:00"}' 'https://web.magentatv.de/EPG/JSON/Login' > /dev/null - -# LOGIN -curl -s --cookie "/tmp/cookie" --cookie-jar "/tmp/cookie" -d '{"terminalid":"00:00:00:00:00:00","mac":"00:00:00:00:00:00","terminaltype":"WEBTV","utcEnable":1,"timezone":"UTC","userType":3,"terminalvendor":"Unknown","preSharedKeyID":"PC01P00002","cnonce":"5c6ff0b9e4e5efb1498e7eaa8f54d9fb"}' 'https://web.magentatv.de/EPG/JSON/Authenticate?SID=firstup' > /dev/null - -# GET SESSION ID -grep "CSRFSESSION" /tmp/cookie > /tmp/session && sed -i 's/\(.*\)\(CSRFSESSION\) \(.*\)/X_CSRFToken: \3/g' /tmp/session - -if ! grep -q "X_CSRFToken" /tmp/session -then - echo " FAILED" && printf "\n" - exit 0 -else - echo " OK" && printf "\n" - session=$( /tmp/chlist +curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?type=2' > /tmp/chlist jq '.' /tmp/chlist > chlist curl -s https://raw.githubusercontent.com/sunsettrack4/config_files/master/tkm_channels.json > tkm_channels.json curl -s https://raw.githubusercontent.com/sunsettrack4/config_files/master/tkm_genres.json > tkm_genres.json @@ -416,6 +297,13 @@ else fi fi +# ###################################### +# STOP PHP PROXY SERVER # +# ###################################### + +printf "\rStopping Proxy Server\n" +bash proxy.sh stop +sleep 1s # SHOW WARNINGS cat epg_warnings.txt >> warnings.txt && rm epg_warnings.txt diff --git a/tkm/url_printer.pl b/tkm/url_printer.pl index d5c9ddd..bd0978d 100755 --- a/tkm/url_printer.pl +++ b/tkm/url_printer.pl @@ -113,46 +113,46 @@ # DAY 1 if( $day_setting == 1 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=1&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-2 } elsif( $day_setting == 2 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=2&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-3 } elsif( $day_setting == 3 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=3&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-4 } elsif( $day_setting == 4 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=4&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-5 } elsif( $day_setting == 5 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=5&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-6 } elsif( $day_setting == 6 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=6&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-7 } elsif( $day_setting == 7 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=7&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-8 } elsif( $day_setting == 8 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=8&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-9 } elsif( $day_setting == 9 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=9&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-10 } elsif( $day_setting == 10 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=10&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-11 } elsif( $day_setting == 11 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=11&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-12 } elsif( $day_setting == 12 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=12&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-13 } elsif( $day_setting == 13 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=13&type=1' | grep \"$new_id\" > mani/$new_id\n"; # DAYS 1-14 } elsif( $day_setting == 14 ) { - print "curl -s 'https://web.magentatv.de/EPG/JSON/ExecuteBatch?PlayBillList&SID=guidebatch' --cookie '/tmp/cookie' --cookie-jar '/tmp/cookie' -X POST -H \"\$( mani/$new_id\n"; + print "curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?channel=" . $new_id . "&date=" . $date1 . "&time=14&type=1' | grep \"$new_id\" > mani/$new_id\n"; } } else { diff --git a/tkm/web_magentatv_de.php b/tkm/web_magentatv_de.php new file mode 100644 index 0000000..736e662 --- /dev/null +++ b/tkm/web_magentatv_de.php @@ -0,0 +1,89 @@ + From e3da10e077f7d28cd09a75aa3fbc2b66a8207fde Mon Sep 17 00:00:00 2001 From: DeBaschdi Date: Tue, 20 Aug 2019 06:00:33 +0200 Subject: [PATCH 3/7] Add files via upload --- tkm/settings.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tkm/settings.sh b/tkm/settings.sh index 78ded5b..eede1f0 100755 --- a/tkm/settings.sh +++ b/tkm/settings.sh @@ -173,7 +173,6 @@ do then # E1100 MENU OVERLAY echo 'dialog --backtitle "[E1100] EASYEPG SIMPLE XMLTV GRABBER > MAGENTA SETTINGS > CHANNEL LIST" --title "CHANNELS" --checklist "Please choose the channels you want to grab:" 15 50 10 \' > /tmp/chmenu - printf "\rFetching channel list... " curl -s 'http://127.0.0.1:8000/web_magentatv_de.php?type=2' > /tmp/workfile jq '.' /tmp/workfile > /tmp/chlist @@ -463,6 +462,8 @@ do cd - > /dev/null read -n 1 -s -r -p "Press any key to continue..." + printf "\rStarting Proxy Server\n" + bash proxy.sh start echo "H" > /tmp/value From dabb553ce20cb32fd7034f316b1dc591293784f4 Mon Sep 17 00:00:00 2001 From: DeBaschdi Date: Mon, 26 Aug 2019 06:04:37 +0200 Subject: [PATCH 4/7] Update branch-debaschdi.sh --- branch-debaschdi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/branch-debaschdi.sh b/branch-debaschdi.sh index 5fb5e76..301db46 100644 --- a/branch-debaschdi.sh +++ b/branch-debaschdi.sh @@ -107,7 +107,7 @@ echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/chlist_printer.pl 2> /dev/nul echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/compare_menu.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/url_printer.pl 2> /dev/null echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/proxy.sh 2> /dev/null -echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/web_magentatv_de.php 2> /dev/nul +echo "tkm/ tkm/de/" | xargs -n 1 cp -v easyepg/tkm/web_magentatv_de.php 2> /dev/null # RADIOTIMES echo "Updating RadioTimes..." From 70519a6477a1f993b59128552316d6df49da8ecc Mon Sep 17 00:00:00 2001 From: DeBaschdi Date: Mon, 26 Aug 2019 06:08:00 +0200 Subject: [PATCH 5/7] Update branch-debaschdi.sh --- branch-debaschdi.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/branch-debaschdi.sh b/branch-debaschdi.sh index 301db46..1e72e94 100644 --- a/branch-debaschdi.sh +++ b/branch-debaschdi.sh @@ -182,4 +182,4 @@ echo "CLEAN" rm -rf easyepg/ # DONE -echo "UPDATE FINISHED!" +echo "UPDATE FINISHED! --> Branch DeBaschdi" From 6b2b426a7e07056a90b43101f1dec7cf7d88d554 Mon Sep 17 00:00:00 2001 From: DeBaschdi Date: Mon, 26 Aug 2019 06:10:48 +0200 Subject: [PATCH 6/7] Update update.sh --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index def93e8..f4aa927 100755 --- a/update.sh +++ b/update.sh @@ -32,7 +32,7 @@ cp easyepg/combine.sh combine.sh 2> /dev/null cp easyepg/prog_combine.pl prog_combine.pl 2> /dev/null cp easyepg/LICENSE LICENSE 2> /dev/null cp easyepg/update.sh update.sh 2> /dev/null - +cp easyepg/branch-debaschdi.sh branch-debaschdi.sh 2> /dev/null # HORIZON echo "Updating Horizon..." From 4008a45cf55706287c329dfcfd2c43936cd07dbc Mon Sep 17 00:00:00 2001 From: Jan-Luca Neumann Date: Sun, 8 Sep 2019 14:33:32 +0200 Subject: [PATCH 7/7] Telekom: Several fixes for proxy script version * Find correct file path to show the download progress * Always display 100% bar after finishing the download process --- tkm/tkm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tkm/tkm.sh b/tkm/tkm.sh index 1df3de2..52bc3ec 100755 --- a/tkm/tkm.sh +++ b/tkm/tkm.sh @@ -131,7 +131,7 @@ function status_manifest_download { z100="[####################]" df=$(find mani/ -type f | wc -l) ; - ftd=$(wc -l < mani/common) ; + if [ -e mani/common ]; then ftd=$(wc -l < mani/common); else ftd=$(wc -l < mani/day00); fi; status=$(expr $df \* 100 / $ftd - 2) ; if [[ $status -gt 100 || $status -eq 100 ]]; then status="100"; fi if [[ $status -gt 0 && $status -lt 5 || $status -eq 0 ]]; then bar="$z0"; elif [[ $status -gt 5 && $status -lt 10 ]]; then bar="$z5"; elif [[ $status -gt 10 && $status -lt 15 ]] ; then bar="$z10"; elif [[ $status -gt 15 && $status -lt 20 ]] ; then bar="$z15"; elif [[ $status -gt 20 && $status -lt 25 ]] ; then bar="$z20"; elif [[ $status -gt 25 && $status -lt 30 ]] ; then bar="$z25"; elif [[ $status -gt 30 && $status -lt 35 ]] ; then bar="$z30"; elif [[ $status -gt 35 && $status -lt 40 ]] ; then bar="$z35"; elif [[ $status -gt 40 && $status -lt 45 ]] ; then bar="$z40"; elif [[ $status -gt 40 && $status -lt 50 ]] ; then bar="$z45"; elif [[ $status -gt 50 && $status -lt 55 ]] ; then bar="$z50"; elif [[ $status -gt 55 && $status -lt 60 ]] ; then bar="$z55"; elif [[ $status -gt 60 && $status -lt 65 ]] ; then bar="$z60"; elif [[ $status -gt 60 && $status -lt 70 ]] ; then bar="$z65"; elif [[ $status -gt 70 && $status -lt 75 ]] ; then bar="$z70"; elif [[ $status -gt 70 && $status -lt 80 ]] ; then bar="$z75"; elif [[ $status -gt 80 && $status -lt 85 ]] ; then bar="$z80"; elif [[ $status -gt 85 && $status -lt 90 ]] ; then bar="$z85"; elif [[ $status -gt 90 && $status -lt 95 ]] ; then bar="$z90"; elif [[ $status -gt 95 && $status -lt 100 ]] ; then bar="$z95"; elif [ $status -eq 100 ] ; then bar="$z100";fi @@ -168,7 +168,7 @@ wait rm mani/day0* 2> /dev/null && rm mani/common 2> /dev/null -echo "DONE!" && printf "\n" +printf "\rProgress [####################] 100%% DONE!\n\n" #