plugin.video.jacktook
plugin.video.jacktook copied to clipboard
Select source screen: quick filter switching, compact skin with collapsable sidebar
Allow navigation between different sections, each representing a filter or sorting mechanism, using the left and right arrow keys.
Some components have been added:
1. Enrichers (Metadata Enhancers)
Enrichers add or modify metadata in items (dictionaries) based on specific patterns in their data.
-
Base Class:
Enricher- Abstract class requiring implementation of
enrich(item: Dict). -
Subclasses:
-
LanguageEnricher: Detects languages from emoji flags/keywords in descriptions. -
StatsEnricher: Extracts size, seeders, and provider info from descriptions. -
QualityEnricher: Determines video quality (4K, 1080p, etc.) from titles. -
IsPackEnricher: Identifies multi-episode/seasons packs using regex patterns.
-
- Abstract class requiring implementation of
2. EnricherBuilder
Orchestrates the sequential application of enrichers to a list of items.
-
Workflow:
- Initialize with a list of items.
- Chain enrichers using
add(). -
build()processes items through all enrichers.
3. FilterBuilder
Applies filters, sorting, and limits to refine processed items.
-
Capabilities:
- Filtering: By language, episode/season, duplicates, and data sources.
- Sorting: By multiple fields (numeric/string, ascending/descending).
- Limiting: Return top N results.
How It Works: Example Scenario
Goal: Process torrent items to:
- Enrich with languages, quality, and pack detection.
- Filter English episodes of S02E05, sort by seeders, limit to 10.
# Sample Items
items = [
{"title": "Show.Name.S02E05.1080p", "description": "π€ 150 π ProviderA πΊπΈ"},
{"title": "Show.Name.Complete.S02", "description": "π€ 80 π¬π§"}
]
# 1. Enrichment Pipeline
enriched = (
EnricherBuilder(items)
.add(LanguageEnricher(language_map={"πΊπΈ": "en"}, keywords={"english"}))
.add(QualityEnricher())
.add(IsPackEnricher(season_number=2))
.add(StatsEnricher(size_converter=some_size_function))
.build()
)
# 2. Filtering/Sorting
filtered = (
FilterBuilder(enriched)
.filter_by_language("en")
.filter_by_episode(episode_name="", episode_num=5, season_num=2)
.filter_by_source() # Ensure items have infoHash/guid
.sort_by("seeders", ascending=False)
.sort_by("quality_sort") # Secondary sort
.limit(10)
.build()
)
Output:
[
{
"title": "Show.Name.S02E05.1080p",
"languages": ["en"],
"quality": "[B][COLOR blue]1080p[/COLOR][/B]",
"isPack": False,
"seeders": 150,
"size": "5.2 GB",
"provider": "ProviderA"
}
]