mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(macros): add SizeString DownloadURL and InfoURL (#1080)
* feat(macro): add new variables * SizeString * DownloadURL * InfoURL * feat(macro): add new test cases
This commit is contained in:
parent
63660946eb
commit
1bfbe38335
17 changed files with 86 additions and 52 deletions
|
@ -129,7 +129,7 @@ func (s *service) delugeV1(ctx context.Context, client *domain.DownloadClient, a
|
||||||
|
|
||||||
torrentHash, err := del.AddTorrentMagnet(ctx, release.MagnetURI, &options)
|
torrentHash, err := del.AddTorrentMagnet(ctx, release.MagnetURI, &options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "could not add torrent magnet %s to client: %s", release.TorrentURL, client.Name)
|
return nil, errors.Wrap(err, "could not add torrent magnet %s to client: %s", release.MagnetURI, client.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if action.Label != "" {
|
if action.Label != "" {
|
||||||
|
@ -242,7 +242,7 @@ func (s *service) delugeV2(ctx context.Context, client *domain.DownloadClient, a
|
||||||
|
|
||||||
torrentHash, err := del.AddTorrentMagnet(ctx, release.MagnetURI, &options)
|
torrentHash, err := del.AddTorrentMagnet(ctx, release.MagnetURI, &options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "could not add torrent magnet %s to client: %s", release.TorrentURL, client.Name)
|
return nil, errors.Wrap(err, "could not add torrent magnet %s to client: %s", release.MagnetURI, client.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if action.Label != "" {
|
if action.Label != "" {
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (s *service) lidarr(ctx context.Context, action *domain.Action, release dom
|
||||||
|
|
||||||
r := lidarr.Release{
|
r := lidarr.Release{
|
||||||
Title: release.TorrentName,
|
Title: release.TorrentName,
|
||||||
DownloadUrl: release.TorrentURL,
|
DownloadUrl: release.DownloadURL,
|
||||||
MagnetUrl: release.MagnetURI,
|
MagnetUrl: release.MagnetURI,
|
||||||
Size: int64(release.Size),
|
Size: int64(release.Size),
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (s *service) radarr(ctx context.Context, action *domain.Action, release dom
|
||||||
|
|
||||||
r := radarr.Release{
|
r := radarr.Release{
|
||||||
Title: release.TorrentName,
|
Title: release.TorrentName,
|
||||||
DownloadUrl: release.TorrentURL,
|
DownloadUrl: release.DownloadURL,
|
||||||
MagnetUrl: release.MagnetURI,
|
MagnetUrl: release.MagnetURI,
|
||||||
Size: int64(release.Size),
|
Size: int64(release.Size),
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (s *service) readarr(ctx context.Context, action *domain.Action, release do
|
||||||
|
|
||||||
r := readarr.Release{
|
r := readarr.Release{
|
||||||
Title: release.TorrentName,
|
Title: release.TorrentName,
|
||||||
DownloadUrl: release.TorrentURL,
|
DownloadUrl: release.DownloadURL,
|
||||||
MagnetUrl: release.MagnetURI,
|
MagnetUrl: release.MagnetURI,
|
||||||
Size: int64(release.Size),
|
Size: int64(release.Size),
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
|
|
|
@ -42,7 +42,7 @@ func (s *service) sabnzbd(ctx context.Context, action *domain.Action, release do
|
||||||
|
|
||||||
sab := sabnzbd.New(opts)
|
sab := sabnzbd.New(opts)
|
||||||
|
|
||||||
ids, err := sab.AddFromUrl(ctx, sabnzbd.AddNzbRequest{Url: release.TorrentURL, Category: action.Category})
|
ids, err := sab.AddFromUrl(ctx, sabnzbd.AddNzbRequest{Url: release.DownloadURL, Category: action.Category})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "could not add nzb to sabnzbd")
|
return nil, errors.Wrap(err, "could not add nzb to sabnzbd")
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (s *service) sonarr(ctx context.Context, action *domain.Action, release dom
|
||||||
|
|
||||||
r := sonarr.Release{
|
r := sonarr.Release{
|
||||||
Title: release.TorrentName,
|
Title: release.TorrentName,
|
||||||
DownloadUrl: release.TorrentURL,
|
DownloadUrl: release.DownloadURL,
|
||||||
MagnetUrl: release.MagnetURI,
|
MagnetUrl: release.MagnetURI,
|
||||||
Size: int64(release.Size),
|
Size: int64(release.Size),
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
|
|
|
@ -46,7 +46,7 @@ func (s *service) whisparr(ctx context.Context, action *domain.Action, release d
|
||||||
|
|
||||||
r := whisparr.Release{
|
r := whisparr.Release{
|
||||||
Title: release.TorrentName,
|
Title: release.TorrentName,
|
||||||
DownloadUrl: release.TorrentURL,
|
DownloadUrl: release.DownloadURL,
|
||||||
MagnetUrl: release.MagnetURI,
|
MagnetUrl: release.MagnetURI,
|
||||||
Size: int64(release.Size),
|
Size: int64(release.Size),
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
|
|
|
@ -231,7 +231,7 @@ func (a *announceProcessor) onLinesMatched(def *domain.IndexerDefinition, vars m
|
||||||
}
|
}
|
||||||
|
|
||||||
if matched != nil {
|
if matched != nil {
|
||||||
rls.TorrentURL = matched.TorrentURL
|
rls.DownloadURL = matched.TorrentURL
|
||||||
|
|
||||||
if matched.InfoURL != "" {
|
if matched.InfoURL != "" {
|
||||||
rls.InfoURL = matched.InfoURL
|
rls.InfoURL = matched.InfoURL
|
||||||
|
|
|
@ -39,7 +39,7 @@ func (repo *ReleaseRepo) Store(ctx context.Context, r *domain.Release) error {
|
||||||
queryBuilder := repo.db.squirrel.
|
queryBuilder := repo.db.squirrel.
|
||||||
Insert("release").
|
Insert("release").
|
||||||
Columns("filter_status", "rejections", "indexer", "filter", "protocol", "implementation", "timestamp", "group_id", "torrent_id", "info_url", "download_url", "torrent_name", "size", "title", "category", "season", "episode", "year", "resolution", "source", "codec", "container", "hdr", "release_group", "proper", "repack", "website", "type", "origin", "tags", "uploader", "pre_time", "filter_id").
|
Columns("filter_status", "rejections", "indexer", "filter", "protocol", "implementation", "timestamp", "group_id", "torrent_id", "info_url", "download_url", "torrent_name", "size", "title", "category", "season", "episode", "year", "resolution", "source", "codec", "container", "hdr", "release_group", "proper", "repack", "website", "type", "origin", "tags", "uploader", "pre_time", "filter_id").
|
||||||
Values(r.FilterStatus, pq.Array(r.Rejections), r.Indexer, r.FilterName, r.Protocol, r.Implementation, r.Timestamp.Format(time.RFC3339), r.GroupID, r.TorrentID, r.InfoURL, r.TorrentURL, r.TorrentName, r.Size, r.Title, r.Category, r.Season, r.Episode, r.Year, r.Resolution, r.Source, codecStr, r.Container, hdrStr, r.Group, r.Proper, r.Repack, r.Website, r.Type, r.Origin, pq.Array(r.Tags), r.Uploader, r.PreTime, r.FilterID).
|
Values(r.FilterStatus, pq.Array(r.Rejections), r.Indexer, r.FilterName, r.Protocol, r.Implementation, r.Timestamp.Format(time.RFC3339), r.GroupID, r.TorrentID, r.InfoURL, r.DownloadURL, r.TorrentName, r.Size, r.Title, r.Category, r.Season, r.Episode, r.Year, r.Resolution, r.Source, codecStr, r.Container, hdrStr, r.Group, r.Proper, r.Repack, r.Website, r.Type, r.Origin, pq.Array(r.Tags), r.Uploader, r.PreTime, r.FilterID).
|
||||||
Suffix("RETURNING id").RunWith(repo.db.handler)
|
Suffix("RETURNING id").RunWith(repo.db.handler)
|
||||||
|
|
||||||
// return values
|
// return values
|
||||||
|
@ -284,7 +284,7 @@ func (repo *ReleaseRepo) findReleases(ctx context.Context, tx *Tx, params domain
|
||||||
rls.FilterName = rlsfilter.String
|
rls.FilterName = rlsfilter.String
|
||||||
rls.ActionStatus = make([]domain.ReleaseActionStatus, 0)
|
rls.ActionStatus = make([]domain.ReleaseActionStatus, 0)
|
||||||
rls.InfoURL = infoUrl.String
|
rls.InfoURL = infoUrl.String
|
||||||
rls.TorrentURL = downloadUrl.String
|
rls.DownloadURL = downloadUrl.String
|
||||||
|
|
||||||
// only add ActionStatus if it's not empty
|
// only add ActionStatus if it's not empty
|
||||||
if ras.ID > 0 {
|
if ras.ID > 0 {
|
||||||
|
@ -436,7 +436,7 @@ func (repo *ReleaseRepo) Get(ctx context.Context, req *domain.GetReleaseRequest)
|
||||||
rls.FilterID = int(filterId.Int64)
|
rls.FilterID = int(filterId.Int64)
|
||||||
rls.ActionStatus = make([]domain.ReleaseActionStatus, 0)
|
rls.ActionStatus = make([]domain.ReleaseActionStatus, 0)
|
||||||
rls.InfoURL = infoUrl.String
|
rls.InfoURL = infoUrl.String
|
||||||
rls.TorrentURL = downloadUrl.String
|
rls.DownloadURL = downloadUrl.String
|
||||||
rls.Category = category.String
|
rls.Category = category.String
|
||||||
rls.GroupID = groupId.String
|
rls.GroupID = groupId.String
|
||||||
rls.TorrentID = torrentId.String
|
rls.TorrentID = torrentId.String
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/autobrr/autobrr/pkg/errors"
|
"github.com/autobrr/autobrr/pkg/errors"
|
||||||
|
|
||||||
"github.com/Masterminds/sprig/v3"
|
"github.com/Masterminds/sprig/v3"
|
||||||
|
"github.com/dustin/go-humanize"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Macro struct {
|
type Macro struct {
|
||||||
|
@ -23,6 +24,8 @@ type Macro struct {
|
||||||
TorrentDataRawBytes []byte
|
TorrentDataRawBytes []byte
|
||||||
MagnetURI string
|
MagnetURI string
|
||||||
GroupID string
|
GroupID string
|
||||||
|
DownloadUrl string
|
||||||
|
InfoUrl string
|
||||||
Indexer string
|
Indexer string
|
||||||
Title string
|
Title string
|
||||||
Category string
|
Category string
|
||||||
|
@ -32,6 +35,7 @@ type Macro struct {
|
||||||
HDR string
|
HDR string
|
||||||
FilterName string
|
FilterName string
|
||||||
Size uint64
|
Size uint64
|
||||||
|
SizeString string
|
||||||
Season int
|
Season int
|
||||||
Episode int
|
Episode int
|
||||||
Year int
|
Year int
|
||||||
|
@ -48,13 +52,15 @@ func NewMacro(release Release) Macro {
|
||||||
|
|
||||||
ma := Macro{
|
ma := Macro{
|
||||||
TorrentName: release.TorrentName,
|
TorrentName: release.TorrentName,
|
||||||
TorrentUrl: release.TorrentURL,
|
TorrentUrl: release.DownloadURL,
|
||||||
TorrentPathName: release.TorrentTmpFile,
|
TorrentPathName: release.TorrentTmpFile,
|
||||||
TorrentDataRawBytes: release.TorrentDataRawBytes,
|
TorrentDataRawBytes: release.TorrentDataRawBytes,
|
||||||
TorrentHash: release.TorrentHash,
|
TorrentHash: release.TorrentHash,
|
||||||
TorrentID: release.TorrentID,
|
TorrentID: release.TorrentID,
|
||||||
MagnetURI: release.MagnetURI,
|
MagnetURI: release.MagnetURI,
|
||||||
GroupID: release.GroupID,
|
GroupID: release.GroupID,
|
||||||
|
InfoUrl: release.InfoURL,
|
||||||
|
DownloadUrl: release.DownloadURL,
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
Title: release.Title,
|
Title: release.Title,
|
||||||
Category: release.Category,
|
Category: release.Category,
|
||||||
|
@ -64,6 +70,7 @@ func NewMacro(release Release) Macro {
|
||||||
HDR: strings.Join(release.HDR, ", "),
|
HDR: strings.Join(release.HDR, ", "),
|
||||||
FilterName: release.FilterName,
|
FilterName: release.FilterName,
|
||||||
Size: release.Size,
|
Size: release.Size,
|
||||||
|
SizeString: humanize.Bytes(release.Size),
|
||||||
Season: release.Season,
|
Season: release.Season,
|
||||||
Episode: release.Episode,
|
Episode: release.Episode,
|
||||||
Year: release.Year,
|
Year: release.Year,
|
||||||
|
|
|
@ -89,7 +89,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_args_long",
|
name: "test_args_long",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
},
|
},
|
||||||
args: args{text: "{{.TorrentName}} {{.TorrentUrl}} SOME_LONG_TOKEN"},
|
args: args{text: "{{.TorrentName}} {{.TorrentUrl}} SOME_LONG_TOKEN"},
|
||||||
|
@ -100,7 +100,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_args_long_1",
|
name: "test_args_long_1",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
},
|
},
|
||||||
args: args{text: "{{.Indexer}} {{.TorrentName}} {{.TorrentUrl}} SOME_LONG_TOKEN"},
|
args: args{text: "{{.Indexer}} {{.TorrentName}} {{.TorrentUrl}} SOME_LONG_TOKEN"},
|
||||||
|
@ -111,7 +111,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_args_category",
|
name: "test_args_category",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
},
|
},
|
||||||
args: args{text: "{{.Indexer}}-race"},
|
args: args{text: "{{.Indexer}}-race"},
|
||||||
|
@ -122,7 +122,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_args_category_year",
|
name: "test_args_category_year",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
},
|
},
|
||||||
args: args{text: "{{.Indexer}}-{{.CurrentYear}}-race"},
|
args: args{text: "{{.Indexer}}-{{.CurrentYear}}-race"},
|
||||||
|
@ -133,7 +133,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_args_category_year",
|
name: "test_args_category_year",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
Resolution: "2160p",
|
Resolution: "2160p",
|
||||||
HDR: []string{"DV"},
|
HDR: []string{"DV"},
|
||||||
|
@ -146,7 +146,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_args_category_and_if",
|
name: "test_args_category_and_if",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
Resolution: "2160p",
|
Resolution: "2160p",
|
||||||
HDR: []string{"HDR"},
|
HDR: []string{"HDR"},
|
||||||
|
@ -159,7 +159,7 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
name: "test_release_year_1",
|
name: "test_release_year_1",
|
||||||
release: Release{
|
release: Release{
|
||||||
TorrentName: "This movie 2021",
|
TorrentName: "This movie 2021",
|
||||||
TorrentURL: "https://some.site/download/fakeid",
|
DownloadURL: "https://some.site/download/fakeid",
|
||||||
Indexer: "mock1",
|
Indexer: "mock1",
|
||||||
Resolution: "2160p",
|
Resolution: "2160p",
|
||||||
HDR: []string{"HDR"},
|
HDR: []string{"HDR"},
|
||||||
|
@ -178,6 +178,15 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
want: "3.57 GB",
|
want: "3.57 GB",
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test_size_string",
|
||||||
|
release: Release{
|
||||||
|
Size: 3834225472,
|
||||||
|
},
|
||||||
|
args: args{text: "Size: {{ .SizeString }}"},
|
||||||
|
want: "Size: 3.8 GB",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "test_text_manipulation",
|
name: "test_text_manipulation",
|
||||||
release: Release{
|
release: Release{
|
||||||
|
@ -187,6 +196,24 @@ func TestMacros_Parse(t *testing.T) {
|
||||||
want: "[Blu-ray][MKV][h264 10-bit][1080p][FLAC 2.0][Dual Audio][Softsubs (Sub Group)][Freeleech]",
|
want: "[Blu-ray][MKV][h264 10-bit][1080p][FLAC 2.0][Dual Audio][Softsubs (Sub Group)][Freeleech]",
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "test_info_url",
|
||||||
|
release: Release{
|
||||||
|
InfoURL: "https://test.local/this/page",
|
||||||
|
},
|
||||||
|
args: args{text: "InfoUrl: {{ .InfoUrl }}"},
|
||||||
|
want: "InfoUrl: https://test.local/this/page",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "test_download_url",
|
||||||
|
release: Release{
|
||||||
|
DownloadURL: "https://test.local/this/page/1001",
|
||||||
|
},
|
||||||
|
args: args{text: "DownloadUrl: {{ .DownloadUrl }}"},
|
||||||
|
want: "DownloadUrl: https://test.local/this/page/1001",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ type Release struct {
|
||||||
Implementation ReleaseImplementation `json:"implementation"` // irc, rss, api
|
Implementation ReleaseImplementation `json:"implementation"` // irc, rss, api
|
||||||
Timestamp time.Time `json:"timestamp"`
|
Timestamp time.Time `json:"timestamp"`
|
||||||
InfoURL string `json:"info_url"`
|
InfoURL string `json:"info_url"`
|
||||||
TorrentURL string `json:"download_url"`
|
DownloadURL string `json:"download_url"`
|
||||||
MagnetURI string `json:"-"`
|
MagnetURI string `json:"-"`
|
||||||
GroupID string `json:"group_id"`
|
GroupID string `json:"group_id"`
|
||||||
TorrentID string `json:"torrent_id"`
|
TorrentID string `json:"torrent_id"`
|
||||||
|
@ -374,7 +374,7 @@ func (r *Release) downloadTorrentFile(ctx context.Context) error {
|
||||||
return errors.New("could not download file: protocol %s is not supported", r.Protocol)
|
return errors.New("could not download file: protocol %s is not supported", r.Protocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.TorrentURL == "" {
|
if r.DownloadURL == "" {
|
||||||
return errors.New("download_file: url can't be empty")
|
return errors.New("download_file: url can't be empty")
|
||||||
} else if r.TorrentTmpFile != "" {
|
} else if r.TorrentTmpFile != "" {
|
||||||
// already downloaded
|
// already downloaded
|
||||||
|
@ -388,7 +388,7 @@ func (r *Release) downloadTorrentFile(ctx context.Context) error {
|
||||||
Timeout: time.Second * 45,
|
Timeout: time.Second * 45,
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, r.TorrentURL, nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodGet, r.DownloadURL, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "error downloading file")
|
return errors.Wrap(err, "error downloading file")
|
||||||
}
|
}
|
||||||
|
@ -428,22 +428,22 @@ func (r *Release) downloadTorrentFile(ctx context.Context) error {
|
||||||
// Continue processing the response
|
// Continue processing the response
|
||||||
//case http.StatusMovedPermanently, http.StatusFound, http.StatusSeeOther, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
//case http.StatusMovedPermanently, http.StatusFound, http.StatusSeeOther, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
||||||
// // Handle redirect
|
// // Handle redirect
|
||||||
// return retry.Unrecoverable(errors.New("redirect encountered for torrent (%v) file (%v) - status code: %d - check indexer keys for %s", r.TorrentName, r.TorrentURL, resp.StatusCode, r.Indexer))
|
// return retry.Unrecoverable(errors.New("redirect encountered for torrent (%s) file (%s) - status code: %d - check indexer keys for %s", r.TorrentName, r.DownloadURL, resp.StatusCode, r.Indexer))
|
||||||
|
|
||||||
case http.StatusUnauthorized, http.StatusForbidden:
|
case http.StatusUnauthorized, http.StatusForbidden:
|
||||||
return retry.Unrecoverable(errors.New("unrecoverable error downloading torrent (%v) file (%v) - status code: %d - check indexer keys for %s", r.TorrentName, r.TorrentURL, resp.StatusCode, r.Indexer))
|
return retry.Unrecoverable(errors.New("unrecoverable error downloading torrent (%s) file (%s) - status code: %d - check indexer keys for %s", r.TorrentName, r.DownloadURL, resp.StatusCode, r.Indexer))
|
||||||
|
|
||||||
case http.StatusMethodNotAllowed:
|
case http.StatusMethodNotAllowed:
|
||||||
return retry.Unrecoverable(errors.New("unrecoverable error downloading torrent (%v) file (%v) from '%v' - status code: %d. Check if the request method is correct", r.TorrentName, r.TorrentURL, r.Indexer, resp.StatusCode))
|
return retry.Unrecoverable(errors.New("unrecoverable error downloading torrent (%s) file (%s) from '%s' - status code: %d. Check if the request method is correct", r.TorrentName, r.DownloadURL, r.Indexer, resp.StatusCode))
|
||||||
|
|
||||||
case http.StatusNotFound:
|
case http.StatusNotFound:
|
||||||
return errors.New("torrent %s not found on %s (%d) - retrying", r.TorrentName, r.Indexer, resp.StatusCode)
|
return errors.New("torrent %s not found on %s (%d) - retrying", r.TorrentName, r.Indexer, resp.StatusCode)
|
||||||
|
|
||||||
case http.StatusBadGateway, http.StatusServiceUnavailable, http.StatusGatewayTimeout:
|
case http.StatusBadGateway, http.StatusServiceUnavailable, http.StatusGatewayTimeout:
|
||||||
return errors.New("server error (%d) encountered while downloading torrent (%v) file (%v) from '%v' - retrying", resp.StatusCode, r.TorrentName, r.TorrentURL, r.Indexer)
|
return errors.New("server error (%d) encountered while downloading torrent (%s) file (%s) from '%s' - retrying", resp.StatusCode, r.TorrentName, r.DownloadURL, r.Indexer)
|
||||||
|
|
||||||
case http.StatusInternalServerError:
|
case http.StatusInternalServerError:
|
||||||
return errors.New("server error (%d) encountered while downloading torrent (%v) file (%v) - check indexer keys for %s", resp.StatusCode, r.TorrentName, r.TorrentURL, r.Indexer)
|
return errors.New("server error (%d) encountered while downloading torrent (%s) file (%s) - check indexer keys for %s", resp.StatusCode, r.TorrentName, r.DownloadURL, r.Indexer)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return retry.Unrecoverable(errors.New("unexpected status code %d: check indexer keys for %s", resp.StatusCode, r.Indexer))
|
return retry.Unrecoverable(errors.New("unexpected status code %d: check indexer keys for %s", resp.StatusCode, r.Indexer))
|
||||||
|
@ -686,7 +686,7 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
||||||
if torrentSize, err := getStringMapValue(varMap, "torrentSize"); err == nil {
|
if torrentSize, err := getStringMapValue(varMap, "torrentSize"); err == nil {
|
||||||
// handling for indexer who doesn't explicitly set which size unit is used like (AR)
|
// handling for indexer who doesn't explicitly set which size unit is used like (AR)
|
||||||
if def.IRC != nil && def.IRC.Parse != nil && def.IRC.Parse.ForceSizeUnit != "" {
|
if def.IRC != nil && def.IRC.Parse != nil && def.IRC.Parse.ForceSizeUnit != "" {
|
||||||
torrentSize = fmt.Sprintf("%v %v", torrentSize, def.IRC.Parse.ForceSizeUnit)
|
torrentSize = fmt.Sprintf("%s %s", torrentSize, def.IRC.Parse.ForceSizeUnit)
|
||||||
}
|
}
|
||||||
|
|
||||||
size, err := humanize.ParseBytes(torrentSize)
|
size, err := humanize.ParseBytes(torrentSize)
|
||||||
|
|
|
@ -620,7 +620,7 @@ func TestRelease_ParseString(t *testing.T) {
|
||||||
Timestamp: tt.fields.Timestamp,
|
Timestamp: tt.fields.Timestamp,
|
||||||
GroupID: tt.fields.GroupID,
|
GroupID: tt.fields.GroupID,
|
||||||
TorrentID: tt.fields.TorrentID,
|
TorrentID: tt.fields.TorrentID,
|
||||||
TorrentURL: tt.fields.TorrentURL,
|
DownloadURL: tt.fields.DownloadURL,
|
||||||
TorrentTmpFile: tt.fields.TorrentTmpFile,
|
TorrentTmpFile: tt.fields.TorrentTmpFile,
|
||||||
TorrentHash: tt.fields.TorrentHash,
|
TorrentHash: tt.fields.TorrentHash,
|
||||||
TorrentName: tt.fields.TorrentName,
|
TorrentName: tt.fields.TorrentName,
|
||||||
|
@ -746,7 +746,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
Timestamp time.Time
|
Timestamp time.Time
|
||||||
GroupID string
|
GroupID string
|
||||||
TorrentID string
|
TorrentID string
|
||||||
TorrentURL string
|
DownloadURL string
|
||||||
TorrentTmpFile string
|
TorrentTmpFile string
|
||||||
TorrentDataRawBytes []byte
|
TorrentDataRawBytes []byte
|
||||||
TorrentHash string
|
TorrentHash string
|
||||||
|
@ -799,7 +799,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Indexer: "mock-indexer",
|
Indexer: "mock-indexer",
|
||||||
TorrentName: "Test.Release-GROUP",
|
TorrentName: "Test.Release-GROUP",
|
||||||
TorrentURL: fmt.Sprintf("%s/%d", ts.URL, 401),
|
DownloadURL: fmt.Sprintf("%s/%d", ts.URL, 401),
|
||||||
Protocol: ReleaseProtocolTorrent,
|
Protocol: ReleaseProtocolTorrent,
|
||||||
},
|
},
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
|
@ -809,7 +809,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Indexer: "mock-indexer",
|
Indexer: "mock-indexer",
|
||||||
TorrentName: "Test.Release-GROUP",
|
TorrentName: "Test.Release-GROUP",
|
||||||
TorrentURL: fmt.Sprintf("%s/%d", ts.URL, 403),
|
DownloadURL: fmt.Sprintf("%s/%d", ts.URL, 403),
|
||||||
Protocol: ReleaseProtocolTorrent,
|
Protocol: ReleaseProtocolTorrent,
|
||||||
},
|
},
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
|
@ -819,7 +819,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Indexer: "mock-indexer",
|
Indexer: "mock-indexer",
|
||||||
TorrentName: "Test.Release-GROUP",
|
TorrentName: "Test.Release-GROUP",
|
||||||
TorrentURL: fmt.Sprintf("%s/%d", ts.URL, 500),
|
DownloadURL: fmt.Sprintf("%s/%d", ts.URL, 500),
|
||||||
Protocol: ReleaseProtocolTorrent,
|
Protocol: ReleaseProtocolTorrent,
|
||||||
},
|
},
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
|
@ -829,7 +829,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Indexer: "mock-indexer",
|
Indexer: "mock-indexer",
|
||||||
TorrentName: "Test.Release-GROUP",
|
TorrentName: "Test.Release-GROUP",
|
||||||
TorrentURL: fmt.Sprintf("%s/%s", ts.URL, "file.torrent"),
|
DownloadURL: fmt.Sprintf("%s/%s", ts.URL, "file.torrent"),
|
||||||
Protocol: ReleaseProtocolTorrent,
|
Protocol: ReleaseProtocolTorrent,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
|
@ -839,7 +839,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Indexer: "mock-indexer",
|
Indexer: "mock-indexer",
|
||||||
TorrentName: "Test.Release-GROUP",
|
TorrentName: "Test.Release-GROUP",
|
||||||
TorrentURL: fmt.Sprintf("%s/files/%s", ts.URL, "valid_torrent_as_html"),
|
DownloadURL: fmt.Sprintf("%s/files/%s", ts.URL, "valid_torrent_as_html"),
|
||||||
Protocol: ReleaseProtocolTorrent,
|
Protocol: ReleaseProtocolTorrent,
|
||||||
},
|
},
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
|
@ -849,7 +849,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
fields: fields{
|
fields: fields{
|
||||||
Indexer: "mock-indexer",
|
Indexer: "mock-indexer",
|
||||||
TorrentName: "Test.Release-GROUP",
|
TorrentName: "Test.Release-GROUP",
|
||||||
TorrentURL: fmt.Sprintf("%s/files/%s", ts.URL, "invalid_torrent_as_html"),
|
DownloadURL: fmt.Sprintf("%s/files/%s", ts.URL, "invalid_torrent_as_html"),
|
||||||
Protocol: ReleaseProtocolTorrent,
|
Protocol: ReleaseProtocolTorrent,
|
||||||
},
|
},
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
|
@ -869,7 +869,7 @@ func TestRelease_DownloadTorrentFile(t *testing.T) {
|
||||||
Timestamp: tt.fields.Timestamp,
|
Timestamp: tt.fields.Timestamp,
|
||||||
GroupID: tt.fields.GroupID,
|
GroupID: tt.fields.GroupID,
|
||||||
TorrentID: tt.fields.TorrentID,
|
TorrentID: tt.fields.TorrentID,
|
||||||
TorrentURL: tt.fields.TorrentURL,
|
DownloadURL: tt.fields.DownloadURL,
|
||||||
TorrentTmpFile: tt.fields.TorrentTmpFile,
|
TorrentTmpFile: tt.fields.TorrentTmpFile,
|
||||||
TorrentDataRawBytes: tt.fields.TorrentDataRawBytes,
|
TorrentDataRawBytes: tt.fields.TorrentDataRawBytes,
|
||||||
TorrentHash: tt.fields.TorrentHash,
|
TorrentHash: tt.fields.TorrentHash,
|
||||||
|
|
|
@ -102,7 +102,7 @@ func (j *NewznabJob) process(ctx context.Context) error {
|
||||||
|
|
||||||
if item.Enclosure != nil {
|
if item.Enclosure != nil {
|
||||||
if item.Enclosure.Type == "application/x-nzb" {
|
if item.Enclosure.Type == "application/x-nzb" {
|
||||||
rls.TorrentURL = item.Enclosure.Url
|
rls.DownloadURL = item.Enclosure.Url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,33 +112,33 @@ func (j *RSSJob) processItem(item *gofeed.Item) *domain.Release {
|
||||||
|
|
||||||
if j.Feed.Settings != nil && j.Feed.Settings.DownloadType == domain.FeedDownloadTypeMagnet {
|
if j.Feed.Settings != nil && j.Feed.Settings.DownloadType == domain.FeedDownloadTypeMagnet {
|
||||||
rls.MagnetURI = item.Link
|
rls.MagnetURI = item.Link
|
||||||
rls.TorrentURL = ""
|
rls.DownloadURL = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(item.Enclosures) > 0 {
|
if len(item.Enclosures) > 0 {
|
||||||
e := item.Enclosures[0]
|
e := item.Enclosures[0]
|
||||||
if e.Type == "application/x-bittorrent" && e.URL != "" {
|
if e.Type == "application/x-bittorrent" && e.URL != "" {
|
||||||
rls.TorrentURL = e.URL
|
rls.DownloadURL = e.URL
|
||||||
}
|
}
|
||||||
if e.Length != "" && e.Length != "39399" {
|
if e.Length != "" && e.Length != "39399" {
|
||||||
rls.ParseSizeBytesString(e.Length)
|
rls.ParseSizeBytesString(e.Length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if rls.TorrentURL == "" && item.Link != "" {
|
if rls.DownloadURL == "" && item.Link != "" {
|
||||||
rls.TorrentURL = item.Link
|
rls.DownloadURL = item.Link
|
||||||
}
|
}
|
||||||
|
|
||||||
if rls.TorrentURL != "" {
|
if rls.DownloadURL != "" {
|
||||||
// handle no baseurl with only relative url
|
// handle no baseurl with only relative url
|
||||||
// grab url from feed url and create full url
|
// grab url from feed url and create full url
|
||||||
if parsedURL, _ := url.Parse(rls.TorrentURL); parsedURL != nil && len(parsedURL.Hostname()) == 0 {
|
if parsedURL, _ := url.Parse(rls.DownloadURL); parsedURL != nil && len(parsedURL.Hostname()) == 0 {
|
||||||
if parentURL, _ := url.Parse(j.URL); parentURL != nil {
|
if parentURL, _ := url.Parse(j.URL); parentURL != nil {
|
||||||
parentURL.Path, parentURL.RawPath = "", ""
|
parentURL.Path, parentURL.RawPath = "", ""
|
||||||
|
|
||||||
// unescape the query params for max compatibility
|
// unescape the query params for max compatibility
|
||||||
escapedUrl, _ := url.QueryUnescape(parentURL.JoinPath(rls.TorrentURL).String())
|
escapedUrl, _ := url.QueryUnescape(parentURL.JoinPath(rls.DownloadURL).String())
|
||||||
rls.TorrentURL = escapedUrl
|
rls.DownloadURL = escapedUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ func TestRSSJob_processItem(t *testing.T) {
|
||||||
Link: "/details.php?id=00000&hit=1",
|
Link: "/details.php?id=00000&hit=1",
|
||||||
GUID: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP",
|
GUID: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP",
|
||||||
}},
|
}},
|
||||||
want: &domain.Release{ID: 0, FilterStatus: "PENDING", Rejections: []string{}, Indexer: "mock-feed", FilterName: "", Protocol: "torrent", Implementation: "RSS", Timestamp: now, GroupID: "", TorrentID: "", TorrentURL: "https://fake-feed.com/details.php?id=00000&hit=1", TorrentTmpFile: "", TorrentDataRawBytes: []uint8(nil), TorrentHash: "", TorrentName: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP", Size: 0x0, Title: "Some Release Title", Description: "Category: Example\n Size: 1.49 GB\n Status: 27 seeders and 1 leechers\n Speed: 772.16 kB/s\n Added: 2022-09-29 16:06:08\n", Category: "", Season: 0, Episode: 0, Year: 2022, Resolution: "720p", Source: "WEB", Codec: []string{"H.264"}, Container: "", HDR: []string(nil), Audio: []string(nil), AudioChannels: "", Group: "GROUP", Region: "", Language: nil, Proper: false, Repack: false, Website: "", Artists: "", Type: "", LogScore: 0, Origin: "", Tags: []string{}, ReleaseTags: "", Freeleech: false, FreeleechPercent: 0, Bonus: []string(nil), Uploader: "", PreTime: "", Other: []string(nil), RawCookie: "", AdditionalSizeCheckRequired: false, FilterID: 0, Filter: (*domain.Filter)(nil), ActionStatus: []domain.ReleaseActionStatus(nil)},
|
want: &domain.Release{ID: 0, FilterStatus: "PENDING", Rejections: []string{}, Indexer: "mock-feed", FilterName: "", Protocol: "torrent", Implementation: "RSS", Timestamp: now, GroupID: "", TorrentID: "", DownloadURL: "https://fake-feed.com/details.php?id=00000&hit=1", TorrentTmpFile: "", TorrentDataRawBytes: []uint8(nil), TorrentHash: "", TorrentName: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP", Size: 0x0, Title: "Some Release Title", Description: "Category: Example\n Size: 1.49 GB\n Status: 27 seeders and 1 leechers\n Speed: 772.16 kB/s\n Added: 2022-09-29 16:06:08\n", Category: "", Season: 0, Episode: 0, Year: 2022, Resolution: "720p", Source: "WEB", Codec: []string{"H.264"}, Container: "", HDR: []string(nil), Audio: []string(nil), AudioChannels: "", Group: "GROUP", Region: "", Language: nil, Proper: false, Repack: false, Website: "", Artists: "", Type: "", LogScore: 0, Origin: "", Tags: []string{}, ReleaseTags: "", Freeleech: false, FreeleechPercent: 0, Bonus: []string(nil), Uploader: "", PreTime: "", Other: []string(nil), RawCookie: "", AdditionalSizeCheckRequired: false, FilterID: 0, Filter: (*domain.Filter)(nil), ActionStatus: []domain.ReleaseActionStatus(nil)},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "with_baseurl",
|
name: "with_baseurl",
|
||||||
|
@ -96,7 +96,7 @@ func TestRSSJob_processItem(t *testing.T) {
|
||||||
Link: "https://fake-feed.com/details.php?id=00000&hit=1",
|
Link: "https://fake-feed.com/details.php?id=00000&hit=1",
|
||||||
GUID: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP",
|
GUID: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP",
|
||||||
}},
|
}},
|
||||||
want: &domain.Release{ID: 0, FilterStatus: "PENDING", Rejections: []string{}, Indexer: "mock-feed", FilterName: "", Protocol: "torrent", Implementation: "RSS", Timestamp: now, GroupID: "", TorrentID: "", TorrentURL: "https://fake-feed.com/details.php?id=00000&hit=1", TorrentTmpFile: "", TorrentDataRawBytes: []uint8(nil), TorrentHash: "", TorrentName: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP", Size: 0x0, Title: "Some Release Title", Description: "Category: Example\n Size: 1.49 GB\n Status: 27 seeders and 1 leechers\n Speed: 772.16 kB/s\n Added: 2022-09-29 16:06:08\n", Category: "", Season: 0, Episode: 0, Year: 2022, Resolution: "720p", Source: "WEB", Codec: []string{"H.264"}, Container: "", HDR: []string(nil), Audio: []string(nil), AudioChannels: "", Group: "GROUP", Region: "", Language: nil, Proper: false, Repack: false, Website: "", Artists: "", Type: "", LogScore: 0, Origin: "", Tags: []string{}, ReleaseTags: "", Freeleech: false, FreeleechPercent: 0, Bonus: []string(nil), Uploader: "", PreTime: "", Other: []string(nil), RawCookie: "", AdditionalSizeCheckRequired: false, FilterID: 0, Filter: (*domain.Filter)(nil), ActionStatus: []domain.ReleaseActionStatus(nil)},
|
want: &domain.Release{ID: 0, FilterStatus: "PENDING", Rejections: []string{}, Indexer: "mock-feed", FilterName: "", Protocol: "torrent", Implementation: "RSS", Timestamp: now, GroupID: "", TorrentID: "", DownloadURL: "https://fake-feed.com/details.php?id=00000&hit=1", TorrentTmpFile: "", TorrentDataRawBytes: []uint8(nil), TorrentHash: "", TorrentName: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP", Size: 0x0, Title: "Some Release Title", Description: "Category: Example\n Size: 1.49 GB\n Status: 27 seeders and 1 leechers\n Speed: 772.16 kB/s\n Added: 2022-09-29 16:06:08\n", Category: "", Season: 0, Episode: 0, Year: 2022, Resolution: "720p", Source: "WEB", Codec: []string{"H.264"}, Container: "", HDR: []string(nil), Audio: []string(nil), AudioChannels: "", Group: "GROUP", Region: "", Language: nil, Proper: false, Repack: false, Website: "", Artists: "", Type: "", LogScore: 0, Origin: "", Tags: []string{}, ReleaseTags: "", Freeleech: false, FreeleechPercent: 0, Bonus: []string(nil), Uploader: "", PreTime: "", Other: []string(nil), RawCookie: "", AdditionalSizeCheckRequired: false, FilterID: 0, Filter: (*domain.Filter)(nil), ActionStatus: []domain.ReleaseActionStatus(nil)},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "time_parse",
|
name: "time_parse",
|
||||||
|
@ -126,7 +126,7 @@ func TestRSSJob_processItem(t *testing.T) {
|
||||||
GUID: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP",
|
GUID: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP",
|
||||||
//PublishedParsed: &nowMinusTime,
|
//PublishedParsed: &nowMinusTime,
|
||||||
}},
|
}},
|
||||||
want: &domain.Release{ID: 0, FilterStatus: "PENDING", Rejections: []string{}, Indexer: "mock-feed", FilterName: "", Protocol: "torrent", Implementation: "RSS", Timestamp: now, GroupID: "", TorrentID: "", TorrentURL: "https://fake-feed.com/details.php?id=00000&hit=1", TorrentTmpFile: "", TorrentDataRawBytes: []uint8(nil), TorrentHash: "", TorrentName: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP", Size: 0x0, Title: "Some Release Title", Description: "Category: Example\n Size: 1.49 GB\n Status: 27 seeders and 1 leechers\n Speed: 772.16 kB/s\n Added: 2022-09-29 16:06:08\n", Category: "", Season: 0, Episode: 0, Year: 2022, Resolution: "720p", Source: "WEB", Codec: []string{"H.264"}, Container: "", HDR: []string(nil), Audio: []string(nil), AudioChannels: "", Group: "GROUP", Region: "", Language: nil, Proper: false, Repack: false, Website: "", Artists: "", Type: "", LogScore: 0, Origin: "", Tags: []string{}, ReleaseTags: "", Freeleech: false, FreeleechPercent: 0, Bonus: []string(nil), Uploader: "", PreTime: "", Other: []string(nil), RawCookie: "", AdditionalSizeCheckRequired: false, FilterID: 0, Filter: (*domain.Filter)(nil), ActionStatus: []domain.ReleaseActionStatus(nil)},
|
want: &domain.Release{ID: 0, FilterStatus: "PENDING", Rejections: []string{}, Indexer: "mock-feed", FilterName: "", Protocol: "torrent", Implementation: "RSS", Timestamp: now, GroupID: "", TorrentID: "", DownloadURL: "https://fake-feed.com/details.php?id=00000&hit=1", TorrentTmpFile: "", TorrentDataRawBytes: []uint8(nil), TorrentHash: "", TorrentName: "Some.Release.Title.2022.09.22.720p.WEB.h264-GROUP", Size: 0x0, Title: "Some Release Title", Description: "Category: Example\n Size: 1.49 GB\n Status: 27 seeders and 1 leechers\n Speed: 772.16 kB/s\n Added: 2022-09-29 16:06:08\n", Category: "", Season: 0, Episode: 0, Year: 2022, Resolution: "720p", Source: "WEB", Codec: []string{"H.264"}, Container: "", HDR: []string(nil), Audio: []string(nil), AudioChannels: "", Group: "GROUP", Region: "", Language: nil, Proper: false, Repack: false, Website: "", Artists: "", Type: "", LogScore: 0, Origin: "", Tags: []string{}, ReleaseTags: "", Freeleech: false, FreeleechPercent: 0, Bonus: []string(nil), Uploader: "", PreTime: "", Other: []string(nil), RawCookie: "", AdditionalSizeCheckRequired: false, FilterID: 0, Filter: (*domain.Filter)(nil), ActionStatus: []domain.ReleaseActionStatus(nil)},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "time_parse",
|
name: "time_parse",
|
||||||
|
|
|
@ -92,7 +92,7 @@ func (j *TorznabJob) process(ctx context.Context) error {
|
||||||
rls := domain.NewRelease(j.IndexerIdentifier)
|
rls := domain.NewRelease(j.IndexerIdentifier)
|
||||||
|
|
||||||
rls.TorrentName = item.Title
|
rls.TorrentName = item.Title
|
||||||
rls.TorrentURL = item.Link
|
rls.DownloadURL = item.Link
|
||||||
rls.Implementation = domain.ReleaseImplementationTorznab
|
rls.Implementation = domain.ReleaseImplementationTorznab
|
||||||
|
|
||||||
// parse size bytes string
|
// parse size bytes string
|
||||||
|
@ -102,7 +102,7 @@ func (j *TorznabJob) process(ctx context.Context) error {
|
||||||
|
|
||||||
if j.Feed.Settings != nil && j.Feed.Settings.DownloadType == domain.FeedDownloadTypeMagnet {
|
if j.Feed.Settings != nil && j.Feed.Settings.DownloadType == domain.FeedDownloadTypeMagnet {
|
||||||
rls.MagnetURI = item.Link
|
rls.MagnetURI = item.Link
|
||||||
rls.TorrentURL = ""
|
rls.DownloadURL = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get freeleech percentage between 0 - 100. The value is ignored if
|
// Get freeleech percentage between 0 - 100. The value is ignored if
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue