Documentation ¶
Index ¶
- type ContentHandler
- func (c *ContentHandler) AddNewWatch(watch string, folder string, user string)
- func (c *ContentHandler) GetNew() []TorrentOption
- func (c *ContentHandler) GetNewQuery(query string, folder string, user string) []TorrentOption
- func (c *ContentHandler) RemoveWatch(watch string)
- func (c *ContentHandler) ResetResolved()
- func (c *ContentHandler) Save()
- type MailAnnouncer
- type TorrentOption
- type Watch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentHandler ¶
type ContentHandler struct { Watching []Watch `json:"watching"` Resolved map[string]TorrentOption `json:"resolved"` Announcer MailAnnouncer `json:"mailannouncer"` // contains filtered or unexported fields }
ContentHandler decides which files are already retrieved and which shouldn't be at all.
func NewContentHandler ¶
func NewContentHandler(confDir string) *ContentHandler
NewContentHandler creates a new instance loaded with the configs in the specified folder.
func (*ContentHandler) AddNewWatch ¶
func (c *ContentHandler) AddNewWatch(watch string, folder string, user string)
AddNewWatch adds the new watch
func (*ContentHandler) GetNew ¶
func (c *ContentHandler) GetNew() []TorrentOption
GetNew gets all new required torrents and downloads them. Returns the newly-added torrents.
func (*ContentHandler) GetNewQuery ¶
func (c *ContentHandler) GetNewQuery(query string, folder string, user string) []TorrentOption
GetNewQuery adds a bunch of torrents without adding them to the watching Disregards resolved and doesn't add them there
func (*ContentHandler) RemoveWatch ¶
func (c *ContentHandler) RemoveWatch(watch string)
RemoveWatch removes a watch
func (*ContentHandler) ResetResolved ¶
func (c *ContentHandler) ResetResolved()
ResetResolved clears the resolved history.
type MailAnnouncer ¶
type MailAnnouncer struct {
TargetMails []string `json:"addresses"`
}
MailAnnouncer announces when something new has been added by sending emails to the specified addresses.
func NewMailAnnouncer ¶
func NewMailAnnouncer() *MailAnnouncer
NewMailAnnouncer creates a new MailAnnouncer with no emails
func (*MailAnnouncer) AddEmail ¶
func (m *MailAnnouncer) AddEmail(emailAddress string)
AddEmail adds an email to be notified when a notification pops
func (*MailAnnouncer) Announce ¶
func (m *MailAnnouncer) Announce(options []TorrentOption)
Announce sends an announcement about the given options.
func (*MailAnnouncer) RemoveEmail ¶
func (m *MailAnnouncer) RemoveEmail(emailAddress string)
RemoveEmail removes an email from the notification list
type TorrentOption ¶
type TorrentOption struct { Title string `xml:"title" json:"title"` Link string `xml:"link" json:"link"` Size string `xml:"size" json:"size"` }
TorrentOption Represents a torrent option to download
func GetAllOptionsWithQuery ¶
func GetAllOptionsWithQuery(searchString string, user string) ([]TorrentOption, error)
GetAllOptionsWithQuery returns all torrents in the RSS feed for HorribleSubs with the given query The function handles url character escape
func (TorrentOption) GetID ¶
func (t TorrentOption) GetID() string
GetID returns the id of the torrent -> https://nyaa.si/download/<id-here>.torrent