You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
714 B
34 lines
714 B
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
CONF_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/aria2/aria2.conf"
|
|
|
|
outdated() {
|
|
local current_time=$(date +%s)
|
|
local file_modtime=$(stat -c %Y "$1")
|
|
# 1day = 86400s
|
|
[[ $((current_time - file_modtime)) -gt 86400 ]]
|
|
}
|
|
|
|
if outdated "${CONF_FILE}"; then
|
|
mkdir -p "$(dirname "${CONF_FILE}")"
|
|
bt_trackers="$(curl -s https://cf.trackerslist.com/best_aria2.txt)"
|
|
cat <<CONF_EOF >"${CONF_FILE}"
|
|
dir=$HOME/Downloads/Aria2
|
|
continue=true
|
|
max-concurrent-downloads=8
|
|
split=16
|
|
min-split-size=16M
|
|
max-connection-per-server=4
|
|
|
|
# BT
|
|
seed-time=0
|
|
peer-id-prefix=-TR2940-
|
|
peer-agent=Transmission/2.94
|
|
user-agent=Transmission/2.94
|
|
bt-tracker=${bt_trackers}
|
|
CONF_EOF
|
|
fi
|
|
|
|
aria2c "$@"
|
|
|