SciLor's Open Source Forums
http://forum.scilor.com/

Unix: Bash download script
http://forum.scilor.com/viewtopic.php?f=229&t=806
Page 1 of 1

Author:  urmeli [ Sat Jul 30, 2011 3:20 pm ]
Post subject:  Unix: Bash download script

hi all,

i coded a little download script which might help you batch-downloading several files at once. copy it into the directory where the jar-file resides and just run it by typing ./dl.sh (dont forget to chmod u+x) and then enter your search string.
as a result you get the song list. you can then for example type 1-6,9-13 to download the files 1 to 6 and 9 to 13. single numbers seperated by commas are also possible. hope it helps :)

Code:
#!/bin/sh
echo Search:
read string
java -jar SciLorsJGroovesharkDownloader.jar /c /l "$string"
echo "Download index (e.g. 1-5 or 2,3,5):"
read number

   IFS=","
   i=0
   array=($number)
   len=${#array[*]}
   echo $len
   unset IFS
   echo ${array[0]}
   echo ${array[1]}
   while [ $i -lt $len ]
   do   
      if `echo ${array[$i]} | grep "-" 1>/dev/null 2>&1`
      then
         IFS="-"
         interval=(${array[$i]})
         echo start
         start=${interval[0]}
         echo $start
         
         echo stop
         end=${interval[1]}
         echo $end
         while [ $start -le $end ]
         do
            echo $start
            java -jar SciLorsJGroovesharkDownloader.jar /c /d "$string" "$start"
                      start=`expr $start + 1`
         done
         unset IFS
   
      else
         java -jar SciLorsJGroovesharkDownloader.jar /c /d "$string" "${array[$i]}"
      fi
   i=$[$i+1]
   done


have fun, tobi

Author:  SciLor [ Sat Jul 30, 2011 3:26 pm ]
Post subject:  Re: bash download script

Thank you for posting your script here, it will be useful for all users :).

Could you translate the echos into english? Then I will make it sticky in the forum.

Author:  urmeli [ Sat Jul 30, 2011 3:40 pm ]
Post subject:  Re: bash download script

done.

Author:  groove098 [ Sun Oct 30, 2011 2:49 pm ]
Post subject:  Re: Unix: Bash download script

thx.

SciLorsJGrooveSharkDownloader.jar and
SciLorsJGroovesharkDownloader.jar are different files. Please fix this in the right name.

Author:  mastropiero90 [ Sat Aug 09, 2014 8:02 pm ]
Post subject:  Re: Unix: Bash download script

I'm running linux mint 17.
I can download a single song , but fails if I try to input an interval

Code:
26. De-Phazz - Rock & Roll Dude - Days of Twang
27. De-Phazz - Devil's Music (Reprise) - Days of Twang
Download index (e.g. 1-5 or 2,3,5):
1-5
./gdown: 10: ./gdown: Syntax error: "(" unexpected

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/