Thread: I need help correcting a bash script
hello, hope i'm posting in right section. reason can't understand scripting language. please make work me?code:
- jk says: here one-liner bash function allow stream iheartradio station typing: iheartradio function iheartradio { mplayer -quiet $(wget -o – -q “http://p2.$1.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen_live” | sed -n “s|.*primary_location=\”\(rtmp://[^\"]*\)\”.*|\1|p”) -novideo >& /dev/null; }
i'll try explain i'm doing here.
there's flash radio site, , want access terminal through simple command.
rtmp:// stream changes every hour or that. stream can found xml page http://p2.wrzx-fm.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen _live
the command plays fine radio in terminal is: mplayer "rtmp://url" -novideocode:<stream id="909" primary_location="rtmp://cp21575.live.edgefcs.net/live/ind_in_wrzx-fm_or@s7701?auth=daebvahavbmbyczbed2bcdrcibtd9dqascm-bot39e-4q-ml4v7_9opffom4gbvmytaq&aifp=1234&channelid=909&cprog=_&market=indianapolis-in&requestor=wrzx-fm&server_name=p2.wrzx-fm.ccomrcdn.com&site_id=2005&station_id=wrzx-fm&mnm=2&typeofplay=0" backup_location=""/>
if updates, have open xml page again , again , copy rtmp link play.
aparently guy figured out script should grab rtmp url , run in mplayer through single command, i'm idiot , have no knowledge why it's not working
know need put #!/bin/bash line @ beginning of script , need make executable in order run it, it's not working
here's script:
(i have replaced $1 script line wrzx-fm because that's radio's name btw)
code:#!/bin/bash function iheartradio { mplayer -quiet $(wget -o – -q “http://p2.wrzx-fm.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen_live” | sed -n “s|.*primary_location=\”\(rtmp://[^\"]*\)\”.*|\1|p”) -novideo >& /dev/null; }ok, , run thing:code:tzily@pc:~/desktop$ chmod u+x iheartradio.sh tzily@pc:~/desktop$
i'm trying hard run it, assume script needs something...code:tzily@pc:~/desktop$ iheartradio iheartradio: command not found tzily@pc:~/desktop$ iheartradio.sh iheartradio.sh: command not found tzily@pc:~/desktop$ ./iheartradio.sh tzily@pc:~/desktop$ /.iheartradio.sh bash: /.iheartradio.sh: no such file or directory tzily@pc:~/desktop$ .iheartradio.sh .iheartradio.sh: command not found tzily@pc:~/desktop$ '/home/tzily/desktop/iheartradio.sh' tzily@pc:~/desktop$ sudo iheartradio.sh [sudo] password tzily: sudo: iheartradio.sh: command not found tzily@pc:~/desktop$
might pathetic experienced fellows around here, i'm new , if don't right, can't sleep tonightplease correct , test me. please...
first, put scripts in code tags, not quote tags. it's pita change quotes ascii chars.
second, if put in script, don't need create function, it's 1 of of both have do. if both, script create function , won't execute function.
, i'm trying split in parts , see why it's not working.
edit
note self: - signs change
2nd note self, url http://p2.$1.ccomrcdn.com/player/player_dispatcher.html?section=radio&action=listen _live without space before _live
it works
after changing quotes, --signs , removing space in url, works (and off course not using function , script together).
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support Multimedia Software [ubuntu] I need help correcting a bash script
Ubuntu
Comments
Post a Comment