Modified Readme and .gitignore
This commit is contained in:
parent
f1191196d5
commit
8a323e67e2
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
*.log
|
*.log
|
||||||
*.txt
|
*.txt
|
||||||
anitoru
|
anitoru
|
||||||
|
server.yml
|
||||||
|
|||||||
19
README.rst
Normal file
19
README.rst
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
=======
|
||||||
|
AniToru
|
||||||
|
=======
|
||||||
|
AniToru is an automatic downloader for anime following the release group `Erai-raws <https://erai-raws.info>`__.
|
||||||
|
Its executable acts as both the client and the server. The server polls from RSS, or downloads the
|
||||||
|
searched items from Nyaa. An rTorrent server needs to be running. Notifications are sent to your phone
|
||||||
|
through `ntfy <https://ntfy.sh>`__ for when an anime has been downloaded.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
First, you need to build the executable. To do this, you must have `Go <https://go.dev>`__, and run `go build ./`.
|
||||||
|
Before you start, you need to edit the configuration file, which is `server.yml` You will need to rename `server.yml.template`,
|
||||||
|
which details the purpose of each item.
|
||||||
|
|
||||||
|
Afterwards, you can simply run the exectuable with `anitoru --daemon` for the server. To add subscriptions, you can
|
||||||
|
run `anitoru` and navigate the CLI.
|
||||||
|
|
||||||
|
To run it as a system service, for Debian based systems, a template service file is given. Typically the proper location for
|
||||||
|
services files is `/etc/systemd/system/`.
|
||||||
12
main.go
12
main.go
@ -37,6 +37,7 @@ var InvalidDotfile error = errors.New("Dotfile invalid.")
|
|||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
BaseDir string `config:"baseDir"`
|
BaseDir string `config:"baseDir"`
|
||||||
RTorrentHost string `config:"rTorrentHost"`
|
RTorrentHost string `config:"rTorrentHost"`
|
||||||
|
RSSURL string `config:rssURL`
|
||||||
PollingRate int `config:"pollingRate"`
|
PollingRate int `config:"pollingRate"`
|
||||||
DownloadDir string `config:"downloadDir"`
|
DownloadDir string `config:"downloadDir"`
|
||||||
LogPath string `config:"logPath"`
|
LogPath string `config:"logPath"`
|
||||||
@ -146,11 +147,11 @@ func GetReleaseSchedule() ([]string, error) {
|
|||||||
}).End()
|
}).End()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRSS() ([]Anime, error) {
|
func GetRSS(rssURL string) ([]Anime, error) {
|
||||||
var animes []Anime
|
var animes []Anime
|
||||||
|
|
||||||
fp := gofeed.NewParser()
|
fp := gofeed.NewParser()
|
||||||
feed, err := fp.ParseURL(RSSURL)
|
feed, err := fp.ParseURL(rssURL)
|
||||||
|
|
||||||
return animes, e.If(err).Then(func() {
|
return animes, e.If(err).Then(func() {
|
||||||
for _, item := range feed.Items {
|
for _, item := range feed.Items {
|
||||||
@ -243,6 +244,7 @@ type Daemon struct {
|
|||||||
Tor *rtorrent.RTorrent
|
Tor *rtorrent.RTorrent
|
||||||
PollingRate time.Duration
|
PollingRate time.Duration
|
||||||
DownloadDir string
|
DownloadDir string
|
||||||
|
RSSURL string
|
||||||
Listener chan net.Conn
|
Listener chan net.Conn
|
||||||
Subscriptions map[string]struct{}
|
Subscriptions map[string]struct{}
|
||||||
LogOptions []e.LogOption
|
LogOptions []e.LogOption
|
||||||
@ -250,7 +252,7 @@ type Daemon struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewDaemon(server string, polling int, download string, socket net.Listener,
|
func NewDaemon(server string, polling int, download string, socket net.Listener,
|
||||||
notifyError bool, subPath string) Daemon {
|
notifyError bool, subPath string, rssURL string) Daemon {
|
||||||
// Connect to rTorrent
|
// Connect to rTorrent
|
||||||
tor := rtorrent.New(server, false)
|
tor := rtorrent.New(server, false)
|
||||||
name, err := tor.Name()
|
name, err := tor.Name()
|
||||||
@ -287,6 +289,7 @@ func NewDaemon(server string, polling int, download string, socket net.Listener,
|
|||||||
Tor: tor,
|
Tor: tor,
|
||||||
PollingRate: time.Duration(polling),
|
PollingRate: time.Duration(polling),
|
||||||
DownloadDir: download,
|
DownloadDir: download,
|
||||||
|
RSSURL: rssURL,
|
||||||
Listener: listener,
|
Listener: listener,
|
||||||
Subscriptions: subMap,
|
Subscriptions: subMap,
|
||||||
LogOptions: opt,
|
LogOptions: opt,
|
||||||
@ -310,7 +313,7 @@ func (d *Daemon) Serve() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Daemon) CheckRSS() {
|
func (d *Daemon) CheckRSS() {
|
||||||
animes, err := GetRSS()
|
animes, err := GetRSS(d.RSSURL)
|
||||||
if e.LogIf(err, d.LogOptions...) {
|
if e.LogIf(err, d.LogOptions...) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -538,6 +541,7 @@ func main() {
|
|||||||
daemon := NewDaemon(
|
daemon := NewDaemon(
|
||||||
conf.RTorrentHost, conf.PollingRate, conf.DownloadDir, sock,
|
conf.RTorrentHost, conf.PollingRate, conf.DownloadDir, sock,
|
||||||
conf.NotifyError, filepath.Join(conf.BaseDir, SubscriptionsFile),
|
conf.NotifyError, filepath.Join(conf.BaseDir, SubscriptionsFile),
|
||||||
|
conf.RSSURL,
|
||||||
)
|
)
|
||||||
daemon.Serve()
|
daemon.Serve()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
baseDir: ./
|
baseDir: ./
|
||||||
|
rssURL: https://www.erai-raws.info/feed/?res=1080p&type=magnet&subs%5B0%5D=us&v0=no&d157edc6b50f28b2776442c03d067d56
|
||||||
rTorrentHost: http://localhost/rTorrent
|
rTorrentHost: http://localhost/rTorrent
|
||||||
pollingRate: 15
|
pollingRate: 15
|
||||||
downloadDir: /data/Videos/Anime/
|
downloadDir: /data/Videos/Anime/
|
||||||
|
|||||||
7
server.yml.template
Normal file
7
server.yml.template
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
baseDir: /path/to/executable # The directory that the executable is located in.
|
||||||
|
rssURL: http://my-rss.com # The RSS link given by Erai-raws.
|
||||||
|
rTorrentHost: http://localhost/rTorrent # The link to the rTorrent server
|
||||||
|
pollingRate: 15 # The number of minutes to poll the RSS feed.
|
||||||
|
downloadDir: /path/to/download # The base location of where the downloaded files should go.
|
||||||
|
logPath: anitoru.log # Path to write log file.
|
||||||
|
notifyError: true # Set to false to disable notifications.
|
||||||
Loading…
x
Reference in New Issue
Block a user