golift.io/starr@v1.0.0/starrcmd/readarr.go (about)

     1  //nolint:lll
     2  package starrcmd
     3  
     4  /*
     5  All 10 Readarr events accounted for; 1/30/2022.
     6  https://github.com/Readarr/Readarr/blob/develop/src/NzbDrone.Core/Notifications/CustomScript/CustomScript.cs
     7  */
     8  
     9  import (
    10  	"time"
    11  )
    12  
    13  // ReadarrApplicationUpdate is the ApplicationUpdate event.
    14  type ReadarrApplicationUpdate struct {
    15  	PreviousVersion string `env:"readarr_update_previousversion"` // 4.0.3.5875
    16  	NewVersion      string `env:"readarr_update_newversion"`      // 4.0.4.5909
    17  	Message         string `env:"readarr_update_message"`         // Readarr updated from 4.0.3.5875 to 4.0.4.5909
    18  }
    19  
    20  // ReadarrHealthIssue is the HealthIssue event.
    21  type ReadarrHealthIssue struct {
    22  	Message   string `env:"readarr_health_issue_message"` // Lists unavailable due to failures: List name here
    23  	IssueType string `env:"readarr_health_issue_type"`    // ImportListStatusCheck
    24  	Wiki      string `env:"readarr_health_issue_wiki"`    // https://wiki.servarr.com/
    25  	Level     string `env:"readarr_health_issue_level"`   // Warning
    26  }
    27  
    28  // ReadarrGrab is the Grab event.
    29  type ReadarrGrab struct {
    30  	AuthorGRID     int64       `env:"readarr_author_grid"`                // 1077326
    31  	ReleaseGroup   string      `env:"readarr_release_releasegroup"`       // BitBook
    32  	AuthorName     string      `env:"readarr_author_name"`                // J.K. Rowling
    33  	ReleaseTitle   string      `env:"readarr_release_title"`              // J K Rowling - Harry Potter and the Order of the Phoenix 2012 Retail EPUB eBook-BitBook
    34  	GRIDs          string      `env:"readarr_release_grids"`              // 21175582 // not sure what this looks like with 2+
    35  	DownloadClient string      `env:"readarr_download_client"`            // qBittorrent
    36  	Size           int64       `env:"readarr_release_size"`               // 1279262
    37  	QualityVersion string      `env:"readarr_release_qualityversion"`     // 1
    38  	Titles         []string    `env:"readarr_release_booktitles,|"`       // Harry Potter and the Order of the Phoenix
    39  	IDs            []int64     `env:"readarr_release_bookids,|"`          // 649
    40  	ReleaseIndexer string      `env:"readarr_release_indexer"`            // InfoWars (Prowlarr)
    41  	DownloadID     string      `env:"readarr_download_id"`                // 3852BA2204A84185B2B43281E53BE93D56DE5C81
    42  	BookCount      int         `env:"readarr_release_bookcount"`          // 1
    43  	ReleaseDates   []time.Time `env:"readarr_release_bookreleasedates,,"` // 07/10/2003 07:00:00
    44  	Quality        string      `env:"readarr_release_quality"`            // EPUB
    45  	AuthorID       int64       `env:"readarr_author_id"`                  // 4
    46  }
    47  
    48  // ReadarrBookDelete is the BookDelete event.
    49  type ReadarrBookDelete struct {
    50  	AuthorName   string `env:"readarr_author_name"`        // Alyssa Cole
    51  	GrID         int64  `env:"readarr_book_goodreadsid"`   // 88514853
    52  	AuthorGrID   int64  `env:"readarr_author_goodreadsid"` // 7790155
    53  	Title        string `env:"readarr_book_title"`         // Unti Cole #6: A Novel
    54  	Path         string `env:"readarr_author_path"`        // /books/Alyssa Cole
    55  	ID           int64  `env:"readarr_book_id"`            // 636
    56  	DeletedFiles bool   `env:"readarr_book_deletedfiles"`  // True
    57  	AuthorID     string `env:"readarr_author_id"`          // 33
    58  }
    59  
    60  // ReadarrBookFileDelete is the BookFileDelete event.
    61  type ReadarrBookFileDelete struct {
    62  	Reason         string `env:"readarr_delete_reason"`                // deleteMessage.Reason.ToString())
    63  	AuthorID       int64  `env:"readarr_author_id"`                    // author.Id.ToString())
    64  	AuthorName     string `env:"readarr_author_name"`                  // author.Name)
    65  	AuthorGrID     int64  `env:"readarr_author_goodreadsid"`           // author.ForeignAuthorId)
    66  	ID             string `env:"readarr_book_id"`                      // book.Id.ToString())
    67  	Title          string `env:"readarr_book_title"`                   // book.Title)
    68  	GrID           int64  `env:"readarr_book_goodreadsid"`             // book.ForeignBookId)
    69  	FileID         int64  `env:"readarr_bookfile_id"`                  // bookFile.Id.ToString())
    70  	Path           string `env:"readarr_bookfile_path"`                // bookFile.Path)
    71  	Quality        string `env:"readarr_bookfile_quality"`             // bookFile.Quality.Quality.Name)
    72  	QualityVersion int64  `env:"readarr_bookfile_qualityversion"`      // bookFile.Quality.Revision.Version.ToString())
    73  	ReleaseGroup   string `env:"readarr_bookfile_releasegroup"`        // bookFile.ReleaseGroup ?? string.Empty)
    74  	SceneName      string `env:"readarr_bookfile_scenename"`           // bookFile.SceneName ?? string.Empty)
    75  	EditionID      int64  `env:"readarr_bookfile_edition_id"`          // edition.Id.ToString())
    76  	EditionName    string `env:"readarr_bookfile_edition_name"`        // edition.Title)
    77  	EditionGrID    int64  `env:"readarr_bookfile_edition_goodreadsid"` // edition.ForeignEditionId)
    78  	EditionISBN13  string `env:"readarr_bookfile_edition_isbn13"`      // edition.Isbn13)
    79  	EditionASIN    string `env:"readarr_bookfile_edition_asin"`        // edition.Asin)
    80  }
    81  
    82  // ReadarrAuthorDelete is the AuthorDelete event.
    83  type ReadarrAuthorDelete struct {
    84  	AuthorID     int64  `env:"readarr_author_id"`           // author.Id.ToString())
    85  	AuthorName   string `env:"readarr_author_name"`         // author.Name)
    86  	Path         string `env:"readarr_author_path"`         // author.Path)
    87  	AuthorGrID   int64  `env:"readarr_author_goodreadsid"`  // author.ForeignAuthorId)
    88  	DeletedFiles bool   `env:"readarr_author_deletedfiles"` // deleteMessage.DeletedFiles.ToString())
    89  }
    90  
    91  // ReadarrRename is the Rename event.
    92  type ReadarrRename struct {
    93  	AuthorID   int64  `env:"readarr_author_id"`   // author.Id.ToString())
    94  	AuthorName string `env:"readarr_author_name"` // author.Metadata.Value.Name)
    95  	Path       string `env:"readarr_author_path"` // author.Path)
    96  	AuthorGrID int64  `env:"readarr_author_grid"` // author.Metadata.Value.ForeignAuthorId)
    97  }
    98  
    99  // ReadarrDownload is Download event.
   100  type ReadarrDownload struct {
   101  	AuthorID       int64    `env:"readarr_author_id"`        // author.Id.ToString())
   102  	AuthorName     string   `env:"readarr_author_name"`      // author.Metadata.Value.Name)
   103  	Path           string   `env:"readarr_author_path"`      // author.Path)
   104  	AuthorGrID     int64    `env:"readarr_author_grid"`      // author.Metadata.Value.ForeignAuthorId)
   105  	ID             int64    `env:"readarr_book_id"`          // book.Id.ToString())
   106  	Title          string   `env:"readarr_book_title"`       // book.Title)
   107  	GrID           int64    `env:"readarr_book_grid"`        // book.Editions.Value.Single(e => e.Monitored).ForeignEditionId.ToString())
   108  	ReleaseDate    string   `env:"readarr_book_releasedate"` // book.ReleaseDate.ToString())
   109  	DownloadClient string   `env:"readarr_download_client"`  // message.DownloadClient ?? string.Empty)
   110  	DownloadID     string   `env:"readarr_download_id"`      // message.DownloadId ?? string.Empty)
   111  	AddedBookPaths []string `env:"readarr_addedbookpaths,|"` // string.Join("|", message.BookFiles.Select(e => e.Path)))
   112  	DeletedPaths   []string `env:"readarr_deletedpaths,|"`   // string.Join("|", message.OldFiles.Select(e => e.Path)))
   113  }
   114  
   115  // ReadarrTrackRetag is the TrackRetag event.
   116  type ReadarrTrackRetag struct {
   117  	AuthorID       int64     `env:"readarr_author_id"`               // author.Id.ToString())
   118  	AuthorName     string    `env:"readarr_author_name"`             // author.Metadata.Value.Name)
   119  	Path           string    `env:"readarr_author_path"`             // author.Path)
   120  	AuthorGrID     int64     `env:"readarr_author_grid"`             // author.Metadata.Value.ForeignAuthorId)
   121  	ID             int64     `env:"readarr_book_id"`                 // book.Id.ToString())
   122  	Title          string    `env:"readarr_book_title"`              // book.Title)
   123  	GrID           int64     `env:"readarr_book_grid"`               // book.Editions.Value.Single(e => e.Monitored).ForeignEditionId.ToString())
   124  	ReleaseDate    time.Time `env:"readarr_book_releasedate"`        // book.ReleaseDate.ToString())
   125  	FileID         int64     `env:"readarr_bookfile_id"`             // bookFile.Id.ToString())
   126  	FilePath       string    `env:"readarr_bookfile_path"`           // bookFile.Path)
   127  	Quality        string    `env:"readarr_bookfile_quality"`        // bookFile.Quality.Quality.Name)
   128  	QualityVersion int64     `env:"readarr_bookfile_qualityversion"` // bookFile.Quality.Revision.Version.ToString())
   129  	ReleaseGroup   string    `env:"readarr_bookfile_releasegroup"`   // bookFile.ReleaseGroup ?? string.Empty)
   130  	SceneName      string    `env:"readarr_bookfile_scenename"`      // bookFile.SceneName ?? string.Empty)
   131  	TagsDiff       string    `env:"readarr_tags_diff"`               // message.Diff.ToJson())
   132  	Scrubbed       bool      `env:"readarr_tags_scrubbed"`           // message.Scrubbed.ToString())
   133  }
   134  
   135  // ReadarrTest has no members.
   136  type ReadarrTest struct{}
   137  
   138  // GetReadarrApplicationUpdate returns the ApplicationUpdate event data.
   139  func (c *CmdEvent) GetReadarrApplicationUpdate() (output ReadarrApplicationUpdate, err error) {
   140  	return output, c.get(EventApplicationUpdate, &output)
   141  }
   142  
   143  // GetReadarrHealthIssue returns the ApplicationUpdate event data.
   144  func (c *CmdEvent) GetReadarrHealthIssue() (output ReadarrHealthIssue, err error) {
   145  	return output, c.get(EventHealthIssue, &output)
   146  }
   147  
   148  // GetReadarrGrab returns the Grab event data.
   149  func (c *CmdEvent) GetReadarrGrab() (output ReadarrGrab, err error) {
   150  	return output, c.get(EventGrab, &output)
   151  }
   152  
   153  // GetReadarrBookDelete returns the BookDelete event data.
   154  func (c *CmdEvent) GetReadarrBookDelete() (output ReadarrBookDelete, err error) {
   155  	return output, c.get(EventBookDelete, &output)
   156  }
   157  
   158  // GetReadarrAuthorDelete returns the AuthorDelete event data.
   159  func (c *CmdEvent) GetReadarrAuthorDelete() (output ReadarrAuthorDelete, err error) {
   160  	return output, c.get(EventAuthorDelete, &output)
   161  }
   162  
   163  // GetReadarrBookFileDelete returns the BookFileDelete event data.
   164  func (c *CmdEvent) GetReadarrBookFileDelete() (output ReadarrBookFileDelete, err error) {
   165  	return output, c.get(EventBookFileDelete, &output)
   166  }
   167  
   168  // GetReadarrDownload returns the Download event data.
   169  func (c *CmdEvent) GetReadarrDownload() (output ReadarrDownload, err error) {
   170  	return output, c.get(EventDownload, &output)
   171  }
   172  
   173  // GetReadarrRename returns the Rename event data.
   174  func (c *CmdEvent) GetReadarrRename() (output ReadarrRename, err error) {
   175  	return output, c.get(EventRename, &output)
   176  }
   177  
   178  // GetReadarrTrackRetag returns the TrackRetag event data.
   179  func (c *CmdEvent) GetReadarrTrackRetag() (output ReadarrTrackRetag, err error) {
   180  	return output, c.get(EventTrackRetag, &output)
   181  }
   182  
   183  // GetReadarrTest returns the ApplicationUpdate event data.
   184  func (c *CmdEvent) GetReadarrTest() (output ReadarrTest, err error) {
   185  	return output, c.get(EventTest, &output)
   186  }