summaryrefslogtreecommitdiffstats
path: root/download
blob: 88e83922dab85ff1d4c1e0da584fc873bdb4ff3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/zsh
histfile="$HOME/.download_history"
URL="[email protected]"
if [[ $URL == *.torrent ]]
then
    pidof -s rtorrent  &>/dev/null || ~/bin/tux tnum rtorrent
    [[ $1 =~ ^http.* ]] && /usr/bin/wget --content-disposition -q $1 > ~/.rtorrent/watch/${1##*/} && echo "$URL ============ $(aria2c --no-conf  -S ~/.rtorrent/watch/${1##*/})===========$(date)" >> $histfile && exit
    cp $URL ~/.rtorrent/watch/
    notify-send "Torrent" "Download started for $(aria2c --no-conf -S $URL | grep Name) "
    echo "$URL ============ $(aria2c --no-conf -S $URL | grep Name) ====================$(date)" >> $histfile
    mv "$URL" ~/.torrents/

else
        gid=$(aria2rpc addUri "$URL") 
        notify-send "Aria" "Download started for $gid"
        echo "$gid:$URL >===============< $(date)" >>| $histfile
fi
#vim set ts=4 sw=4 foldmethod=marker tw=80 noet: