LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-19-2008, 05:56 PM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 57
Watch 2300+ Internet TV channels ! (small help)


Hello,

A n00b coded something to get >2300 channels for Linux.
The program is in the script here.

Please could a real coder/programer interested to create a great internet tv for linux help me ?

Please PM me, if you got a package release or any kind of progresses on this project.

(This works up to now only after saving with firefox the frame)

A n00b started, some coders to continue/finish please and distribute

Last edited by frenchn00b; 04-19-2008 at 07:14 PM.
 
Old 04-20-2008, 07:50 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Quote:
Originally Posted by frenchn00b View Post
Please PM me, if you got a package release or any kind of progresses on this project.
I know you didn't mean it that way but e-mail or PM benefits you only. And that is *not* how things should work at LQ.


Here's my version of the script:
Code:
#/bin/sh --
#set -vxe
for req in links zenity vlc realplay; do which $req >/dev/null 2>&1 || exit 1; done
TEMPDIR="${HOME}/tmp"
[ -d "${TEMPDIR}" ] || { mkdir "${TEMPDIR}" || exit 1; }
TEMPF="${TEMPDIR}/.wwitvsh.$$.tmp"
__haveTemp() { [ -e "${TEMPF}" ] || exit 1; }
__rmTemp() { rm -f "${TEMPF}.list"; rm -f "${TEMPF}"; }
__displayErr() { zenity --title="FCOL" --error --text "You failed miserably."; exit 1; }
__reqPage() { ADDR=`zenity --title="Stage One: URI" --entry --text "Give me the full address of the webpage:" \
--entry-text "http://www.si.te/dir/page.html" 2>/dev/null`
[ -n "${ADDR}" ] || __displayErr; [ "${ADDR}" = "http://www.si.te/dir/page.html" ] && __displayErr
[ "${ADDR:0:4}" = "http" ] || __displayErr; [ "${ADDR:4:3}" = "://" ] || __displayErr;
[ "${ADDR:0:28}" = "http://wwitv.com/television/" ] || __displayErr; }
__dumpPage() { which links >/dev/null 2>&1 || exit 1; links -dump "${ADDR}" 2>/dev/null|\
tr -s ' ' > "${TEMPF}" || exit 1; }
__parsePage() { __haveTemp; row=0; grep "\[[0-9]\{1,3\}\]" "${TEMPF}"|cut -d "[" -f 2|tr "]" " "\
|while read seq title; do hrefseq=$[${seq}+1]; href=`grep "^[[:blank:]]${hrefseq}\.[[:blank:]]javascript.l" \
"${TEMPF}"|egrep "\.(ram|asx)"|awk -F"'" '{print $4}'`; [ -z $href ] || { ((row++)); \
echo "${row};${href};\"${title}\""; }; done > "${TEMPF}".list; }
__displayGo() { __haveTemp; RES=($(awk -F';' '{print $1, $NF}' "${TEMPF}.list"|zenity --title="Channel list" \
--width=600 --height=800 --list --text "Channel list" --radiolist --column "Nr" --column "Channel"  --separator=" "))
RES=`grep -m1 "^${RES[0]};" "${TEMPF}.list"|awk -F';' '{print $2}'`; [ -z $RES ] || { zenity --title="Access channel?" \
--question --text "Access channel: \""${RES}"\"?"; [ "${RES%.ram}" = "${RES%}" ] && exec vlc ${RES} || exec realplay \
${RES}; }; }; __rmTemp; __reqPage; __dumpPage; __parsePage; __displayGo; __rmTemp; exit 0
This kludge:
- requires BaSH,
- requires VLC and Realplayer or you change it to use whatever else,
- requires Zenity or you change it to use Gdialog, Xdialog or whatever else,
- works only with URIs of wwitv.com/television/,
- doesn't save listings, selections or whatever else between runs,
- doesn't come with any documentation. Please read the script :-]

That said I remember an article about some (recent) OSS app that delivers just this but for a myriad of sources but I can't remember the name. Anyone? You're free to use this script but if you enhance it you are requested to post your modifications or a diff here, preferably in BB code tags.
 
Old 04-20-2008, 01:12 PM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
That said I remember an article about some (recent) OSS app that delivers just this but for a myriad of sources but I can't remember the name. Anyone? You're free to use this script but if you enhance it you are requested to post your modifications or a diff here, preferably in BB code tags.
Great Job !! Thanks for your politics too.
I hope we and community keep improving the script/project in that way.

Linux is sharing and enhancing your community programs !
 
Old 04-20-2008, 01:40 PM   #4
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Wink

It works amazing well. The zenity is really great job for X and does a great job for frontend. It can be used as backend for mythtv / freevo.

Here is the howto (got from the code):

:Installation:
(1) as root only (debian): apt-get install links zenity vlc
(2) the code I used for the script (I removed realplay), and used mplayer:
Code:
#/bin/sh --
#set -vxe
for req in links zenity vlc mplayer ; do which $req >/dev/null 2>&1 || exit 1; done
TEMPDIR="${HOME}/tmp"
[ -d "${TEMPDIR}" ] || { mkdir "${TEMPDIR}" || exit 1; }
TEMPF="${TEMPDIR}/.wwitvsh.$$.tmp"
__haveTemp() { [ -e "${TEMPF}" ] || exit 1; }
__rmTemp() { rm -f "${TEMPF}.list"; rm -f "${TEMPF}"; }
__displayErr() { zenity --title="FCOL" --error --text "You failed miserably."; exit 1; }
__reqPage() { ADDR=`zenity --title="Stage One: URI" --entry --text "Give me the full address of the webpage:" \
--entry-text "http://www.si.te/dir/page.html" 2>/dev/null`
[ -n "${ADDR}" ] || __displayErr; [ "${ADDR}" = "http://www.si.te/dir/page.html" ] && __displayErr
[ "${ADDR:0:4}" = "http" ] || __displayErr; [ "${ADDR:4:3}" = "://" ] || __displayErr;
[ "${ADDR:0:28}" = "http://wwitv.com/television/" ] || __displayErr; }
__dumpPage() { which links >/dev/null 2>&1 || exit 1; links -dump "${ADDR}" 2>/dev/null|\
tr -s ' ' > "${TEMPF}" || exit 1; }
__parsePage() { __haveTemp; row=0; grep "\[[0-9]\{1,3\}\]" "${TEMPF}"|cut -d "[" -f 2|tr "]" " "\
|while read seq title; do hrefseq=$[${seq}+1]; href=`grep "^[[:blank:]]${hrefseq}\.[[:blank:]]javascript.l" \
"${TEMPF}"|egrep "\.(ram|asx)"|awk -F"'" '{print $4}'`; [ -z $href ] || { ((row++)); \
echo "${row};${href};\"${title}\""; }; done > "${TEMPF}".list; }
__displayGo() { __haveTemp; RES=($(awk -F';' '{print $1, $NF}' "${TEMPF}.list"|zenity --title="Channel list" \
--width=600 --height=800 --list --text "Channel list" --radiolist --column "Nr" --column "Channel"  --separator=" "))
RES=`grep -m1 "^${RES[0]};" "${TEMPF}.list"|awk -F';' '{print $2}'`; [ -z $RES ] || { zenity --title="Access channel?" \
--question --text "Access channel: \""${RES}"\"?"; [ "${RES%.ram}" = "${RES%}" ] && exec vlc ${RES} || exec mplayer \
${RES}; }; }; __rmTemp; __reqPage; __dumpPage; __parsePage; __displayGo; __rmTemp; exit 0
:Running:
(1) firefox http://wwitv.com/portal.htm &
(2) on the left frame, copy link location of the country eg:
http://wwitv.com/television/217.htm
(3) run the script, and in the zenity question, which page, paste it
(4) one get a channel list, just select, and thank the author unSpawn !!
 
Old 04-20-2008, 02:40 PM   #5
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
I made a small modif to the script. One can launch it also with giving the title in it, as eg:
code iw.sh:
Code:
#/bin/sh --
#set -vxe

ACT="$1"

if [ "$ACT" == "--help" ] ; then 
	echo "Help:"
	echo "--help for help"
	echo "--debug for running with debug"
	echo "Use:"
	echo "script URL"
	exit -1
