Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base: 64d67caca8
...
compare: fbb06de252
  • 4 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 92 additions and 42 deletions.
  1. +92 −42 watchteleboy
134 watchteleboy
View
@@ -443,7 +443,7 @@ function set_ui_window_params {
function channel_dialog {
while true
do
- chanlist=$(echo "$CHANNELS" | cut -d " " -f 1)
+ chanlist="$(echo "$CHANNELS" | cut -d " " -f 1) $( uname | grep "Darwin" > /dev/null && echo QUIT)"
if $whiptail
then
wpsetdefault=""
@@ -471,6 +471,7 @@ function channel_dialog {
PS3="Choose a channel: "
select CHANNEL in $chanlist
do
+ [ "$CHANNEL" == "QUIT" ] && exit 0
[ "$CHANNEL" != "" ] && break
done
fi
@@ -525,28 +526,44 @@ function starttime_dialog {
function endtime_dialog {
while true
do
- set_ui_window_params 2
- endtimeinit=$(( $(date -d "$STARTTIME" +%s) + 3600 ))
- ENDTIME=$(whiptail \
- --title "$TITLE" \
- --inputbox "\nStop recording at:" \
- $BOXWIDTH $BOXHEIGHT "$(date -d @${endtimeinit} '+%Y-%m-%d %H:%M')" \
- 3>&2 2>&1 1>&3 )
- [ "$?" != "0" ] && exit 0;
+ if $whiptail
+ then
+ set_ui_window_params 2
+ endtimeinit=$(( $(date -d "$STARTTIME" +%s) + 3600 ))
+ ENDTIME=$(whiptail \
+ --title "$TITLE" \
+ --inputbox "\nStop recording at:" \
+ $BOXWIDTH $BOXHEIGHT "$(date -d @${endtimeinit} '+%Y-%m-%d %H:%M')" \
+ 3>&2 2>&1 1>&3 )
+ [ "$?" != "0" ] && exit 0;
+ else
+ echo -n "Stop recording at: "
+ read ENDTIME
+ fi
if date -d "$ENDTIME" > /dev/null 2>&1
then
if [ $(date -d "$ENDTIME" +%s) -lt $(date -d "$STARTTIME" +%s) ]
then
- whiptail --title "$TITLE" --msgbox \
- " The specified time:\n\n ${ENDTIME}\n\nis before start time ($STARTTIME)." \
- $BOXWIDTH $BOXHEIGHT
+ if $whiptail
+ then
+ whiptail --title "$TITLE" --msgbox \
+ " The specified time:\n\n ${ENDTIME}\n\nis before start time ($STARTTIME)." \
+ $BOXWIDTH $BOXHEIGHT
+ else
+ echo -e "The specified time:\n ${ENDTIME}\nis before start time ($STARTTIME)."
+ fi
else
break
fi
else
- whiptail --title "$TITLE" --msgbox \
- " The specified time:\n\n ${ENDTIME}\n\ncould not be parsed." \
- $BOXWIDTH $BOXHEIGHT
+ if $whiptail
+ then
+ whiptail --title "$TITLE" --msgbox \
+ " The specified time:\n\n ${ENDTIME}\n\ncould not be parsed." \
+ $BOXWIDTH $BOXHEIGHT
+ else
+ echo -e "The specified time:\n ${ENDTIME}\ncould not be parsed."
+ fi
fi
done
}
@@ -578,14 +595,20 @@ function ifschedule_dialog {
function showname_dialog {
while true
do
- set_ui_window_params 2
- shownameinit=$($showname && echo $SHOWNAME || echo $CHANNEL)
- SHOWNAME=$(whiptail \
- --title "$TITLE" \
- --inputbox "\nEnter the name of the show:" \
- $BOXWIDTH $BOXHEIGHT "$shownameinit" \
- 3>&2 2>&1 1>&3 )
- [ "$?" != "0" ] && exit 0;
+ if $whiptail
+ then
+ set_ui_window_params 2
+ shownameinit=$($showname && echo $SHOWNAME || echo $CHANNEL)
+ SHOWNAME=$(whiptail \
+ --title "$TITLE" \
+ --inputbox "\nEnter the name of the show:" \
+ $BOXWIDTH $BOXHEIGHT "$shownameinit" \
+ 3>&2 2>&1 1>&3 )
+ [ "$?" != "0" ] && exit 0;
+ else
+ echo -n "Enter the name of the show: "
+ read SHOWNAME
+ fi
showname=true
[ "$SHOWNAME" = "" ] || break
done
@@ -594,23 +617,42 @@ function showname_dialog {
function recordpath_dialog {
while true
do
- set_ui_window_params 2
- RECORDPATH=$(whiptail \
- --title "$TITLE" \
- --inputbox "\nSpecify a directory to save the recording:" \
- $BOXWIDTH $BOXHEIGHT "$RECORDPATH" \
- 3>&2 2>&1 1>&3 )
- [ "$?" != "0" ] && exit 0;
+ if $whiptail
+ then
+ set_ui_window_params 2
+ RECORDPATH=$(whiptail \
+ --title "$TITLE" \
+ --inputbox "\nSpecify a directory to save the recording:" \
+ $BOXWIDTH $BOXHEIGHT "$RECORDPATH" \
+ 3>&2 2>&1 1>&3 )
+ [ "$?" != "0" ] && exit 0;
+ else
+ echo "Specify a directory to save the recording"
+ echo "(default: $RECORDPATH)"
+ echo -n ":"
+ read RECORDPATHINPUT
+ [ "$RECORDPATHINPUT" != "" ] && RECORDPATH=$RECORDPATHINPUT
+ fi
if [ ! -d "$RECORDPATH" ]
then
- whiptail --title "$TITLE" --msgbox \
- " The specified directory:\n\n ${RECORDPATH}\n\ndoes not exist." \
- $BOXWIDTH $BOXHEIGHT
+ if $whiptail
+ then
+ whiptail --title "$TITLE" --msgbox \
+ " The specified directory:\n\n ${RECORDPATH}\n\ndoes not exist." \
+ $BOXWIDTH $BOXHEIGHT
+ else
+ echo -e "The specified directory:\n ${RECORDPATH}\ndoes not exist."
+ fi
elif [ ! -w "$RECORDPATH" ]
then
- whiptail --title "$TITLE" --msgbox \
- " You don't have permission to write to:\n\n ${RECORDPATH}\n\n" \
- $BOXWIDTH $BOXHEIGHT
+ if $whiptail
+ then
+ whiptail --title "$TITLE" --msgbox \
+ " You don't have permission to write to:\n\n ${RECORDPATH}\n\n" \
+ $BOXWIDTH $BOXHEIGHT
+ else
+ echo -e "You don't have permission to write to:\n ${RECORDPATH}\n"
+ fi
else
break
fi
@@ -618,9 +660,7 @@ function recordpath_dialog {
}
function confirm_dialog {
- set_ui_window_params 2
- answer=$(whiptail --title "$TITLE" --yesno \
- "Scheduled for recording:
+ summary="Scheduled for recording:
Start time: $(date -d "${STARTTIME}" "+%a, %F %H:%M")
End time: $(date -d "${ENDTIME}" "+%a, %F %H:%M")
@@ -628,9 +668,19 @@ Channel: ${CHANNEL}
Show: ${SHOWNAME}
Directory: ${RECORDPATH}
-Are those settings correct?" \
- $BOXWIDTH $BOXHEIGHT 3>&2 2>&1 1>&3 )
- return $answer
+Are those settings correct?"
+ if $whiptail
+ then
+ set_ui_window_params 2
+ answer=$(whiptail --title "$TITLE" --yesno \
+ "$summary" $BOXWIDTH $BOXHEIGHT 3>&2 2>&1 1>&3 )
+ else
+ echo -n "$summary (Y/n): "
+ read answerinput
+ answer=$([ "$answerinput" == "y" ] || [ "$answerinput" == "" ] && echo 0 || echo 1)
+ fi
+ echo "ANSWER IS $answer"
+ return $answer
}
# record option check

No commit comments for this range

Something went wrong with that request. Please try again.