| index.md - sites - public wiki contents of suckless.org | |
| git clone git://git.suckless.org/sites | |
| Log | |
| Files | |
| Refs | |
| --- | |
| index.md (1031B) | |
| --- | |
| 1 smartdownloads | |
| 2 ============== | |
| 3 | |
| 4 Description | |
| 5 ----------- | |
| 6 | |
| 7 This script makes wget launch the app you want to launch (based on mailc… | |
| 8 There's almost certainly better ways of doing this, but this is an examp… | |
| 9 | |
| 10 #!/bin/sh | |
| 11 | |
| 12 function parse_download() { | |
| 13 | |
| 14 filename="" | |
| 15 filename=$(grep "Saving to:" /tmp/surf-dl.$$ |\ | |
| 16 cut -d '`' -f2 |\ | |
| 17 sed "s/'//") | |
| 18 echo "NEW FILENAME: $filename" | |
| 19 if [[ $filename == "" ]]; then | |
| 20 filename=$(grep "Server file no newer" /tmp/surf-dl.$$ |\ | |
| 21 cut -d '`' -f2 |\ | |
| 22 sed "s/'.*//") | |
| 23 fi | |
| 24 echo "ALREADY EXISTS FILENAME: $filename" | |
| 25 if [[ $filename != "" ]]; then | |
| 26 run-mailcap $filename | |
| 27 fi | |
| 28 rm -f /tmp/surf-dl.$$ | |
| 29 } | |
| 30 | |
| 31 wget -N --load-cookies ~/.surf/cookies.txt $1 \ | |
| 32 -o /tmp/surf-dl.$$ && parse_download | |
| 33 | |
| 34 Authors | |
| 35 ------- | |
| 36 | |
| 37 * Peter John Hartman (wart_) <http://durandus.trilidun.org/durandus/> | |
| 38 |