fi


for req in links zenity vlc mplayer ; do which $req >/dev/null 2>&1 || exit 1; done
TEMPDIR="${HOME}/tmp"
[ -d "${TEMPDIR}" ] || { mkdir "${TEMPDIR}" || exit 1; }
TEMPF="${TEMPDIR}/.wwitvsh.$$.tmp"
__haveTemp() { [ -e "${TEMPF}" ] || exit 1; }
__rmTemp() { rm -f "${TEMPF}.list"; rm -f "${TEMPF}"; }
__displayErr() { zenity --title="FCOL" --error --text "You failed miserably."; exit 1; }
__reqPage() { if [   "$ACT" == "" ]  || [ "$ACT" == "--debug" ] ; then 

ADDR=`zenity --title="Stage One: URI" --entry --text "Give me the full address of the webpage:" \
--entry-text "http://www.si.te/dir/page.html" 2>/dev/null`

fi

if [ "$ACT" != "" ]  ; then
[ "$ACT" != "--debug" ] && ADDR="$ACT"
fi

echo "The address retrieving: ${ADDR}"
[ -n "${ADDR}" ] || __displayErr; [ "${ADDR}" = "http://www.si.te/dir/page.html" ] && __displayErr
[ "${ADDR:0:4}" = "http" ] || __displayErr; [ "${ADDR:4:3}" = "://" ] || __displayErr;
[ "${ADDR:0:28}" = "http://wwitv.com/television/" ] || __displayErr; }
__dumpPage() { which links >/dev/null 2>&1 || exit 1; links -dump "${ADDR}" 2>/dev/null|\
tr -s ' ' > "${TEMPF}" || exit 1; }
__parsePage() { __haveTemp; row=0; grep "\[[0-9]\{1,3\}\]" "${TEMPF}"|cut -d "[" -f 2|tr "]" " "\
|while read seq title; do hrefseq=$[${seq}+1]; href=`grep "^[[:blank:]]${hrefseq}\.[[:blank:]]javascript.l" \
"${TEMPF}"|egrep "\.(ram|asx)"|awk -F"'" '{print $4}'`; [ -z $href ] || { ((row++)); \
echo "${row};${href};\"${title}\""; }; done > "${TEMPF}".list; }
__displayGo() { __haveTemp; RES=($(awk -F';' '{print $1, $NF}' "${TEMPF}.list"|zenity --title="Channel list" \
--width=600 --height=800 --list --text "Channel list" --radiolist --column "Nr" --column "Channel"  --separator=" "))
RES=`grep -m1 "^${RES[0]};" "${TEMPF}.list"|awk -F';' '{print $2}'`; [ -z $RES ] || { 
if "$ACT" = "--debug" ; then
zenity --title="Access channel?" \
--question --text "Access channel: \""${RES}"\"?";
fi
[ "${RES%.ram}" = "${RES%}" ] && exec vlc ${RES} || exec mplayer \
${RES}; }; }; __rmTemp; __reqPage; __dumpPage; __parsePage; __displayGo; __rmTemp; exit 0
nfo:
- --debug and --help have been added
- sorry for the coding style: damn (one can improve it)

Last edited by frenchn00b; 04-20-2008 at 02:42 PM.
 
Old 04-20-2008, 07:49 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Your coding style looks OK to me. No problem there. Good to see it works and thanks for posting your mods.
 
Old 04-21-2008, 03:47 PM   #7
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by unSpawn View Post
Your coding style looks OK to me. No problem there. Good to see it works and thanks for posting your mods.
Thanks! I welcome you too. You made a great job really.
I am thinking to implement it to my freevo box. It's becoming a mega multimedia center: regular tv, movies, images, bit of console, weather, lirc, webradio, and I hope webtv

Last edited by frenchn00b; 04-21-2008 at 03:49 PM.
 
Old 05-04-2008, 12:06 PM   #8
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by unSpawn View Post
Your coding style looks OK to me. No problem there. Good to see it works and thanks for posting your mods.
Dear Unspawn,

I found really very great your coding;
I gave this great file to another machine. The problem is that I get this :
http://img368.imageshack.us/img368/1...escriptdo7.jpg

the strange thing is that links, zenity, and vlc, mplayer are intalled.

I run your script very often since I do not have TV.
 
Old 05-04-2008, 03:22 PM   #9
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Problem found !

I found the code works better with this (links replaced by elinks):

this is working:

the Version 03 now
Code:
#/bin/sh --
#set -vxe

ACT="$1"



if [ "$ACT" == "pl" ] ; then 
	ACT="http://wwitv.com/television/168.htm"
fi

if [ "$ACT" == "be" ] ; then 
	ACT="http://wwitv.com/television/21.htm"
fi

if [ "$ACT" == "fr" ] ; then 
	ACT="http://wwitv.com/television/73.htm"
fi

if [ "$ACT" == "de" ] ; then 
	ACT="http://wwitv.com/television/81.htm"
fi


if [ "$ACT" == "au" ] ; then 
	ACT="http://wwitv.com/television/13.htm"
fi

if [ "$ACT" == "at" ] ; then 
	ACT="http://wwitv.com/television/14.htm"
fi

if [ "$ACT" == "uk" ] ; then 
	ACT="http://wwitv.com/television/217.htm"
fi


if [ "$ACT" == "--help" ] ; then 
	echo "Help:"
	echo "--help for help"
	echo "--debug for running with debug"
	echo "Use:"
	echo "script URL"
	exit -1
fi


for req in links zenity vlc mplayer ; do which $req >/dev/null 2>&1 || exit 1; done
TEMPDIR="${HOME}/tmp"
[ -d "${TEMPDIR}" ] || { mkdir "${TEMPDIR}" || exit 1; }
TEMPF="${TEMPDIR}/.wwitvsh.$$.tmp"
__haveTemp() { [ -e "${TEMPF}" ] || exit 1; }
__rmTemp() { rm -f "${TEMPF}.list"; rm -f "${TEMPF}"; }
__displayErr() { zenity --title="FCOL" --error --text "You failed miserably."; exit 1; }
__reqPage() { if [   "$ACT" == "" ]  || [ "$ACT" == "--debug" ] ; then 

ADDR=`zenity --title="Stage One: URI" --entry --text "Give me the full address of the webpage:" \
--entry-text "http://www.si.te/dir/page.html" 2>/dev/null`

fi

if [ "$ACT" != "" ]  ; then
[ "$ACT" != "--debug" ] && ADDR="$ACT"
fi

echo "The address retrieving: ${ADDR}"
[ -n "${ADDR}" ] || __displayErr; [ "${ADDR}" = "http://www.si.te/dir/page.html" ] && __displayErr
[ "${ADDR:0:4}" = "http" ] || __displayErr; [ "${ADDR:4:3}" = "://" ] || __displayErr;
[ "${ADDR:0:28}" = "http://wwitv.com/television/" ] || __displayErr; }
__dumpPage() { which links >/dev/null 2>&1 || exit 1; elinks -dump "${ADDR}" 2>/dev/null|\
tr -s ' ' > "${TEMPF}" || exit 1; }
__parsePage() { __haveTemp; row=0; grep "\[[0-9]\{1,3\}\]" "${TEMPF}"|cut -d "[" -f 2|tr "]" " "\
|while read seq title; do hrefseq=$[${seq}+1]; href=`grep "^[[:blank:]]${hrefseq}\.[[:blank:]]javascript.l" \
"${TEMPF}"|egrep "\.(ram|asx)"|awk -F"'" '{print $4}'`; [ -z $href ] || { ((row++)); \
echo "${row};${href};\"${title}\""; }; done > "${TEMPF}".list; }
__displayGo() { __haveTemp; RES=($(awk -F';' '{print $1, $NF}' "${TEMPF}.list"|zenity --title="Channel list" \
--width=600 --height=800 --list --text "Channel list" --radiolist --column "Nr" --column "Channel"  --separator=" "))
RES=`grep -m1 "^${RES[0]};" "${TEMPF}.list"|awk -F';' '{print $2}'`; [ -z $RES ] || { 
if "$ACT" = "--debug" ; then
zenity --title="Access channel?" \
--question --text "Access channel: \""${RES}"\"?";
fi
[ "${RES%.ram}" = "${RES%}" ] && exec vlc ${RES} || exec mplayer \
${RES}; }; }; __rmTemp; __reqPage; __dumpPage; __parsePage; __displayGo; __rmTemp; exit 0

