maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   simple get_iplayer gui (https://talk.maemo.org/showthread.php?t=70397)

timttmy 2011-02-27 10:35

simple get_iplayer gui
 
5 Attachment(s)
Hello everyone, I'm a long time observer but first time poster in this forum.
I've noticed that get_iplayer has made it's way into the app manager so I thought I would share a script I wrote ages ago (and just ported to my N900) that adds zenity dialogs to simply build a get_iplayer command to download or live stream a programme from the BBC iplayer.
What you will need

You have to have a UK IP to access the iplayer (or a good UK proxy)

From the repos
get_iplayer
Zenity
rtmpdump
and sed (but everyone has sed right?)

Then you need my script.

Code:

#!/bin/sh
# Version 0.4 Created 07/MAY/2009
# Last edited on 1/Febuary/2011 # Made to work (Hopefully) with the N900
# Damn You osso-xterm -e
# Written by TIMTTMY
#
# A simple get_iplayer script gui using zenity
# Be sure the /path/to/rtmpdump is correct for your system.
# Also you need zenity and sed installed

# Select your player for watching/listening to live streams.
# I find ffplay works best. xine and vlc don't seem to like the live radio feeds.


#PLAYER='xine stdin:/'
PLAYER='ffplay -'
#PLAYER='vlc -'
#PLAYER='mplayer -cache 1024 -'

#Path to save iplayer files
OUTPUT='--output=/media/mmc1/'

RTMPDUMP='/usr/bin/rtmpdump'
# Check to see if rtmpdump is installed in /usr/bin/

if [ -f "$RTMPDUMP" ];
        then
        echo "rtmpdump found"
        else zenity --title "rtmpdump not found in /usr/bin/ " --height=200 --width 400 --error --text "rtmpdump not found in /usr/bin/\n\n\ Please install rtmpdump\n\n In /usr/bin/rtmpdump."
        exit
  fi

# Choose a channel
CHANNEL=$(zenity  --list  --height=325 --width=200 --text "Get_iplayer : Select a channel" --radiolist  --column "Pick" --column "Opinion" TRUE "BBC        tv" FALSE "liveradio" FALSE "livetv" FALSE "radio" FALSE "podcast" FALSE "url" | cut -f 2 | sed 's/ /1/' );
if [ $? = 1 ];
then exit
else
echo "$CHANNEL"
fi

# Stream or store ?
if [ $CHANNEL = url ]
then
echo "Store Mode"
else
STREAM=$(zenity --list --height=175 --width=500 --text "Get_iplayer : Do you want to watch this programme or dump it to disk" --radiolist --column "Pick" --column "Opinion" TRUE "1        '--get'                Save To Disk To Watch Later" FALSE "2        '--stream'        Watch It Now Not Saving To Disk"  | cut -f 1 );
if [ $? = 1 ];
then exit
else
echo "$STREAM"
fi
fi

# Grep for a programme
SEARCH=$(zenity --entry --width=800 --text "Search for a programme or paste a Website URL. leave blank for none." --entry-text "" );
if [ $? = 1 ];
then exit
else
echo "$SEARCH"
fi

if [ $CHANNEL = url ]
then
GET=$(zenity --entry --width=800 --text "execute?" --entry-text "get_iplayer --force --url=$SEARCH --flvstreamer=/usr/bin/rtmpdump" $OUTPUT );
echo "$GET"
exec /usr/bin/osso-xterm -e $GET
exit
else
# Get_iplayer PID
NUM=$(get_iplayer --long --type=$CHANNEL $SEARCH | sed -n '/Added:/!p' | zenity --list --width=1000 --height=800 --title "Fetching feeds, Please wait for list to populate" --column "Files" | sed  "s/ /\n/g" | sed -n '/Added/!p' |  sed "s/:/\n/g" | head -n 1 );
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ put everthing  ^ Don't print lines  ^ put everything  ^           
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ after a space  ^ With Added in them ^ after a : on a  ^
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^ on a new line  ^                    ^ new line        ^
if [ $? = 1 ];
then exit
else
echo "$NUM"
fi
fi
# Flvstreamer modes
VMODE=$(zenity  --list  --height=275 --width=1000 --text "Get_iplayer : Extra Options" --radiolist  --column "Pick" --column "Opinion" FALSE "'--mode=flashhd,flashvhigh --flvstreamer="/usr/bin/rtmpdump"'                        Use this option for HD flash mode" TRUE "'--mode=flashlow --flvstreamer="/usr/bin/rtmpdump"'                        Use this mode for std flash " FALSE "'--mode=flashaacstd --flvstreamer="/usr/bin/rtmpdump"'                Use this option for live radio." FALSE "'--mode=flashstd,flashhigh,flashnormal --flvstreamer="/usr/bin/rtmpdump"'                Use this option for live tv." | cut -f 1 | sed 's/.\(.*\)/\1/' | sed 's/\(.*\)./\1/' );       
if [ $? = 1 ];
then exit
else
echo "$VMODE"
fi

# Build get_iplayer command to run

if [ $STREAM -eq 2 ]
then
GET=$(zenity --entry --width=800 --text "execute?" --entry-text "get_iplayer --stream $NUM --type=livetv,liveradio $VMODE " );
echo "$GET"
exec $GET | $PLAYER
else
GET=$(zenity --entry --width=800 --text "execute?" --entry-text "get_iplayer --type=$CHANNEL --get $NUM $VMODE $OUTPUT " );
echo "$GET"
osso-xterm -e "$GET"
fi

Save the above as iplayGUI.sh on your device.
Make it executable.
Code:

chmod +x iplayGUI.sh
and run it
Code:

sh iplayGUI.sh
Enjoy! No more long get_iplayer commands to write on your phone.

Hopefully someone can fix it so the cancel buttons actually cancel the programme.

br1zer 2011-02-27 19:56

Re: simple get_iplayer gui
 
Thanks bud. However, I can't find Zenity in the repos :(

bigears5000 2011-02-27 20:07

Re: simple get_iplayer gui
 
Quote:

Originally Posted by br1zer (Post 956786)
Thanks bud. However, I can't find Zenity in the repos :(

In xterm type

sudo gainroot
apt-get install zenity

timttmy 2011-02-27 20:39

Re: simple get_iplayer gui
 
Yeah do what bigears5000 said ;)

