feat(releases): support magnet links (#730)

* feat(releases): support magnet links

* feat(feeds): support magnet links

* feat(actions): log messages

* fix: component warning

* fix: check hasprefix instead of hassuffix for magnet

* feat(release): resolve magnet uri from link

* fix(actions): deluge use magnet uri

* fix(macros): add `MagnetURI` var

* fix(actions): run magnet resolving before macros

* feat(feeds): set download type on creation
This commit is contained in:
ze0s 2023-02-28 22:16:10 +01:00 committed by GitHub
parent c6101cc765
commit ca196f0bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 770 additions and 260 deletions

View file

@ -108,6 +108,11 @@ func (j *RSSJob) processItem(item *gofeed.Item) *domain.Release {
rls.ParseString(item.Title)
if j.Feed.Settings != nil && j.Feed.Settings.DownloadType == domain.FeedDownloadTypeMagnet {
rls.MagnetURI = item.Link
rls.TorrentURL = ""
}
if len(item.Enclosures) > 0 {
e := item.Enclosures[0]
if e.Type == "application/x-bittorrent" && e.URL != "" {

View file

@ -275,7 +275,7 @@ func (s *service) start() error {
for _, feed := range feeds {
feed := feed
if err := s.startJob(&feed); err != nil {
s.log.Error().Err(err).Msg("failed to initialize torznab job")
s.log.Error().Err(err).Msgf("failed to initialize feed job: %s", feed.Name)
continue
}
}

View file

@ -89,6 +89,11 @@ func (j *TorznabJob) process(ctx context.Context) error {
rls.ParseString(item.Title)
if j.Feed.Settings != nil && j.Feed.Settings.DownloadType == domain.FeedDownloadTypeMagnet {
rls.MagnetURI = item.Link
rls.TorrentURL = ""
}
// Get freeleech percentage between 0 - 100. The value is ignored if
// an error occurrs
freeleechPercentage, err := parseFreeleechTorznab(item)