Last edited by frenchn00b; 05-04-2008 at 03:24 PM.
 
Old 05-04-2008, 04:06 PM   #10
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Version 4:

Updates:
- mplayer all the time (no vlc anymore) (I dont know if it is a good choice ... since VLC already 'hacky' the links )
- while read, a loop that just ask you for the country

advices: try fr, and choose NRJ tv: cool music

Code:
#/bin/sh --
#set -vxe


while [ 1 ]  ; do 

echo "The country ?"
read ACT

#ACT="$1"



if [ "$ACT" == "pl" ] ; then 
	ACT="http://wwitv.com/television/168.htm"
fi

if [ "$ACT" == "be" ] ; then 
	ACT="http://wwitv.com/television/21.htm"
fi

if [ "$ACT" == "fr" ] ; then 
	ACT="http://wwitv.com/television/73.htm"
fi

if [ "$ACT" == "de" ] ; then 
	ACT="http://wwitv.com/television/81.htm"
fi


if [ "$ACT" == "au" ] ; then 
	ACT="http://wwitv.com/television/13.htm"
fi

if [ "$ACT" == "at" ] ; then 
	ACT="http://wwitv.com/television/14.htm"
fi

if [ "$ACT" == "uk" ] ; then 
	ACT="http://wwitv.com/television/217.htm"
fi


if [ "$ACT" == "--help" ] ; then 
	echo "Help:"
	echo "--help for help"
	echo "--debug for running with debug"
	echo "Use:"
	echo "script URL"
	exit -1
fi


for req in links zenity vlc mplayer ; do which $req >/dev/null 2>&1 || exit 1; done
TEMPDIR="${HOME}/tmp"
[ -d "${TEMPDIR}" ] || { mkdir "${TEMPDIR}" || exit 1; }
TEMPF="${TEMPDIR}/.wwitvsh.$$.tmp"
__haveTemp() { [ -e "${TEMPF}" ] || exit 1; }
__rmTemp() { rm -f "${TEMPF}.list"; rm -f "${TEMPF}"; }
__displayErr() { zenity --title="FCOL" --error --text "You failed miserably."; exit 1; }
__reqPage() { if [   "$ACT" == "" ]  || [ "$ACT" == "--debug" ] ; then 

ADDR=`zenity --title="Stage One: URI" --entry --text "Give me the full address of the webpage:" \
--entry-text "http://www.si.te/dir/page.html" 2>/dev/null`

fi

if [ "$ACT" != "" ]  ; then
[ "$ACT" != "--debug" ] && ADDR="$ACT"
fi

echo "The address retrieving: ${ADDR}"
[ -n "${ADDR}" ] || __displayErr; [ "${ADDR}" = "http://www.si.te/dir/page.html" ] && __displayErr
[ "${ADDR:0:4}" = "http" ] || __displayErr; [ "${ADDR:4:3}" = "://" ] || __displayErr;
[ "${ADDR:0:28}" = "http://wwitv.com/television/" ] || __displayErr; }
__dumpPage() { which links >/dev/null 2>&1 || exit 1; elinks -dump "${ADDR}" 2>/dev/null|\
tr -s ' ' > "${TEMPF}" || exit 1; }
__parsePage() { __haveTemp; row=0; grep "\[[0-9]\{1,3\}\]" "${TEMPF}"|cut -d "[" -f 2|tr "]" " "\
|while read seq title; do hrefseq=$[${seq}+1]; href=`grep "^[[:blank:]]${hrefseq}\.[[:blank:]]javascript.l" \
"${TEMPF}"|egrep "\.(ram|asx)"|awk -F"'" '{print $4}'`; [ -z $href ] || { ((row++)); \
echo "${row};${href};\"${title}\""; }; done > "${TEMPF}".list; }
__displayGo() { __haveTemp; RES=($(awk -F';' '{print $1, $NF}' "${TEMPF}.list"|zenity --title="Channel list" \
--width=600 --height=800 --list --text "Channel list" --radiolist --column "Nr" --column "Channel"  --separator=" "))
RES=`grep -m1 "^${RES[0]};" "${TEMPF}.list"|awk -F';' '{print $2}'`; [ -z $RES ] || { 
if "$ACT" = "--debug" ; then
zenity --title="Access channel?" \
--question --text "Access channel: \""${RES}"\"?";
fi
echo " the links is : ${RES%} ${RES} "
echo  ${RES} | grep http
if [ "${RES%.ram}" = "${RES%}" ] ; then 
wget ${RES} -O ~/tmp/tmp.tmp  
cat ~/tmp/tmp.tmp  | grep "Ref hre" | xargs  mplayer -fs 
else 
mplayer \
${RES};
fi
 }; }; __rmTemp; __reqPage; __dumpPage; __parsePage; __displayGo; __rmTemp;
