#!/usr/bin/env bash
if   [   $DOWNLOADER == 'aria2-rpc' ];
then
    # sudo add-apt-repository ppa:t-tujikawa/ppa -y
    # sudo apt-get update
    sudo apt install aria2 -y
    mkdir $HOME/.aria2c
    cp ./others/aria2c.conf $HOME/.aria2c/aria2c.conf
    # echo 'rpc-secret=bgmi'>>$HOME/.aria2c/aria2c.conf
    aria2c --conf-path=$HOME/.aria2c/aria2c.conf -D
    bgmi config DOWNLOAD_DELEGATE aria2-rpc
else
    sudo apt install transmission-daemon -y
    pip install transmission_rpc
    sudo pip install transmission_rpc
    bgmi config DOWNLOAD_DELEGATE transmission-rpc
    cd `dirname $0`
    sudo service transmission-daemon stop
    sudo python ./disable_transmission_auth_require.py
    sudo service transmission-daemon start
fi
