Advertisement
Guest User

Stephen Henderson

a guest
May 3rd, 2009
1,043
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. FILEPART=1
  4. FILENAME="output"
  5.  
  6. # Construct filename to output to
  7. if [ "$1" ]
  8. then
  9.   FILENAME="$1"
  10. fi
  11.  
  12. # Iterate the part number
  13. if [ "$2" ]
  14. then
  15.   FILEPART=$2
  16. fi
  17.  
  18. # Use cURL to capture the stream
  19. curl http://bglive-a.bitgravity.com/twit/live/high --ignore-content-length -o $FILENAME.$FILEPART.flv
  20.  
  21. # Re-connect if the connection is lost
  22. # If statement checks for return values of cURL which indicate that the stream
  23. # could not be connected to and no data besides the http headers were received.
  24. if [ $? -eq 1 -o $? -eq 2 -o $? -eq 5 -o $? -eq 6 -o $? -eq 52 ]
  25. then
  26.   sh $O $FILENAME $FILEPART
  27. else
  28.   sh $0 $FILENAME $(($FILEPART+1))
  29. fi
  30.  
  31. exit   
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement