wan

Automatically downloads new episodes of specified shows from Nyaa.

Updated 2017/07/27

Script

#!/bin/sh

DIR=/where/to/download/shows
USER=transmission
PASS=transmission

if [ $# -eq 0 ]; then
    rssdler -o
    cd $DIR
    for i in */; do
        if [ -d "$i.torrents" ] && [ "$(ls "$i.torrents")" ]; then
            cd "$i".torrents
            for j in *.torrent; do
                transmission-remote -n $USER:$PASS -a "$j" -w "$DIR/$i" --trash-torrent
            done
            cd ../..
        fi
    done
else
    echo '
['$*']
link = https://nyaa.si/?page=rss&q=[HorribleSubs]+'$(echo $* | sed 's/ /+/g')'+[720p]+-batch&c=1_2&f=0
directory = '$DIR'/'$*'/.torrents' \
    >>$HOME/.rssdler/config.txt
    mkdir -p "$DIR/$*/.torrents"
fi

Usage

wan [SHOW]

wan depends on transmission-daemon, transmission-remote, and rssdler.

  1. Create an (almost) empty rssdler config: (skip this if you already have one — this will overwrite it)
  2. $ echo '[global]' > $HOME/.rssdler/config.txt
        
  3. Add shows:
  4. $ wan Gatchaman Crowds Insight
    $ wan Non Non Biyori Repeat
        
  5. Check for new episodes and start downloading them:
  6. $ wan
        
  7. wan will download 1080p HorribleSubs (you can change the resolution and subtitle group on line 22) episodes using the following directory structure:
  8. $DIR
    ├── Gatchaman Crowds Insight
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 01 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 02 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 03 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 04 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 05 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 06 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 07 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 08 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 09 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 10 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 11 [720p].mkv
    │   ├── [HorribleSubs] Gatchaman Crowds Insight - 12 [720p].mkv
    │   └── .torrents
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 01 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 02 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 03 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 04 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 05 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 06 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 07 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 08 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 09 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 10 [720p].mkv.torrent
    │       ├── [HorribleSubs] Gatchaman Crowds Insight - 11 [720p].mkv.torrent
    │       └── [HorribleSubs] Gatchaman Crowds Insight - 12 [720p].mkv.torrent
    └── Non Non Biyori Repeat
        ├── [HorribleSubs] Non Non Biyori Repeat - 01 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 02 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 03 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 04 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 05 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 06 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 07 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 08 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 09 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 10 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 11 [720p].mkv
        ├── [HorribleSubs] Non Non Biyori Repeat - 12 [720p].mkv
        └── .torrents
            ├── [HorribleSubs] Non Non Biyori Repeat - 01 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 02 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 03 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 04 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 05 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 06 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 07 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 08 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 09 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 10 [720p].mkv.torrent
            ├── [HorribleSubs] Non Non Biyori Repeat - 11 [720p].mkv.torrent
            └── [HorribleSubs] Non Non Biyori Repeat - 12 [720p].mkv.torrent
    
    
  9. (optional) Add a cronjob to run wan and download new episodes periodically:
  10. $ crontab -e
    
    # m h  dom mon dow   command
      0 *  *   *   *     wan
        

License

Distributed under the ISC license.

Disclaimer

Using wan is probably illegal where you live, so don't.