Skip to content

Commit

Permalink
fix(feeds): always upgrade size from RSS description (#1458)
Browse files Browse the repository at this point in the history
* fix(rss): add additional test for size

* always upgrade from desc
  • Loading branch information
KyleSanderson committed Mar 19, 2024
1 parent 93538d0 commit d86b233
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/feed/rss.go
Expand Up @@ -210,10 +210,8 @@ func (j *RSSJob) processItem(item *gofeed.Item) *domain.Release {
if item.Description != "" {
rls.Description = item.Description

if rls.Size == 0 {
readSizeFromDescription(item.Description, rls)
j.Log.Trace().Msgf("Set new size %d from description", rls.Size)
}
readSizeFromDescription(item.Description, rls)
j.Log.Trace().Msgf("Set new size %d from description", rls.Size)
}

// add cookie to release for download if needed
Expand Down
5 changes: 5 additions & 0 deletions internal/feed/rss_test.go
Expand Up @@ -269,6 +269,11 @@ func Test_readSizeFromDescription(t *testing.T) {
str: "<strong>Uploaded</strong>: 38B minutes ago<br>Size: 32GB",
want: "32GB",
},
{
name: "upgrade size",
str: `<p> <strong>Name</strong>: One.S01E01.German.DL.DTS.1080p.BluRay.x265.10bit-Cats<br> <strong>Category</strong>: Anime Serien<br> <strong>Type</strong>: Encode<br> <strong>Resolution</strong>: 1080p<br> <strong>Size</strong>: 2.49 GiB<br> <strong>Uploaded</strong>: vor 3 Minuten<br> <strong>Seeders</strong>: 1 | <strong>Leechers</strong>: 7 | <strong>Completed</strong>: 0<br> <strong>Uploader</strong>: Hochgeladen von xxx <br> IMDB Link:<a href="https://anon.to?http://www.imdb.com/title/tt1" target="_blank">tt1</a><br> TMDB Link: <a href="https://anon.to?https://www.themoviedb.org/tv/1" target="_blank">1</a><br> </p>`,
want: "2.49GiB",
},
}

for _, tt := range tests {
Expand Down

0 comments on commit d86b233

Please sign in to comment.