Improved SubDL provider: on-demand AI translation for missing languages (SubDL Plus/Pro)#3415
Open
subdl-maker wants to merge 1 commit into
Open
Improved SubDL provider: on-demand AI translation for missing languages (SubDL Plus/Pro)#3415subdl-maker wants to merge 1 commit into
subdl-maker wants to merge 1 commit into
Conversation
When the SubDL API reports that a wanted language has no subtitles but can be AI-translated (SubDL Plus/Pro accounts), the provider now offers a virtual "AI translation" candidate. Picking it submits a translation job, waits for completion (typically under a minute), and returns the translated file through the normal download flow. - New provider settings: ai_translate (default off) and include_ai_translated (default on, filters subtitles the API flags as AI-translated) - The translation source is chosen by matching its release names against the video, since translations inherit the source's timing - Translation failures never raise DownloadLimitExceeded/AuthenticationError so regular downloads are never throttled by a failed translation - Fully backward compatible: without the API's translation fields the provider behaves exactly as before Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Description
Adds opt-in on-demand AI translation to the SubDL provider. When the SubDL API reports that a wanted language has no subtitles for a title but can be AI-translated (available to SubDL Plus/Pro accounts), the provider offers a virtual "AI translation" result. If Bazarr picks it,
download_subtitle()submits a translation job to SubDL, polls until it finishes (typically under a minute, hard cap 3 minutes), and returns the translated file through the normal download flow.What's included
config.py,get_providers.py, and the frontend provider list):ai_translate— default off, following the same opt-in convention asopensubtitlescom.include_ai_translated, since it spends the user's SubDL monthly translation quota unattended.include_ai_translated— default on; when off, results the API flags asai_translatedare filtered out. Flagged results are labeled "(AI translated)" in the uploader field.utils.update_matcheslogic used for scoring) and submits the best match.DownloadLimitExceeded/AuthenticationError/APIThrottled— a failed or slow translation setssubtitle.content = Noneand logs, so the provider's regular searches and downloads are never throttled by a failed translation. If the deadline passes, the job still completes server-side and the finished subtitle appears as a regular search result afterwards (re-requesting it is answered instantly without consuming quota again).Tests
tests/subliminal_patch/test_subdl.pygains 11 mocked tests (no live API key needed) covering candidate synthesis, source selection by release match, suppression when not entitled / quota exhausted / language already available / setting disabled, the submit→poll→download flow, job reuse, job failure, and that quota errors do not raise throttling exceptions.🤖 Generated with Claude Code