You are not logged in.
hi guys
i have a problem which i´m sure can be solved with the power of bash scripting ![]()
unfortunately i´m no bash scripting guru and all my experiments failed so far ![]()
the problem:
i have a file in which are links(streaminglinks)
mplayer offers the funtion to dump such a stream with simply issuing
mplayer -dumpstream mms://path/to/video -dumpfile video1for example.
now i want mplayer to download this streams specified in the links-file automatically.
basically all it required is a bash script which goes through the link file and generates a command like mplay -dumpstream <link> -dumpfile video<n>
(where n is the nth link) and execute it.maybe there a even simpler solutions
well since i´m not that experienced with bashscripting i can´t solve that problem at my self....
i´m grateful for any help
Offline
you can do it this way:
#!/bin/bash
urls=(`cat $1`) # Loads contents of file (first arg of this script)
url_no=${#urls[@]} # Counts urls
for ((i=0; i<$url_no; ++i )) # a tipical for loop
do
mplayer -dumpstream ${urls[$i]} -dumpfile video${i}
doneOffline
You could also try it with awk
awk '
BEGIN { i=0 }
{ i++
system( "mplayer -dumpstream \"" $0 "\" -dumpfile video" i ) }' < file_with_urlsOffline
hey guys
thx for the two scripts.
my approach was nearly the same as your´s kraluz with the difference that it doesn´t work ![]()
but they both have a little blemish ![]()
they download the files sequentially not simultaneously ![]()
how could that be realised
thx in advance
Offline
You could run the mplayer command in the background.
in the for loop version: mplayer -dumpstream ${urls[$i]} -dumpfile video${i} &
in the awk version: system( "mplayer -dumpstream \"" $0 "\" -dumpfile video" i " &" )
Offline
wohoo thx, this works great ![]()
think i will have a further look at awk. looks interesting
thx you two
Offline