# exit 0


done

Last edited by frenchn00b; 05-04-2008 at 04:09 PM.
 
Old 05-05-2008, 07:35 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Quote:
Originally Posted by frenchn00b View Post
The problem is that I get this
Ah. That's the Zenity --radiolist getting mangled. Would need debug output to know what happened. Run script as 'sh -vx script.sh 2>&1 | tee /tmp/script.tee'.


Haven't run the script yet, but where you do
Code:
if [ "$ACT" == "pl" ] ; then 
	ACT="http://wwitv.com/television/168.htm"
fi

if [ "$ACT" == "be" ] ; then 
	ACT="http://wwitv.com/television/21.htm"
fi
You could do
Code:
if [ "$ACT" = "pl" ] ; then 
	ACT="http://wwitv.com/television/168.htm"
elif [ "$ACT" == "be" ] ; then 
	ACT="http://wwitv.com/television/21.htm"
# ad nauseam
or even "better"
Code:
case "$ACT" in
pl) ACT=168;;
be) ACT=21";;
# ad nauseam
esac
ACT="http://wwitv.com/television/${ACT}.htm"
That way it's more efficient (as you type less) and in terms of structure easier to read and modify IMHO. Cool to see you modded this further. Have fun!
 
Old 05-05-2008, 02:35 PM   #12
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by unSpawn View Post
Ah. That's the Zenity --radiolist getting mangled. Would need debug output to know what happened. Run script as 'sh -vx script.sh 2>&1 | tee /tmp/script.tee'.


Haven't run the script yet, but where you do
Code:
if [ "$ACT" == "pl" ] ; then 
	ACT="http://wwitv.com/television/168.htm"
fi

if [ "$ACT" == "be" ] ; then 
	ACT="http://wwitv.com/television/21.htm"
fi
You could do
Code:
if [ "$ACT" = "pl" ] ; then 
	ACT="http://wwitv.com/television/168.htm"
elif [ "$ACT" == "be" ] ; then 
	ACT="http://wwitv.com/television/21.htm"
# ad nauseam
or even "better"
Code:
case "$ACT" in
pl) ACT=168;;
be) ACT=21";;
# ad nauseam
esac
ACT="http://wwitv.com/television/${ACT}.htm"
That way it's more efficient (as you type less) and in terms of structure easier to read and modify IMHO. Cool to see you modded this further. Have fun!
thanks !! I appreciate a lot

I really liked v much to read ur script; it took me 1hour to guess what u do lol since it's so well written

You're my code basher Master !
 
Old 05-05-2008, 04:51 PM   #13
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
I noted ... I think we have a bug ... if you select France, we are missing the ".Calais TV 398K
Local TV from Calais." ...
that is given by zenity , ... do you have the same missing link .. should be more maybe ?
 
Old 05-06-2008, 08:42 AM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
Quote:
Originally Posted by frenchn00b View Post
I noted ... I think we have a bug ... if you select France, we are missing the ".Calais TV 398K
Local TV from Calais." ...
that is given by zenity , ... do you have the same missing link .. should be more maybe ?
Yes, unfortunately *many* more. Debugging it it appears to be some sort of Zenity behaviour and I wouldn't be surprised if other .*dialog applications displayed the same problem. Zenity --list also ignores '|nl' and it's --separator is b0rked as well. End of the line for me since I don't have any reference to build lists that conform to whatever warped specs Zenity has.
 
Old 05-12-2008, 06:55 AM   #15
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Hi Unspawn,

I just made another script (my second , sorry I ddint use esac yet) :
it is aimed for you server with you lircrc

Code:
#!/bin/bash

if [ !  -f ~/.festivalrc ] ; then
cat <<\! >~/.festivalrc
(Parameter.set 'Audio_Command "aplay -q -c 1 -t raw -f s16 -r $SR $FILE")
(Parameter.set 'Audio_Method 'Audio_Command)
!
fi

if [ "$1" == "--help" ] ; then 
	echo " play, inc, dec, reset, --help  are the possible commands"
	exit 0
fi

if [ "$1" == "reset" ] ; then 
	rm ~/.noxstreamtuner 
	exit 0
fi


if [ ! -f ~/.noxstreamtuner  ] ; then
	 echo "val= 1" > ~/.noxstreamtuner 
	 echo "max= 5" >> ~/.noxstreamtuner 
fi

valuepl="$(cat ~/.noxstreamtuner | grep val | awk '{  print $2 }' )"
maxvaluepl="$(cat ~/.noxstreamtuner | grep max | awk '{  print $2 }'  )"

if [ "$1" == "inc" ]  ; then
	valuepl="$[$valuepl+1]"
fi

if [ "$1" == "dec" ]  ; then
	valuepl="$[$valuepl-1]"
fi

echo "Checker : $[-$valuepl+$maxvaluepl]"
if [ "$[$valuepl-$maxvaluepl]" -gt 0  ] ; then
	valuepl="1"
fi

echo "val= $valuepl"  >  ~/.noxstreamtuner 
echo "max= $maxvaluepl"  >>  ~/.noxstreamtuner 


echo "$(cat ~/.noxstreamtuner | grep val | awk '{  print $2 }' )   out of $(cat ~/.noxstreamtuner | grep max | awk '{  print $2 }' ) "   | festival --tts  

if [  "$valuepl" == "1" ] ; then 
	echo "bbc" | festival --tts
fi

if [  "$valuepl" == "2" ] ; then 
	echo "Linux podcasts" | festival --tts
fi

if [  "$valuepl" == "3" ] ; then 
	echo "Studio brussels" | festival --tts
fi

if [  "$valuepl" == "4" ] ; then 
	echo "France info" | festival --tts
fi

if [  "$valuepl" == "5" ] ; then 
	echo "Audacious" | festival --tts
fi



if [ "play" == "$1" ] ; then
	killall -e mplayer totem amule vlc amarok audacious
   
	if [ "$valuepl" == "1" ] ; then
		mplayer -fs http://a352.l2168662744.c21686.n.lm.akamaistream.net/D/352/21686/v0001/reflector:50431 &
	fi

	if [ "$valuepl" == "2" ] ; then
		elinks  http://feeds.feedburner.com/linuxquestions/LQRadioALL  > /tmp/es
		grephttp  /tmp/es | grep mp3 | xargs totem &
	fi

	if [ "$valuepl" == "3" ] ; then
		mplayer http://mp3.streampower.be/stubru-mid.mp3 &
	fi

	if [ "$valuepl" == "4" ] ; then
		 mplayer  -af volume=-20 "http://players.creacast.com/creacast/france_info/playlist.m3u"  &
	fi

	if [ "$valuepl" == "5" ] ; then
		 audacious &
	fi



fi


cat ~/.noxstreamtuner
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Shell script to monitor or watch the disk space.... small help needed vikas027 Programming 5 10-21-2007 11:04 AM
Windows emulation - a n00b-made bundle of questions TREBULATOR Linux - Software 2 01-22-2006 09:20 PM
watch streaming wmv & wvx on internet yossipelleg Linux - Software 2 01-11-2006 04:11 AM
Big project for small N00b HKJGN Linux - Newbie 0 02-14-2005 08:55 PM
n00b internet woes caneman Linux - Newbie 1 01-16-2005 06:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration