5rahim / seanime

Free and open-source media server for anime and manga that includes library scanning, downloading, transcoding, torrent streaming, and more.
https://seanime.rahim.app
MIT License
225 stars 16 forks source link

feature request: Improve batch torrent smart search #101

Closed TnTora closed 3 weeks ago

TnTora commented 1 month ago

Checklist

Problem Description / Use Case

Many batch torrents are not properly found when using smart search.

Proposed Solution

Add "BD", "Bluray" and "Blu-ray" to the keywords in getBatchGroup and ValueContainsBatchKeywords. This might cause (very rarely) a few non batch torrents to slip through, which is not a problem in the case of manual selection but I'm not sure if it would affect auto selection.

If it does affect auto selection I would propose one of two solutions:

I haven't tried any of these two solutions so I might be missing something.

5rahim commented 1 month ago

I'll see what I can do. If you have some specific examples with missing results that'd be great.

TnTora commented 1 month ago

Here is an example from "Mahou Shoujo Lyrical Nanoha A's"

currently no batch torrent are found:

Screenshot 2024-07-12 at 18 41 15

By adding the keywords I mentioned we get these:

Screenshot 2024-07-12 at 18 40 33

The last 3 torrents are not actually batch torrents and I'm not sure how they would affect auto selection.

If you need more examples I can post a few more.

5rahim commented 1 month ago

If you need more examples I can post a few more.

Yeah you can post the media IDs

5rahim commented 1 month ago

Nevermind, AnimeTosho returns a num_files field that can be used to figure out if the torrent is a batch. No clue why I didn't go with that from the beginning.

5rahim commented 1 month ago

Rewrote smart_search.go, i think this approach works best. You can update that file if you're building from source. I'll do more testing on my end.

https://pastebin.com/KfvTsa7s

TnTora commented 1 month ago

This seems much better but there are still a few missing torrents. I'm not familiar with Sphinx search expressions but when using the one defined in formatCommonQuery a few torrents are not matched.

Here is an example: aid=4688 (Mahou Shoujo Lyrical Nanoha StrikerS)

if I use the title of the anime as the search query, I get 9 torrents including my preferred one "[CSW] Magical Girl Lyrical Nanoha StrikerS (BDRip 1280x714 x264 FLAC) [9d90938]"

If I use the expression (e*|a*|r*|i*|o*) from formatCommonQuery, I get 5 torrents without my preferred one. The other expressions which include the resolution are also unable to match the missing torrents

If I read correctly is used for partial matching but I'm not clear on what `(e|a|r|i|o)` actually matches.

5rahim commented 1 month ago

I guess they changed it but it wasn't possible to query by AID without passing a query string so (e*|a*|r*|i*|o*) was used to find all titles. Removing it still works

func formatCommonQuery(quality string) string {
    quality = strings.TrimSuffix(quality, "p")
    if quality == "1080" {
        return `("1080" !"720" !"540" !"480")`
    } else if quality == "720" {
        return `("720" !"1080" !"540" !"480")`
    } else if quality == "540" {
        return `("540" !"1080" !"720" !"480")`
    } else if quality == "480" {
        return `("480" !"1080" !"720" !"540")`
    } else {
        return ``
    }
}

I get 6 torrents (9 without filtering for batches) image

TnTora commented 1 month ago

Thanks. This seems to work fine