What does this do in bash: [@]?
Bo Berglund
bo.berglund at gmail.com
Sun Jul 31 05:00:24 UTC 2022
On Sat, 30 Jul 2022 12:40:19 -0400, Jon LaBadie <ubu at labadie.us> wrote:
>On Sat, Jul 30, 2022 at 02:22:06PM +0200, Bo Berglund wrote:
>...
>>
>>I am looking at a download script where this construct exists:
>>
>>CURL=$(command -v curl) #Get full path to the curl command
>>
>>FFMPEG=$(command -v ffmpeg) #Get full path to the ffmpeg command
>>
>>URL=('https://tokens.xxxxx.com/' -d $'{\n "pid": "2007524",\n "application":
>>"Sports",\n "platform": "desktop",\n "cdn": "akamai",\n "url":
>>"https://xxxxxxx.akamaized.net/hls/live/723429/Sportsa418c506/clear/master.m3u8"\n}')
>>
>>INPUT=$("$CURL" -qsS "${URL[@]}" | jq -Mr '.akamai[] | .tokenizedUrl')
>>
>>I want to understand what is going on in here so I can modify it to get what I
>>want...
>>
>>The INPUT variable is later used in an ffmpeg call as "${INPUT[@]}" like this:
>>
>>CMD="ffmpeg -hide_banner -i \"${INPUT[@]}\" -vf scale=w=-4:h=480 -c:v libx264
>>-preset fast -crf 26 -c:a aac -t ${CAPTURETIME} ${TARGETFILE}"
>>
>>eval "$CMD"
>>
>>And this works with ffmpeg but I want to find a way to extract the m3u8 URL
>>itself so it can be used in strm files in KODI running on my Ubuntu machine for
>>direct live viewing too.
>>
>>I have added a printf statement in the script to send $INPUT to a file before it
>>uses it so I can look at it afterwards and it does not looking like any URL I
>>recognize or can use. But ffmpeg seems to be fine with it...
>>
>Perhaps:
>
> eval echo "$CMD"
>
>or
>
> eval printf "%s\n" "$CMD"
>
Why?
Execution of the command for download works just fine with eval "$CMD" ....
I added the printf to file just to be able to inspect the URL extracted by the
strange looking command shown and it turns out to be a very long line NOT ending
with .m3u8 and can thus not be used in my KODI media player in a strm file for
live viewing.
The problem is not how to execute commands but rather how to script getting a
working m3u8 URL like I can interactively do using Firefox F12 debug screen.
And my question here was about the use of "${URL[@]}" in:
INPUT=$("$CURL" -qsS "${URL[@]}" | jq -Mr '.akamai[] | .tokenizedUrl'
That command was given to me on a video forum and works for the download purpose
but not for the media player.
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list