Skip to content
resort-io edited this page Aug 7, 2024 · 16 revisions

Getting Started

To begin watching follow these steps:

  1. Pull the latest image and create a container with the /watcher and /downloads volumes.
  2. Create a subscriptions.json file in the /watcher container directory.
  3. Use the subscriptions.json generator to get a custom JSON string and paste it into subscriptions.json.
  4. (Optional) Create a webhooks.json file in the /watcher container directory.
  5. (Optional) Use the webhooks.json generator to get a custom JSON string and paste it into webhooks.json.
  6. Start the watcher.

Important Notes

  • Any JSON file that is missing from the /watcher container directory will be generated at startup.
  • The watcher will need to be restarted after making any changes to a JSON file.
  • If the generator links break, the scripts can be found in the /utils directory.

Triggering Download

When the watcher searches for new torrents, the subscriptions are checked sequentially, and only reads the latest torrents up until the last torrent of the previous search.

When the watchlist value is present, each torrent title is compared to every watchlist entry within a subscription and will download a torrent file if one of the following conditions are met:

  • When a tag value finds a match and there are no regex patterns.
  • When a regex pattern finds a match and there are no tag values.
  • When both a tag value and a regex pattern finds a match.

In any case, if a exclude_regex pattern finds a match, the torrent file will not be downloaded.

When the watchlist value is not present, every new torrent upload will be downloaded from a subscription.

See the subscriptions.json section in the setup documentation for more information on watchlist values.

Examples of subscriptions.json

  • Foo Subscription - Contains watchlist entry for One Piece. No webhook is used, so the name value is not necessary.
{
    "interval_sec": 600,
    "subscriptions": [
        {
            "username": "Foo",
            "rss": "https://nyaa.si/?page=rss&u=Foo",
            "watchlist": [
                {
                    "regex": [
                        "One Piece - (1[0-9][6-9][3-9]|1[0-9][7-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3})"
                    ]
                }
            ],
            "previous_hash": ""
        }
    ]
}

  • Foo Subscription - Contains watchlist entries for Demon Slayer and sends notifications via its FooBar webhook.
{
    "interval_sec": 600,
    "subscriptions": [
        {
            "username": "Foo",
            "rss": "https://nyaa.si/?page=rss&u=Foo",
            "watchlist": [
                {
                    "name": "Demon Slayer",
                    "tags": [
                        "Demon Slayer",
                        "Kimetsu no Yaiba"
                    ],
                    "regex": [
                        "S[0-9]{2}E[0-9]{2}"
                    ],
                    "webhooks": [
                        "FooBar"
                    ]
                }
            ],
            "previous_hash": ""
        }
    ]
}

  • Foo Subscription - Contains watchlist entries for Demon Slayer and One Piece. Both watchlists send notifications via their webhooks.
  • Bar Subscription - Contains watchlist entry for My Hero Academia. No webhook is used, so the name value is not necessary.
{
    "interval_sec": 600,
    "subscriptions": [
        {
            "username": "Foo",
            "rss": "https://nyaa.si/?page=rss&u=Foo",
            "watchlist": [
                {
                    "name": "Demon Slayer",
                    "tags": [
                        "Demon Slayer",
                        "Kimetsu no Yaiba"
                    ],
                    "regex": [
                        "S[0-9]{2}E[0-9]{2}"
                    ],
                    "webhooks": [
                        "Friends Server"
                    ]
                },
                {
                    "name": "One Piece",
                    "regex": [
                        "One Piece - (1[0-9][6-9][3-9]|1[0-9][7-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{3})"
                    ],
                    "exclude_regex": [
                        "x264"
                    ],
                    "webhooks": [
                        "Notification Server"
                    ]
                }
            ],
            "previous_hash": "23870945yufh2w837u49ifwh0834957ufh203847"
        },
        {
            "username": "Bar",
            "rss": "https://nyaa.si/?page=rss&u=Bar",
            "watchlist": [
                {
                    "tags": [
                        "My Hero Academia",
                        "Boku no Hero Academia"
                    ]
                }
            ],
            "previous_hash": ""
        }
    ]
}

  • Foo Subscription - Contains no watchlist with a webhooks value.
{
    "interval_sec": 600,
    "subscriptions": [
        {
            "username": "Foo",
            "rss": "https://nyaa.si/?page=rss&u=Foo",
            "webhooks": [
                "Notification Server"
            ],
            "previous_hash": ""
        }
    ]
}

  • Foo Subscription - Contains a watchlist-scoped and a subscription-scoped webhooks values. Each watchlist entry will notify each of their own webhooks values, as well as to each of the subscription webhooks values.
{
    "interval_sec": 600,
    "subscriptions": [
        {
            "username": "Foo",
            "rss": "https://nyaa.si/?page=rss&u=Foo",
            "watchlist": [
                {
                    "tags": [
                        "My Hero Academia"
                    ],
                    "webhooks": [
                        "Friends Server"
                    ]
                },
                {
                    "tags": [
                        "Jujutsu Kaisen"
                    ],
                    "webhooks": [
                        "Other Server"
                    ]
                }
            ],
            "webhooks": [
                "Notification Server"
            ],
            "previous_hash": ""
        }
    ]
}

Examples of webhooks.json

  • FooBar Webhook - Sends a notification with a custom title and custom description, and no other properties.
{
    "webhooks": [
        {
            "name": "FooBar",
            "url": "https://discord.com/api/webhooks/RANDOM_STRING/RANDOM_STRING",
            "notifications": {
                "title": "$uploader uploaded a new torrent!",
                "description": "Starting torrent download for $title.",
                "show_category": 0,
                "show_downloads": 0,
                "show_leechers": 0,
                "show_published": 0,
                "show_seeders": 0,
                "show_size": 0
            }
        }
    ]
}

  • Friends Server Webhook - Sends a notification with a custom title and custom description, plus the size and published date properties.
  • Notifications Server Webhook - Sends a notification with the default title and all six properties in a custom order.
{
    "webhooks": [
        {
            "name": "Friends Server",
            "url": "https://discord.com/api/webhooks/RANDOM_STRING/RANDOM_STRING",
            "notifications": {
                "title": "$uploader uploaded a new torrent!",
                "description": "Starting download for $title.",
                "show_category": 0,
                "show_downloads": 0,
                "show_leechers": 0,
                "show_published": 2,
                "show_seeders": 0,
                "show_size": 1
            }
        },
        {
            "name": "Notifications Server",
            "url": "https://discord.com/api/webhooks/RANDOM_STRING/RANDOM_STRING",
            "notifications": {
                "title": "",
                "description": "",
                "show_category": 3,
                "show_downloads": 4,
                "show_leechers": 6,
                "show_published": 1,
                "show_seeders": 5,
                "show_size": 2
            }
        }
    ]
}

  • Friends Server Webhook - Sends a notification with the default properties.
{
    "webhooks": [
        {
            "name": "Friends Server",
            "url": "https://discord.com/api/webhooks/RANDOM_STRING/RANDOM_STRING"
        }
    ]
}

  • Friends Server Webhook - Sends a notification with the default properties, but with removed properties.
{
    "webhooks": [
        {
            "name": "Friends Server",
            "url": "https://discord.com/api/webhooks/RANDOM_STRING/RANDOM_STRING",
            "notifications": {
                "show_category": 0,
                "show_leechers": 0
            }
        }
    ]
}
Clone this wiki locally