Repository navigation
One picker row per upload, and a picker open in half the time - #588
Merged
Merged
Conversation
tests/grouping_corpus.py loads what 23 searches returned (41,446 rows) and runs each as a picker open. The fixture keeps each row's release name, size, dates and password flag; the link is a number, the indexer a label and the poster a hash, so it holds no link, key, host or indexer name. measure() gives the numbers a change is judged by (picker rows, rows with no group, uploads split across picker rows), and reference_groups() applies the release rule pair by pair, for any faster grouping to equal.
A cached picker open spent a third of its time counting copies and a fifth repeating the metadata pass. On the 23-search corpus it now takes about half as long, with the same picker rows. * release_index groups a list once: a row joins the first group whose every member the same-release rule accepts, as the picker always did. The copy counts behind the ranking, the odd-size check, the List compacted rows and the NZBGet backups all read it, where three pieces of code each kept their own key. Rows are only compared inside one profile, title and episode, and each distinct name is placed once. * Every listing of a release is ranked by one copy count, the one counted for its picker row. Two spellings of a name could carry 25 and 26. * An oddly sized copy is measured against the rows the picker lists with it. * count_uploads compares a listing only with the uploads inside its two-minute window, kept sorted by date. One name reposted hundreds of times at one size was compared pair by pair. The count is unchanged. * The metadata pass (parse, unify spellings, NFO audio, shared Atmos) marks its rows and returns at once when asked again for the same rows. It runs again when a row is new, when two lists are joined, or when an NFO or MediaInfo has told something since. The search cache stores rows without the mark. The corpus test holds the picker rows to the rule applied pair by pair.
A name with no parsed group was never grouped, not even with a listing of the identical name: 2,882 single picker rows from 1,108 distinct names on the 23-search corpus, a third of the list. Rows with no group that carry one name, in any spelling, are now one release: one picker row with its copy count, ranked and size-checked as one, and each a backup of the other on the NZBGet backend. A named container keeps two of them apart, and a name with no group never joins a release that has one. The corpus goes from 8,450 picker rows to 6,676, and from 611 uploads split across rows to 119. The pairwise rule (same_release) is unchanged and still refuses a name with no group.
Indexers name one upload differently: one cuts the name short (...H.265 for ...H.265-FLUX), one drops a tag (DV for DV.HDR), one lists the bare title. Parsed one by one, those rows ranked, filtered and grouped as different releases. Listings are now taken as one payload, and given one parse, when they have the same exact size in bytes and either name the same film or episode, or one name is the start of the other and the two are the same upload (posted within two minutes, not told apart). A size that is a round number of megabytes proves nothing and is left alone. The parse they share is the one whose group the rest of the list knows best (so -NTb wins over a reposter's -Obfuscated tag, and -GRP over -GRP_mp4), then the most detailed. A name with no group beside a named listing takes the named parse. Rows keep their own names and containers, and the release rule then groups them on equal parsed fields as before. On the 23-search corpus 500 rows take a fuller parse, 234 gain a group, and uploads shown as two or more picker rows fall from 119 to 9.
Parser misses found by comparing listings of one payload: * A tag run into the codec (HDR10x265, HDR10H.265, DV.HDRH.265, AtmosH.264) lost the tag and the codec, and the name parser read HDR10x265 as season 10, episode 265, so a film search dropped the row as a TV episode. The separator is put back before the name is parsed; a glued HDR10 is HDR10+, as is HDR10..x265 (the plus sign turned into a dot). 45 rows of the corpus are shown again. * ATV is Apple TV+, the same service as ATVP. Groups written without a hyphen: * A library manager's file name, Show - S01E02 - Title[WEBDL-1080p.AC3 .h264.EDITH], is read from its bracketed tag block: the group is the last word after a tag, and a one-word episode title before the block is not a group. This was a third of the downloaded names with no group. * A trailing word after a language or another word (...AAC.7.1.Japanese .Tigole) is the group when at least two other rows of the same result list carry it as theirs. 207 rows of the corpus gain a group, from 28 words, all of them release groups.
An NZB gives the size of every segment, and a repost of the same files gives the same sizes in the same order. The scan that already reads each fetched NZB's Message-IDs now gathers the sizes per file in the same pass (about 14% more time on a 130,000-article NZB), and the NZBGet fleet uses them two ways: * A backup that holds the pick's own files, posted anew, is sent ahead of the other backups: if the pick fails, it has exactly what the pick had. * A backup that holds the pick's files and is 1.35 times its size or more is a pack listed under the release's name (a season as one episode). It is not sent, and the dialog counts it as a pack under this name. Two postings hold the same files when the matching ones make up 90% of the smaller posting's bytes; one shared file never decides. A file says nothing when most of its segments have one size (a tool that cuts every article to a fixed length), fewer than 12 segments, or is repair data, and a posting with no file that says anything is sent as before. On 1,472 NZBs the add-on sent before, 59% had usable sizes; of 334 backups that were a separate posting from their release's first, 57 were twins.
The quality-filtering page gets a section with a before and after picture and a chart of how names are read together; the NZBGet page describes names with no group, one upload under several names, twins sent first and packs left out; the search pipeline page shows the one grouping and its four readers; the contributor guide says how to check a grouping change against the corpus; the changelog lists it all.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
The picker's viewer will show a release's NFO and MediaInfo. This adds what it is built on: the text kept per release and indexer, identical texts put together, what a text says beside the listing's name, a reader that asks every indexer listing the release, a MediaInfo report as text, and a renderer that draws text with a fixed terminal font.
…-mediainfo-viewer
Code coverage overviewLanguages: Python Python / code-coverage/pytest
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Left or Right on a release opens a viewer over the list. It has one tab per unique text, naming every indexer that carries it, the text drawn with the add-on's own terminal font and paged for the screen it is on, and under it what the text says of the release, each attribute marked as confirming the listing's name or as new. The picker's rows carry NFO and MEDIAINFO tags for what there is to open, and the footer lists the shortcut. In List compacted the tags, HYBRID and REPACK share one label, since that row has no room for another column.
Grouping: * The release index no longer depends on the order of the rows. A list is grouped before it is ranked (copy counts) and again after (picker, backups); a name that fits two releases could go to one the first time and the other the second, so a row could be ranked by a count its picker row did not show. The names of a bucket are now placed in a fixed order, the one on the most rows first. * One upload's names pool their tags. The leading name's parse used to replace the others whole, which dropped REMUX, PROPER or a Dolby Vision layer that only another name stated. The upload now has every tag any of its names states; where two names contradict each other the leading name's value stands. Ties between names are settled by the name, not by which row came first. * Names with no group that already parse alike at one size are marked as one upload too, so they are one picker row. * A size an indexer rounded to hundredths of a gibibyte or tenths of a mebibyte proves nothing, like a whole number of megabytes. * A library manager's bracket block that ends in -GROUP keeps its group. NZBGet fleet: * The scores an older server fails over by follow the twin-first order; only the order of the appends did. * A pack is a larger posting that holds the pick's files and whose files name two or more episodes. Size alone marked a complete repost of a pick whose own NZB was cut short as a pack, and dropped it. * Segment sizes are held four bytes each while a file is read, and the fast read and the parser walk agree on a file's subject and on a size that is not plain digits.
| from resources.lib.release_match import profile_group, release_profile | ||
| from resources.lib.release_subject import name_form_key | ||
|
|
||
| def reading(row): |
… listing's NFO Found by running the viewer in Kodi: The active view's list is shown one frame after the view is set. A short list is built before that frame, the list then refuses the focus, and no key reaches it. The focus is now asked for until the list has it. A listing named without a release group whose NFO names the same film is shown in the viewer, with what the NFO adds marked as new. Its audio is still not used for ranking. The image of a text's attributes is named by what it shows: Kodi keeps a drawn image by its path, and showed another release's marks.
In the plain List view a tag label beside the size column clipped the size in Kodi. The tags now share one label under the name, as they do in List compacted, where Kodi draws them right. Without the add-on's font, NFO art is written with plain characters: skin fonts lack the box and block characters and Kodi drew an empty box for each.
A docs page with screenshots, a recording and a chart of where the texts come from; changelog entries; links from the features overview and the filtering page. When texts arrive after the window opened, the first tab is shown, unless a key already changed the tab or the page. The pictures use a trial font and are to be taken again with the font that ships.
…-mediainfo-viewer
Giving a named listing another name's tags at one size split it from the other copies of its own name, could swap a real group for a reposter's tag, and mixed what names say with what an NFO or MediaInfo had added. * Only a listing that lost its group takes another name's parse: one with no group, or with a group cut short (-GUA for -GUACAMOLE; between two such groups the one the list knows better gives). It takes the named listing's whole parse as the name reads, never from a listing of another group, and not when it is one upload with listings of two groups. * Two names of one group for one upload keep their own parses. Their releases are joined whole in release_index: every listing of both names in one row, so no listing is split from its own release. * A cut name must name the same season and episode as the full one (or neither), so a cut never changes which episode a row is. * What was read for one name of an upload (NFO, MediaInfo) is applied to the rows listed under its other names too. * Names with no group joined by a shared upload are one release with every other listing of each name. * A pack is told by what else it holds: two or more episodes named in its files, or, where the files name none, as much again in files the pick does not have. One episode named is a complete copy, however large. * A hyphenated tag at the end of a library manager's bracket block (DTS-X) is not a group, and a trailing -Obfuscated is dropped there too. * Sizes rounded to tenths of a megabyte prove nothing either.
4 tasks done
…-mediainfo-viewer
- A MediaInfo report with NaN or an infinite number raised out of the viewer every time it opened on that release. Such a value is now written as it came, and a report that cannot be laid out is shown as it was kept. - Closing the viewer and opening it again while indexers were still answering asked them again. A request in hand is now known, and not sent twice. - The viewer gave up after eight seconds and never showed an answer that came later. It now draws the tabs again as each indexer answers, and waits for all of them. - The store's index is made again from the files when it cannot be read, takes in what another run of the add-on kept, and only ever removes files that carry its own kind of name. - A reply that repeats the request's key is kept without it.
- The index merge lets the newer entry win and drops entries whose file is gone, so another run's update is not lost or its file removed. - A request thread starts while it is registered, so it is never seen as finished before it began. - A drawing failure in the viewer is logged instead of escaping Kodi's callback. - An echoed apikey is removed however short it is.
* A listing that states a group is never changed. One with no group takes the group of the named listing it is one upload of and keeps every tag it states, unless its name is that one cut short, when it takes the whole parse. A REMUX, TrueHD or DTS-HD MA only the bare name states is no longer lost. * A group and its cut (-GUA beside -GUACAMOLE) are joined as whole releases in release_index instead of rewriting one listing's group. * Joins of whole releases need direct evidence: every release in a set shares an upload with every other one, and a listing far from its own release's usual size joins nothing. * A bare name that took parses from two names at two sizes no longer joins those two releases. * Tied spellings take the one whose group more names of the list carry, then the one written with capitals; trailing-word group recovery runs after spellings are unified. * A failed or audio-less read does not block another name's answer. * The flaky fleet test counts only calls made with its own DupeKey. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-mediainfo-viewer
* A name's representative row at one size is chosen the same way whatever order the rows came in (two joined answers can tag one title differently). * The corpus reference reads "no group" as the release rule does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-mediainfo-viewer
Rows with no group are listed together by name alone, and on the corpus 26 such rows hold copies more than 2x apart (a 0.6 GB and a 55 GB post under one name). A pick with no group now takes as NZBGet backups only copies within the odd-size factor (1.35x) of its own size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-mediainfo-viewer
A name with no group is all there is to go by, and one name can cover a 0.6 GB and a 55 GB post. Its listings are now cut wherever one size is more than 1.35x the next smaller one, and each part is its own release: its own picker row, copy count, odd-size check and NZBGet backups. The picker labels the parts NOGRP-A for the largest posts, NOGRP-B and so on; a name at one size range has no label. Listings without a size go with the part that has the most rows. This replaces the size guard on backups of a pick with no group. On the corpus: 6,490 picker rows become 6,535. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…indexer mis-decoded
…-mediainfo-viewer
Comment on lines
+326
to
+328
| tab["digest"] = hashlib.sha1( # nosec B324 | ||
| "{}\n{}".format(tab["kind"], shown).encode("utf-8", "replace") | ||
| ).hexdigest()[:20] |
Comment on lines
+506
to
+508
| said = hashlib.sha1( # nosec B324 | ||
| repr((words, width, scale)).encode("utf-8", "replace") | ||
| ).hexdigest()[:20] |
|
|
||
|
|
||
| def _file_name(key): | ||
| return hashlib.sha1(key.encode("utf-8")).hexdigest()[:24] + ".json" # nosec B324 |
| viewer.onInit() | ||
|
|
||
| image = viewer.getControl(20) | ||
| (path, use_cache), _kwargs = image.setImage.call_args |
| _ATTRIBUTES_ID = 30 | ||
|
|
||
| # The window's layout, in its 1920x1080 coordinates (``nfo-viewer.xml``). | ||
| _TEXT_LEFT = 528 |
|
|
||
| # The window's layout, in its 1920x1080 coordinates (``nfo-viewer.xml``). | ||
| _TEXT_LEFT = 528 | ||
| _TEXT_TOP = 135 |
| _TEXT_TOP = 135 | ||
| _TEXT_WIDTH = 1280 | ||
| _TEXT_HEIGHT = 736 | ||
| _ATTRIBUTES_LEFT = 525 |
| _TEXT_WIDTH = 1280 | ||
| _TEXT_HEIGHT = 736 | ||
| _ATTRIBUTES_LEFT = 525 | ||
| _ATTRIBUTES_TOP = 916 |
| if not line.startswith("ENCODING "): | ||
| continue | ||
| code = int(line.split()[1]) | ||
| for line in lines: |
| if line == "BITMAP": | ||
| break | ||
| rows = [] | ||
| for line in lines: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One picker row per upload, and a picker open in about half the time. This builds the release grouping design: a result list is grouped into releases once and everything reads that grouping, listings that are one upload under different names take one parse, and names with no release group are listed together by name.
Measured on 23 real searches (41,446 rows,
tests/grouping_corpus.py):Changes
flowchart TD A[Every listing of the search] --> B[Parse each name] B --> C[Spellings of one name<br>take the most detailed parse] C --> D{Same exact size in bytes?} D -- "and the same film or episode" --> E[One upload: one set of tags] D -- "and one name is the other cut short,<br>posted within two minutes" --> E D -- no --> F[Keeps its own tags] E --> X[release_index.build, once per list] F --> X X --> R[Picker rows] X --> N[Copy counts for the ranking] X --> O[Odd-size check] X --> K[NZBGet backups] classDef step fill:#1E1E2E,stroke:#4A9EFF,color:#FFFFFF classDef ask fill:#151520,stroke:#FBBF24,color:#FFFFFF classDef done fill:#151520,stroke:#34D399,color:#FFFFFF class A,B,C,E,F,X step class D ask class R,N,O,K doneSpeed, with the same picker rows as before (commit 2):
release_indexgroups a list once: a row joins the first group whose every membersame_releaseaccepts, as the picker always did. The copy counts, the odd-size check, the List compacted rows and the NZBGet backups read it, where three pieces of code each kept their own key. A corpus test holds it to the rule applied pair by pair.nfo_audio.known_version). The search cache stores rows without the mark.count_uploadscompares a listing only with uploads inside its two-minute window. The count is unchanged; one name reposted hundreds of times at one size no longer costs a pair-by-pair comparison.Grouping decisions made in the project chat (commits 3 and 4):
same_releaseitself still refuses such a pair.Parser and group reading (commit 5):
HDR10x265,HDR10H.265,DV.HDRH.265,AtmosH.264: the separator is put back before parsing.HDR10x265was read as season 10, episode 265 and dropped from a film search; 45 rows of the corpus are shown again.ATVis Apple TV+ (ATVP).Show - S01E02 - Title[WEBDL-1080p.AC3.h264.EDITH]) is read from its bracketed tags; a trailing word after a language (...Japanese.Tigole) is the group when two or more other rows of the list carry it. 207 corpus rows gain a group, from 28 words, all reviewed.NZBGet fleet (commit 6):
1 pack under this name, strings 30771 and 30772). Two postings hold the same files when the matching ones make up 90% of the smaller one's bytes; a posting cut to one fixed article size says nothing and is sent as before.Not in this PR: the on-disk store of parsed names, and article-level checks (PAR2 and RAR headers), which belong to the downloader.
Testing
just testpasses (5,095 passed, 2 skipped)just lintpasses, and the Python 3.8 compile gateCHANGELOG.mdanddocs-site/(quality filtering, NZBGet playback, search pipeline, contributing)The segment-size matching was also run over 1,472 NZBs the add-on had sent before: 59% had usable sizes, and of 334 backups that were a separate posting from their release's first, 57 held the same files.
The corpus fixture (
tests/fixtures/grouping_corpus.json.gz, 1.1 MB) keeps each row's release name, size, dates and password flag only. Links are numbers, indexers are labels and posters are hashes; a test checks it holds no key, link or host.