feat(trackers): add VietMediaF (VMF) tracker support#1285
feat(trackers): add VietMediaF (VMF) tracker support#1285bioidaika wants to merge 2 commits intoAudionut:masterfrom
Conversation
…uding support for the VMF tracker.
|
Thanks for taking the time to contribute to this project. Upload Assistant is currently in a complete rewrite, and no new development is being conducted on this python source at this time. If you have come this far, please feel free to leave open, any pull requests regarding new sites being added to the source, as these can serve as the baseline for later conversion. If your pull request relates to a critical bug, this will be addressed in this code base, and a new release published as needed. If your pull request only addresses a quite minor bug, it is not likely to be addressed in this code base. Details for the new code base will follow at a later date. |
📝 WalkthroughWalkthroughA new tracker implementation for VMF is introduced, subclassing UNIT3D and providing async methods to map metadata fields (category, type, resolution) to tracker-specific identifiers. The tracker is registered in the application's tracker registry and API tracker list. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/trackers/VMF.py`:
- Around line 25-76: The overrides get_category_id, get_type_id, and
get_resolution_id currently ignore mapping_only and always return payload dicts;
update each function (get_category_id, get_type_id, get_resolution_id) to build
the mapping dict first, then if mapping_only is True return that mapping (so
callers can do mapping.get(meta_value)), otherwise derive the id using the
mapping and return the payload-shaped dict (e.g., {'category_id': id}). Keep
using meta['category']/meta['type']/meta['resolution'] for lookups and preserve
the default fallback values currently used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d5b5055-8662-40ef-9760-4bcf9b48447a
📒 Files selected for processing (2)
src/trackers/VMF.pysrc/trackersetup.py
| async def get_category_id( | ||
| self, | ||
| meta: Meta, | ||
| category: Optional[str] = None, | ||
| reverse: bool = False, | ||
| mapping_only: bool = False, | ||
| ) -> dict[str, str]: | ||
| _ = (category, reverse, mapping_only) | ||
| category_id = { | ||
| 'MOVIE': '1', | ||
| 'TV': '2', | ||
| }.get(meta['category'], '0') | ||
| return {'category_id': category_id} | ||
|
|
||
| async def get_type_id( | ||
| self, | ||
| meta: Meta, | ||
| type: Optional[str] = None, | ||
| reverse: bool = False, | ||
| mapping_only: bool = False, | ||
| ) -> dict[str, str]: | ||
| _ = (type, reverse, mapping_only) | ||
| type_id = { | ||
| 'DISC': '1', | ||
| 'REMUX': '2', | ||
| 'ENCODE': '3', | ||
| 'WEBDL': '4', | ||
| 'WEBRIP': '5', | ||
| 'HDTV': '6', | ||
| }.get(meta['type'], '0') | ||
| return {'type_id': type_id} | ||
|
|
||
| async def get_resolution_id( | ||
| self, | ||
| meta: Meta, | ||
| resolution: Optional[str] = None, | ||
| reverse: bool = False, | ||
| mapping_only: bool = False, | ||
| ) -> dict[str, str]: | ||
| _ = (resolution, reverse, mapping_only) | ||
| resolution_id = { | ||
| '4320p': '1', | ||
| '2160p': '2', | ||
| '1080p': '3', | ||
| '1080i': '4', | ||
| '720p': '5', | ||
| '576p': '6', | ||
| '576i': '7', | ||
| '480p': '8', | ||
| '480i': '9', | ||
| }.get(meta['resolution'], '10') | ||
| return {'resolution_id': resolution_id} |
There was a problem hiding this comment.
Honor the UNIT3D mapping contract in these overrides.
Lines 32, 46, and 64 discard mapping_only=True and always return payload-shaped dicts keyed by category_id / type_id / resolution_id. src/trackersetup.py later calls these helpers with mapping_only=True and does mapping.get(meta_value), so VMF ends up with None for every category/type/resolution lookup. That breaks request matching and claim matching for this tracker.
🔧 Suggested fix
- async def get_category_id(
- self,
- meta: Meta,
- category: Optional[str] = None,
- reverse: bool = False,
- mapping_only: bool = False,
- ) -> dict[str, str]:
- _ = (category, reverse, mapping_only)
- category_id = {
+ async def get_category_id(
+ self,
+ meta: Meta,
+ category: str = "",
+ reverse: bool = False,
+ mapping_only: bool = False,
+ ) -> dict[str, str]:
+ _ = reverse
+ category_map = {
'MOVIE': '1',
'TV': '2',
- }.get(meta['category'], '0')
- return {'category_id': category_id}
+ }
+ if mapping_only:
+ return category_map
+ selected = category or meta['category']
+ return {'category_id': category_map.get(selected, '0')}
async def get_type_id(
self,
meta: Meta,
- type: Optional[str] = None,
+ type: str = "",
reverse: bool = False,
mapping_only: bool = False,
) -> dict[str, str]:
- _ = (type, reverse, mapping_only)
- type_id = {
+ _ = reverse
+ type_map = {
'DISC': '1',
'REMUX': '2',
'ENCODE': '3',
'WEBDL': '4',
'WEBRIP': '5',
'HDTV': '6',
- }.get(meta['type'], '0')
- return {'type_id': type_id}
+ }
+ if mapping_only:
+ return type_map
+ selected = type or meta['type']
+ return {'type_id': type_map.get(selected, '0')}
async def get_resolution_id(
self,
meta: Meta,
- resolution: Optional[str] = None,
+ resolution: str = "",
reverse: bool = False,
mapping_only: bool = False,
) -> dict[str, str]:
- _ = (resolution, reverse, mapping_only)
- resolution_id = {
+ _ = reverse
+ resolution_map = {
'4320p': '1',
'2160p': '2',
'1080p': '3',
'1080i': '4',
'720p': '5',
'576p': '6',
'576i': '7',
'480p': '8',
'480i': '9',
- }.get(meta['resolution'], '10')
- return {'resolution_id': resolution_id}
+ }
+ if mapping_only:
+ return resolution_map
+ selected = resolution or meta['resolution']
+ return {'resolution_id': resolution_map.get(selected, '10')}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/trackers/VMF.py` around lines 25 - 76, The overrides get_category_id,
get_type_id, and get_resolution_id currently ignore mapping_only and always
return payload dicts; update each function (get_category_id, get_type_id,
get_resolution_id) to build the mapping dict first, then if mapping_only is True
return that mapping (so callers can do mapping.get(meta_value)), otherwise
derive the id using the mapping and return the payload-shaped dict (e.g.,
{'category_id': id}). Keep using
meta['category']/meta['type']/meta['resolution'] for lookups and preserve the
default fallback values currently used.
Add VietMediaF tracker (UNIT3D-based Vietnamese private tracker). Includes VMF.py with category/type/resolution mappings and trackersetup.py integration.
Summary by CodeRabbit