Release 3.0.3: device-code login, Turbo/ad-free login, GQL search, HEVC setting, search & tofu fixes#707
Conversation
The implicit-grant link flow never returns a refresh token, so the
OAuth token has to be regenerated manually every few weeks/months.
This adds Twitch's Device Code Grant flow ("Login (device code)" under
Settings -> Login): the user authorizes once with a short code at
twitch.tv/activate, and the add-on then refreshes the access token
silently via the stored refresh token (on demand in api.Twitch and
proactively from the background service). The existing manual link
flow is kept as a fallback. No client secret is required (public
client, default Client-ID). New strings are English source strings,
translatable via Weblate.
Refs anxdpanic#701, anxdpanic#698
Adds a Supported codecs setting (Twitch default / H.265 (HEVC)) whose value is passed to usher via the new supported_codecs parameter, so users with hardware HEVC decode can receive Enhanced Broadcasting variants (1440p+). Default is "Twitch default" (no codec requested) -> behaviour unchanged. The value is only passed when the installed script.module.python.twitch accepts the parameter (feature-detected), so it degrades gracefully with an older library. Refs anxdpanic#699, anxdpanic#700
A silent refresh is impossible for a confidential client (Twitch replies 'missing client secret'). Detect it, stop retrying, and show a one-time hint to set a public Client-ID; the manual login keeps working. Public client ids are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds an optional Search backend using Twitch's GQL searchFor (the same search twitch.tv uses) for proper fuzzy matching + relevance/live ranking, which the Helix search/channels endpoint lacks. The result is mapped into the existing Helix search shape so routes and converters are unchanged. A new "Search method" setting selects it (default) or the Helix search, and it falls back to Helix automatically if GQL errors/empties. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…cess lock The rotating, single-use refresh token could be lost under Kodi's multi-process settings race: several add-on processes (service + plugin calls) refreshing at once and consuming the same single-use token, or one clobbering another's settings.xml write from its in-memory cache. This surfaced as "Invalid refresh token" and broke the silent auto-refresh after a while. Keep the tokens in addon_data/oauth_tokens.json instead: read fresh on every access, written atomically via os.replace, and guarded by a cross-process fcntl lock around the whole refresh with a re-check inside the lock so a rotated token is never consumed twice. Migrates once from the legacy settings (mirrored back for backward compatibility) and preserves the confidential-client handling. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # resources/language/resource.language.en_gb/strings.po
# Conflicts: # resources/language/resource.language.en_gb/strings.po
…ter, ISA headers/1440p, cleanup - Turbo/ad-free device login: second device-code login with the private client id, stored in its own race-free token store (oauth_private_tokens.json, atomic write + cross-process lock) with silent refresh; get_private_oauth_token() prefers the store and falls back to the manual private_oauth_token setting. Server-side revoke for both (routes/revoke_private_token.py, device_oauth.revoke_token). No refresh attempt for the kimne78 web client (confidential, tokens never expire) to avoid a doomed POST + warning per API call. - Search: remember the query in a window property so the post-playback container reload re-renders the previous results instead of re-popping the keyboard or hanging at 'Working...' (fork issue anxdpanic#1); the search menus clear the property so a deliberate New Search still prompts. - Strip emoji/symbols Kodi's skin font cannot render (tofu boxes) from list labels, plot, tagline and info dialog text. - InputStream Adaptive: pass headers via manifest_headers/stream_headers properties instead of the legacy URL pipe; allow up to 1440p via chooser_resolution_max so Twitch 2K plays regardless of screen res; drop sub-720p variants from quality selection (Source/720p+/audio_only /Adaptive kept); default video_quality=Adaptive + IA enabled. - Manual token entry / revoke now go through the race-free token store. - Cleanup: remove IRC chat integration (script.ircchat), the obsolete browser-based 'Get OAuth token' flow (token_url, google_firebase) and dead routes (edit_blacklist, collections); raw-string regex fixes in common/kodi.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e login, dedup import - get_video_for_quality: with sub-720p variants filtered out, the bandwidth-limited selection can end up with no candidate; guard the max() so it falls through to the quality dialog instead of raising ValueError. - The 'generate a new token' dialogs still pointed at the removed 'Get OAuth token' settings entry; point them at 'Login (device code)'. - new_search: import search_results once. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@anxdpanic I've realised I only have access to this repository and not the script.python.twitch . Are you able to do the merge? Thanks. |
|
Can confirm community-fork beta has been running without issue for me for the last ~month. 👍 |
|
@MrSprigster Just checked, you should have acccess on both |
|
I am going to have to manually submit to the official repository. Can you guys try the release zip's and let me know if all is in order? |
|
With the release zips manually installed, a quick scoot around the updated features shows no issues for me. |
|
Checked both release zips, everything looks in order to me. 👍 Packaging:
Runtime (RPi4, LibreELEC 12.2, Kodi 21.3):
Thanks for getting this released! |
Oh sorry, I just assumed I only had access to this one, my bad I should have checked. Thanks for sorting. I'll give the zips a test now. |
|
Yup, all good. Both zips install fine and the addon loads and works as expected for me. |
|
@kuraikaze thanks for testing your log was very helpful! |
|
Thank you for putting in the effort, and making the time. |
As invited by @MrSprigster in #706 — this is the full release pull request consolidating my open PRs and the community-fork fixes into one reviewed, testable state: 3.0.3.
What's included
From the open PRs (unchanged in substance):
addon_data/oauth_tokens.jsonwith atomic writes and a cross-process file lock, so the rotating single-use refresh token survives Kodi's multi-process settings race (Invalid refresh token). Confidential client ids (which cannot silently refresh) are detected once, with a one-time hint to register a public client id.searchFor(anonymous, public web client id) with fuzzy/relevance ranking, selectable via a "Search method" setting, automatic Helix fallback. Routes/converters untouched.script.module.python.twitch3.0.3 (usher: add optional supported_codecs parameter script.module.python.twitch#141) it becomes active. Default stays "Twitch default", so nothing changes unless enabled.New in this PR (from the community-fork betas people have been testing):
private_oauth_tokenfield keeps working as a fallback. Includes a revoke button. No refresh attempt for the default web client id (its tokens never expire; a refresh can only fail and spam the log).manifest_headers/stream_headersproperties instead of the legacy URL pipe;chooser_resolution_maxallows up to 1440p so Twitch 2K plays regardless of screen resolution; sub-720p variants are dropped from quality selection (Source/720p+/audio_only/Adaptive kept).Behaviour changes to be aware of (deliberate, please push back if unwanted):
video_quality=Adaptive+ InputStream Adaptive enabled (this is the tested configuration and what makes HEVC/ad-handling work out of the box; existing installs keep their settings).script.ircchat), along with the obsolete browser-based "Get OAuth token" flow and dead routes (edit_blacklist,collections). The "generate a new token" dialogs now point at the device-code login.Translations
Only
en_gbstrings were added/changed — other locales are left for Weblate, per this repo's translation workflow.Testing
kodi-addon-checker --branch omegapasses (no problems), all modules compile, en_gb PO validated.Coupling
Full disclosure, as on the previous PRs: developed with Claude (Anthropic's Claude Code) assisting; it is credited as co-author on the commits.
🤖 Generated with Claude Code