Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(match): Ensemble matching for episodes #668

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ShanaryS
Copy link
Contributor

@ShanaryS ShanaryS commented Apr 27, 2024

This feature allows grabbing rss/announce and searching of seasons from individual episodes. Along with the changes in v6, this feature completes all possible matches from cross-seed aside from tweaks.

This works by introducing a new type of searchee, a virtual searchee. This is needed since the episodes are sourced from multiple torrents and folders. As such, it hash no infoHash or path. All areas of the application where these were used for logic has been updated to reflect this new possiblity. In general, this should be treated as a data based searchee if searchee.path is not need. So most checks went from if (searchee.path) to if (!searchee.infoHash) so that virtual searchees are included.

Virtual searchees also have absolute file paths instead of relative to make linking easier. This required some small changes when linking as well as changes in perfect matches. For a perfect match, when the item is a virtual searchee it only requires a name match on each file rather than path.

To support rss/announce, the information needed to be cached. I opted to use an in memory database as I did not want to add to the existing which would need migrations. For 2k entries, it takes about ~3s on startup and about 1MB of memory.

This feature works best with search. Due to the nature of the problem, it's easier to find matches by searching rather than from rss/announce, especially for anime.

Also, I added a check to see if the size changed for data based searches and report TORRENT_NOT_COMPLETE if it hash. A similar check was done for ensemble but on each file.


The implementation is to parse titles and put them in a standard format cleanTitle.season.resolution.source-RlsGrp called key. As such two new regexs were added for resolution and source. These are necessary to restrict searching for mixed resolutions and sources. Once there is more than 2 distinct episodes that all have the same key, it's eligible to be searched. The searchee name will be the key while the files will be the absolute path to the largest file in each episode torrent.

Some additional checks are put into place. The highest episode number is used as the total number in the season. We then check for the presence of all episodes down to E01 and if more than the seasonFromEpisodes is missing, it won't be created. It also checks to ensure that the file with the newest modified time is at least 8 days old since most episodes are released weekly. Of course this will search if there is a mid season break and get no results but the alternative would be to use a sonarr (likely will later). To account for this, if the age of the newest episode is after its last search time, we will search it again immediately (assuming it's more than 8 days old).

Note

  • Working from search
  • Working from rss/announce
  • Config option is validated
  • Search/rss/announce works when feature is disabled
  • Properly implement getAllDownloadDirs for rTorrent (Currently API call for each, not comfortable with API)

@ShanaryS ShanaryS added feature New feature or request search Related to search config related to config file enhancement enhances existing features labels Apr 27, 2024
@ShanaryS ShanaryS self-assigned this Apr 27, 2024
src/clients/Deluge.ts Outdated Show resolved Hide resolved
@ShanaryS ShanaryS force-pushed the risky-multi-file-support branch 3 times, most recently from b046a69 to 74a217d Compare May 29, 2024 17:28
Base automatically changed from risky-multi-file-support to master May 29, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bt client config related to config file daemon enhancement enhances existing features feature New feature or request logging search Related to search
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants