You are not logged in.
Hi All,
I've been scratching my head for a few days now, basically I have a script to grab the http stream link from a file, and output the result to 'mpc add'. It doesn't work! It only seems to work if the actual http link is in the initial command, not a grep.
#################################################
This works;
$:mpc add http://bbcmedia.ic.llnwd.net/stream/bbc … 3f5f3f9f66
#################################################
This doesn't works;
$:mpc add `grep -i "$1.*, "/var/local/bbc_radio/urls | head -1 | cut -d',' -f2`
$:mpc play
volume: 80% repeat: off random: off single: off consume: off
ERROR: problems decoding "http://bbcmedia.ic.llnwd.net/stream/bbc … be8fed94bb"16753f5f3f9f66
To prove the grep actually works;
$:echo `grep -i "$1.*, " /var/local/bbc_radio/urls | head -1 | cut -d',' -f2`
$:http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p?s=1430119633&e=1430134033&h=25b6424be8fed94bb816753f5f3f9f66
Tried it another way, still doesn't work!
$:site=`grep -i "$1.*, " /var/local/bbc_radio/urls | head -1 | cut -d',' -f2` ; sudo mpc add $site
$:mpc play
volume: 80% repeat: off random: off single: off consume: off
ERROR: problems decoding "http://bbcmedia.ic.llnwd.net/stream/bbc … be8fed94bb"16753f5f3f9f66
I feel like I've missed something really obvious here any help would be much appreciated!
Thanks
Richy
Offline
################################################# This works; $:mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p?s=1430119633&e=1430134033&h=25b6424be8fed94 bb816 753f5f3f9f66 #################################################
$:mpc play volume: 80% repeat: off random: off single: off consume: off ERROR: problems decoding "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p?s=1430119633&e=1430134033&h=25b6424be8fed94 bb"16 753f5f3f9f66
There is a missed number (a 8, after the quote marks).
Don't forget to use the code tags.
Last edited by Mercader1902 (2015-04-27 12:16:10)
Offline
Sorry i think that's just the way it was truncated on my terminal window when it was resized.... full output below;
~ $ echo `grep -i "$1.*, " /var/local/bbc_radio/urls | head -1 | cut -d',' -f2`
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p?s=1430119633&e=1430134033&h=25b6424be8fed94bb816753f5f3f9f66
~ $ mpc add `grep -i "$1.*, " /var/local/bbc_radio/urls | head -1 | cut -d',' -f2`
~ $ mpc play
volume: 80% repeat: off random: off single: off consume: off
"RROR: problems decoding "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p?s=1430119633&e=1430134033&h=25b6424be8fed94bb816753f5f3f9f66
Last edited by richymartin (2015-04-27 12:49:21)
Offline
It works for me, it's really weird...
~/Pruebas
$ mpc add `grep -i "$1.*, " /home/ruben/Pruebas/urls | head -1 | cut -d',' -f2` 16:00
~/Pruebas
$ mpc play 16:00
bbc_radio_one
[playing] #1/7 0:00/0:00 (0%)
volume: 0% repeat: off random: off single: off consume: off
Offline
That's so strange.... What's your MPD version?
Offline
Music Player Daemon 0.19.9 and mpc 0.26-1.
Offline
Are you both using the same shell? (Bash vs zsh)
What if you try using $(...) instead of `...`
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
I use zsh but with bash it works for me too:
~
$ bash 16:54
[ruben@filemon ~]$ mpc add `grep -i "$1.*, " /home/ruben/Pruebas/urls | head -1 | cut -d',' -f2`
[ruben@filemon ~]$ mpc play
bbc_radio_one
[playing] #1/10 0:00/0:00 (0%)
volume: 0% repeat: off random: off single: off consume: off
Offline
Are you both using the same shell? (Bash vs zsh)
What if you try using $(...) instead of `...`
I even just rebuilt arch and had the same problem.... however using $(..) instead of '...' works fine??!?! Which is brilliant, thank you... but why does that work? whats the difference?
Thank you both for your efforts...
Offline
oh it doesn't
[root@alarmpi ~]# mpc add $(grep -i "$1.*, " /var/local/bbc_radio/urls | head -1 | cut -d',' -f2)
[root@alarmpi ~]# mpc play 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p?s=1430161173&e=1430175573&h=3c65c41ba0303373e746b8d870c9668b
[playing] #1/1 0:00/0:00 (0%)
volume: 96% repeat: off random: off single: off consume: off
[root@alarmpi ~]# mpc status
volume: 96% repeat: off random: off single: off consume: off
ERROR: Failed to decode http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_ps=1430161173&e=1430175573&h=3c65c41ba0303373e746b8d870c9668b
[root@alarmpi ~]#
Offline