bash: add transmission-export-magnets.bash

This commit is contained in:
Aminda Suomalainen 2020-02-26 20:02:18 +02:00
parent 0caa59268c
commit 78777826c7
Signed by: Mikaela
GPG Key ID: 99392F62BAE30723
1 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Get the number of torrents, begins from 2 (1 is header line), the last
# line is SUM.
TORRENTS=$(transmission-remote -l|wc -l)
CURRENT=1
# until $CURRENT equals $TORRENTS ?
until [ $CURRENT -gt $TORRENTS ]
do
# get the information for $CURRENT? Grep the magnet line and cut out the
# frist field ("Magnet: ") using awk?
transmission-remote -l -t $CURRENT -i | grep -i magnet | awk -F': ' '{print $2}'
# increase $CURRENT
((CURRENT++))
done