store

package
v0.0.0-...-6c05ddd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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.

func (*ContentHandler) Save

func (c *ContentHandler) Save()

Save the state to the store file

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

type Watch

type Watch struct {
	Query  string `json:"query"`
	Folder string `json:"folder"`
	User   string `json:"user"`
}

Watch represents a single query that is being watched and the folder the torrents should go in.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL