Skip to content

Commit ebc8a7e

Browse files
authored
Merge pull request #51 from sgerner/codex/prowlarr-audiobook-source-label
separate Prowlarr audiobook results from ABB
2 parents 8c46893 + 02f7cc2 commit ebc8a7e

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

internal/search/prowlarr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (p *Prowlarr) doSearch(ctx context.Context, params prowlarrSearchParams) ([
167167
for _, item := range items {
168168
source := "torrent"
169169
if p.tab == "audiobook" {
170-
source = "audiobook"
170+
source = "prowlarr_audiobooks"
171171
} else if p.tab == "manga" {
172172
source = "prowlarr_manga"
173173
}

internal/search/prowlarr_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ func TestProwlarr_SearchAudiobook(t *testing.T) {
149149
}
150150

151151
for _, r := range results {
152-
if r.Source != "audiobook" {
153-
t.Errorf("expected source audiobook, got %s", r.Source)
152+
if r.Source != "prowlarr_audiobooks" {
153+
t.Errorf("expected source prowlarr_audiobooks, got %s", r.Source)
154154
}
155155
}
156156
}

internal/search/scorer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func extractFormatFromTitle(title string) string {
263263
// guessMediaType guesses the media type from the result source.
264264
func guessMediaType(result models.SearchResult) string {
265265
switch result.Source {
266-
case "audiobook":
266+
case "audiobook", "prowlarr_audiobooks":
267267
return "audiobook"
268268
case "prowlarr_manga", "nyaa_manga", "mangadex", "annas_manga":
269269
return "manga"

internal/search/scorer_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,18 @@ func TestScoreResult_SizeAudiobook(t *testing.T) {
128128
}
129129
}
130130

131+
func TestScoreResult_SizeProwlarrAudiobookWithoutMediaType(t *testing.T) {
132+
result := models.SearchResult{
133+
Title: "Test Audiobook",
134+
Source: "prowlarr_audiobooks",
135+
Size: 500e6, // 500MB
136+
}
137+
sb := ScoreResult(result, "test audiobook", "")
138+
if sb.SizeScore != 10 {
139+
t.Errorf("500MB prowlarr audiobook should score 10, got %f", sb.SizeScore)
140+
}
141+
}
142+
131143
func TestScoreResult_ConfidenceLevels(t *testing.T) {
132144
tests := []struct {
133145
name string

0 commit comments

Comments
 (0)