Let me know if you get it working

rob42 2011-05-18 08:40

Re: simple get_iplayer gui
 
Morning
having a problem getting this to run.
already had get_iplayer loaded via ham. installed other parts and saved script to root on n900.
script starts but bet error which hints at a problem with get_iplayer - ( installed by package manager ?).
have removed get_iplayer and tried to install via apt-get but get told package not found.
where am I going wrong? where should get_iplayer be found ?
thanks

prankster 2011-05-18 08:59

Re: simple get_iplayer gui
 
why only for uk people ?ahh ..proxy set up ?
can we hope for any player which can run pptv without flash problem as there is no update comming on flash 10 ?

kyllerbuzcut 2011-05-18 18:54

Re: simple get_iplayer gui
 
Got this trying to listen to a radio thing....

pipe:: Unknown format

any ideas?

rob42 2011-05-19 08:45

Re: simple get_iplayer gui
 
quick update to problem . have got gt-iplayer to load via apt ( get-iplayer ) but still getting an error - get_iplayer is not writtable.
any ideas ?
ta

Tiboric 2011-05-19 11:30

Re: simple get_iplayer gui
 
Quote:

Originally Posted by rob42 (Post 1009780)
quick update to problem . have got gt-iplayer to load via apt ( get-iplayer ) but still getting an error - get_iplayer is not writtable.
any ideas ?
ta

Code:

sudo chmod 777 /usr/bin/get_iplayer
and if you get another one when updating iplayer

Code:

sudo cp /usr/bin/get_iplayer /usr/bin/get_iplayer.old
sudo chmod 777 /usr/bin/get_iplayer.old

let me know if that worked....

rob42 2011-05-19 13:02

Re: simple get_iplayer gui
 
ta for speedy reply
gave them ago -
tried sudo chmod 777 /usr/bin/get_iplayer first - got error -
" running the updater again.....
info current version 2.78
info check for latest from www.infrdead.org
error.failed to connect to updatesite - update aborted "

www.infradead.org is now http://www.linux-mtd.infradead.org.

I guess I need to make some changes in get_iplayer ? if so howdo I do this?

ta

Tiboric 2011-05-19 13:16

Re: simple get_iplayer gui
 
it was working yesterday, were you connected to the web?

rob42 2011-05-19 20:04

Re: simple get_iplayer gui
 
lol - did check that , typo.
ok its sort of going but getting exit error 1 and it throws itself out.
keep trying.

demolition 2011-05-30 03:45

Re: simple get_iplayer gui
 
I would like to get get_iplayer working for user as well as root so I can get these UI scrits to run...

Edit: console output removed - replacement text:
Had this error
ERROR: get_iplayer is not writable - aborting update (maybe a package manager was used to install get_iplayer?)
And, couldn't chmod 777 the get_iplayer script
I'm only just starting out with the shell so I'm probably doing something wrong! Is more information needed to help me?
-edit: My question is, how can I get get_iplayer to run as user, not root?


All times are GMT. The time now is 09:20.

vBulletin® Version 3.8.8