Mplayer fifo.

Hi all,

First of all, sorry for the pastebin link. The code tags aren't working for me.

#!/bin/bash # while-menu-dialog: a menu driven - Pastebin.com

This is a channel "changer" shell script i'm working on. It uses dialog to display the menus.
It was working fine until yesterday. When I try to change channels, it simply does not work.

Here's the fifo:

-rw-r--r-- 1 ignatius users 18 Jan 28 07:49 /tmp/mplayer-control

I'm wondering, what's wrong with the code?

Also, a second question. For the "Custom" option, i'd like to add an input prompt, to allow input to select a channel from /etc/mplayer/channels.conf. Anyone know how I would do this?

Thank you.

What does that mean exactly?

CODE TAGS work for everyone...... they are not complicated and work just fine for everyone, including noobs with 1 post :slight_smile:

No, when I try to encase the code with the code tags, it looks like it doesn't like the carriage returns and/or linefeeds.

Cut and paste... looks just like your pastbin code, poor formatting and all :slight_smile: :

#!/bin/bash

                              # while-menu-dialog: a menu driven system information program

                              DIALOG_CANCEL=1
                              DIALOG_ESC=255
                              HEIGHT=0
                              WIDTH=0

                              display_result() {
                                dialog --title "$1" \
                                  --no-collapse \
                                  --msgbox "$result" 0 0
                              }

                              while true; do
                                exec 3>&1
                                selection=$(dialog \
                                  --backtitle "" \
                                  --title "" \
				  --begin 1 1 \
                                  --clear \
                                  --cancel-label "Exit" \
                                  --menu "Please select:" $HEIGHT $WIDTH 4 \
                                  "1" "  Change channel to previous  " \
                                  "2" "  Change channel to next      " \
                                  "3" "  Custom                      " \
                                  2>&1 1>&3)
                                exit_status=$?
                                exec 3>&-
                                case $exit_status in
                                  $DIALOG_CANCEL)
                                    clear
                                    echo "Program terminated."
                                    exit
                                    ;;
                                  $DIALOG_ESC)
                                    clear
                                    echo "Program aborted." >&2
                                    exit 1
                                    ;;
                                esac

                                case $selection in
                                  0 )
                                    clear
                                    echo "Program terminated."
                                    ;;
                                  1 )
                                    result=$(echo "tv_step_channel -1" > /tmp/mplayer-control)
                                    ;;
                                  2 )
                                    result=$(echo "tv_step_channel 1" > /tmp/mplayer-control)
                                    ;;
                                  3 )
                                    if [[ $(id -u) -eq 0 ]]; then
                                      result=$(echo "tv_set_channel MyNetTV" > /tmp/mplayer-control)
                                    else
                                      result=$(echo "tv_set_channel MyNetTV" > /tmp/mplayer-control)
                                    fi
                                    ;;
                                esac
                              done