seanime
seanime copied to clipboard
bug: Autodownloader removes season when matching `Comparison title`, cannot match Oshi no ko s2, erai-raws
Checklist
- [X] My version of the app is the latest available
- [X] I have checked open and closed issues
- [X] I have checked the docs for a fix
Bug Severity
Usability is affected
Bug Area
Other
Bug Description / Steps to Reproduce
I have the following setting in autodownloader
But unfortunately it didn't download an episode. After digging into the code I figured out that this test reproduces the issue
diff --git a/internal/library/autodownloader/autodownloader_test.go b/internal/library/autodownloader/autodownloader_test.go
new file mode 100644
index 00000000..42d59d8f
--- /dev/null
+++ b/internal/library/autodownloader/autodownloader_test.go
@@ -0,0 +1,41 @@
+package autodownloader
+
+import (
+ "encoding/json"
+ "fmt"
+ "seanime/internal/api/anilist"
+ "seanime/internal/library/anime"
+ seanime_parser "seanime/seanime-parser"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestOshiNoKoS2(t *testing.T) {
+ ad := AutoDownloader{}
+ name1 := "[Oshi no Ko] 2nd Season"
+ name2 := "Oshi no Ko Season 2"
+ aniListEntry := anilist.MediaListEntry{
+ Media: &anilist.BaseAnime{
+ Title: &anilist.BaseAnime_Title{
+ Romaji: &name1,
+ },
+ Synonyms: []*string{&name2},
+ },
+ }
+
+ // fill comparisonTitle later
+ ruleJson := `{"dbId":3,"enabled":true,"mediaId":166531,"releaseGroups":["SubsPlease","Erai-raws"],"resolutions":["1080p"],"comparisonTitle":"","titleComparisonType":"likely","episodeType":"recent","destination":"/data/seanime/library/[Oshi no Ko] 2nd Season"}`
+ rule := anime.AutoDownloaderRule{}
+ err := json.Unmarshal([]byte(ruleJson), &rule)
+ assert.NoError(t, err)
+
+ rule.ComparisonTitle = "Oshi no Ko 2nd Season"
+
+ p := seanime_parser.Parse("[Erai-raws] Oshi no Ko 2nd Season - 11 [720p][Multiple Subtitle] [ENG][FRE]")
+ // json marshal p
+ jsonP, err := json.Marshal(p)
+ assert.NoError(t, err)
+ fmt.Printf("%s\n", string(jsonP))
+ assert.True(t, ad.isTitleMatch(p.Title, &rule, &aniListEntry))
+}
changing it to
diff --git a/internal/library/autodownloader/autodownloader_test.go b/internal/library/autodownloader/autodownloader_test.go
index 42d59d8f..5a07b696 100644
--- a/internal/library/autodownloader/autodownloader_test.go
+++ b/internal/library/autodownloader/autodownloader_test.go
@@ -30,7 +30,7 @@ func TestOshiNoKoS2(t *testing.T) {
err := json.Unmarshal([]byte(ruleJson), &rule)
assert.NoError(t, err)
- rule.ComparisonTitle = "Oshi no Ko 2nd Season"
+ rule.ComparisonTitle = "Oshi no Ko"
p := seanime_parser.Parse("[Erai-raws] Oshi no Ko 2nd Season - 11 [720p][Multiple Subtitle] [ENG][FRE]")
// json marshal p
fixes the test.
The reason probably is that seanime_parser.Parse("[Erai-raws] Oshi no Ko 2nd Season - 11 [720p][Multiple Subtitle] [ENG][FRE]")
stores Oshi no Ko
in Title
field of seanime_parser.Metadata
struct and stores "2"
in SeasonNumber
. However the anilist entry for this https://anilist.co/anime/166531 shows [Oshi no Ko] 2nd Season
and Oshi no Ko Season 2
, both contain the season, hence string matching fails. This is the torrent I hoped it would match https://animetosho.org/view/erai-raws-oshi-no-ko-2nd-season-11.n1875103
Expected Behavior
IMO Oshi no Ko 2nd Season
should have matched since the torrent title contained that string.
Though using Oshi no ko
instead of Oshi no ko 2nd Season
isn't a dealbraker for me, things can get weird when a special air along with the main season. I think I've seen that happen several times like, recently, with Sousou no frieren https://anilist.co/anime/154587/Sousou-no-Frieren/ and https://anilist.co/anime/170068/Sousou-no-Frieren--no-Mahou/. Lets say if this was s2, Sousou no frieren
could match both these shows and autodownloader may pick the wrong one. Though in frieren's case this wouldn't have happened since specials are 13 eps and main season was 28 eps, so main season ep count would always be ahead of specials. This may not be the case when frieren s2 drops.
I see several options here:
- We can put a notice to exclude the season number from the
ComparisonTitle
- we can parse the
ComparisonTitle
in similar manner, match only the title here and add another step for the season match. Lack of the season in any string(both torrent title andComparisonTitle
) can be treated as season 1 - we can additionally match against the raw title string in
Exact match
mode, though this cannot be extended toMost likely
- we can ask the user to supply a format string/regex to match against. This can be helpful with the situation I have with SubsPlease for oshi no ko s2. ~The torrent is of the format
[SubsPlease] Oshi no Ko - 22 (1080p) [3FB8494C].mkv
so maybe I could write some string like[SubsPlease] Oshi no Ko - {ep_number+11} (1080p) [*].mkv
. We can't allow the user to write arbitrary rtemplate/format strings code for security reasons, but you probably get the idea...~ Actually scratch this, changing toOshi no Ko
somehow downloaded the correct ep from SubsPlease as well :O. That's like magic! I'm curious as to how you achieve this, if, you can explain!
Screenshots
No response
Logs
I included a test, I think that should be enough for reproduction.
Debugging Checklist
- [ ] I have included error messages
- [ ] I have included terminal output
- [ ] I have included browser console logs
App Version
v2.1.1
Operating System
Linux