mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-25 17:13:41 +01:00
Use parallel
This commit is contained in:
parent
2df6500045
commit
0139060bf2
16
qbth
16
qbth
@ -19,16 +19,24 @@ fi
|
|||||||
function add_torrents() {
|
function add_torrents() {
|
||||||
torrents=("$@")
|
torrents=("$@")
|
||||||
|
|
||||||
parallel qbt torrent add url ::: "${torrents[@]}"
|
if ! parallel qbt torrent add url ::: "${torrents[@]}"; then
|
||||||
|
gum log -l error "Error adding torrents"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
for url in "${torrents[@]}"; do gum log -l info "Added" "$(basename $url)"; done
|
for url in "${torrents[@]}"; do gum log -l info "Added" "$(basename $url)"; done
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete_torrents() {
|
function delete_torrents() {
|
||||||
if test -n "$1"; then
|
if test -n "$1"; then
|
||||||
echo "$1" | parallel "qbt torrent delete --with-files {}"
|
if ! "$(echo "$1" | parallel "qbt torrent delete --with-files {}")"; then
|
||||||
echo "$1" | xargs -I _ gum log -l info "Deleted" _
|
gum log -l error "Error deleting torrents"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
gum log -l info "Nothing to do."
|
echo "$1" | xargs -I _ gum log -l info "Deleted" _
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
gum log -l warn "Nothing to do."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user