fetcher is our bot for fetching and uploading airing show.
Support is present for these types of downloaders:
- Torrent (via webtorrent, both
.torrent
and magnet links) - HTTP
Following fetchers are available:
- IRC
- RSS
The format of shows.json
is currently undocumented.
Following commands are available to anyone in IRC control channel:
!reload
- instantly reloadsshows.json
from remote!fetch
- instantly refreshes all sources and releasers
In addition, HTTP server is available on port specified in config. The interface should be protected by access control; fetcher does not implement any kind of security on it. The web interface can be used to view detailed information about database and to abort current downloads as well as to remove state information for specific episodes.
fetcher requires NodeJS v18.12 or later and Yarn package manager.
Additionally you need these external tools present in PATH
:
mktorrent
>= 1.1MediaInfo
CLI + Lib >= 18.03
yarn --frozen-lockfile && yarn build
node dist/index.js
Example systemd unit file:
[Unit]
Description=fetcher
After=network.target
[Service]
Environment="LOG_LEVEL=info"
WorkingDirectory=/opt/fetcher
ExecStart=/usr/bin/node dist/index.js
RestartSec=10s
Restart=always
User=fetcher
[Install]
WantedBy=default.target
Configuration is done via config.json
file with the following format:
{
"state_db": "state.ldb",
"storage_dir": "",
"torrent_dir": "",
"temporary_dir": "/tmp/fetcher",
"tracker_url": "",
"tracker_source": "",
"tracker_user": "",
"tracker_pass": "",
"shows_file": "shows.json",
"shows_uri": "",
"http_bind": "::",
"http_port": 3004,
"http_path": "",
"irc_networks": {},
"irc_control": {}
}
state_db
- directory where LevelDB database with all previously fetched shows and their state is savedstorage_dir
- directory where completed files will be moved totorrent_dir
- directory where new torrent files will be created bymktorrent
temporary_dir
- temporary data directory for in-progress downloadstracker_url
- tracker URL used when creating new torrentstracker_source
- content ofsource
flag to insert into torrent file when building usingmktorrent
tracker_user
- username used to log in to AnimeBytes, used for fetching shows and uploading new torrentstracker_pass
- password for user provided aboveshows_file
- location where cached JSON file with shows definition should be storedshows_uri
- URL from which bot will fetch new shows definition JSON regularly; in case it's inaccessible local cached copy will be usedhttp_bind
- IP address to bind to, use127.0.0.1
or::1
if you want to proxy web interface and protect it with passwordhttp_port
- HTTP port on which simple monitoring interface will be exposedhttp_path
- base path to use if server if not on top-level of domain, example:/bar
,/foo/bar
irc_networks
- array of IRC networks bot will connect tohost
- address of IRC server to connect toport
- port of the IRC serverssl
- whether to use SSL or not when connecting to IRC serververify_certificate
- whether to verify IRC server certificatenick
- nickname, realname and username to be used on IRC server;$
will be replaced by random characternickserv_password
- optional, if present the bot will attempt to authenticate withNickServ
upon joining
irc_control
- controls to which IRC network (fromirc_networks
) bot should announce its statenetwork
- valid network namechannel
- channel name
Additionally the bot expects LOG_LEVEL
environment variable to be set to one of:
trace
debug
(default if not provided)info
warn
error