Release Kaleido 0.5.0 with source bitrate, audio selection and show shuffle
All checks were successful
Validate and publish Kaleido / android (push) Successful in 3m4s

This commit is contained in:
Elijah 2026-10-28 11:19:25 -07:00
parent eeebc9af38
commit dedf62a19e
19 changed files with 372 additions and 32 deletions

View file

@ -0,0 +1,78 @@
"""Focused 0.5 checks: bitrate and actual audio switching, plus show-only Shuffle placement."""
import argparse,json,time,urllib.parse,urllib.request
from device import adb,OUT,screenshot
from inspect_server import get,base,token
from validate_playback import audit
from verify_ui import key,focused,text,wait,labels,focus,snapshot,launch,passed
def wait_for(check,description,timeout=50):
deadline=time.monotonic()+timeout
while time.monotonic()<deadline:
if check():return
time.sleep(.25)
raise AssertionError(description)
def audio():
item=get('/library/metadata/870')['Metadata'][0]
part=item['Media'][0]['Part'][0]
streams=[s for s in part['Stream'] if s['streamType']==2]
original=next((s for s in streams if s.get('selected')),streams[0])
stereo=next(s for s in streams if s.get('channels')==2)
preferences=adb('shell','run-as','tv.kaleido.app','cat','shared_prefs/preferences.xml')
def restore_track():
request=urllib.request.Request(base+'/library/parts/'+str(part['id'])+'?'+urllib.parse.urlencode({'audioStreamID':original['id'],'allParts':1}),method='PUT',headers={'X-Plex-Token':token})
with urllib.request.urlopen(request,timeout=20) as r:assert r.status==200
try:
for mode in (0,2):
restore_track()
adb('shell','am','force-stop','tv.kaleido.app')
adb('shell','run-as','tv.kaleido.app','rm','-f','files/playback-validation.jsonl')
print('Checking audio mode',mode,flush=True)
adb('shell','am','start','-n','tv.kaleido.app/.MainActivity','--es','testTitleId','870','--el','testOffset','90000','--ei','testMode',str(mode),'--ez','testValidation','true')
wait_for(lambda:any(r['event']=='sample' and r.get('playing') and r.get('position',0)>90000 for r in audit()[1]),'Playback ready')
key(127);focused('Play')
wait_for(lambda:(lambda s:bool(s) and not s[-1]['playing'])([r for r in audit()[1] if r['event']=='sample']),'Playback paused')
key(22,4);focused('Playback options');key(23);focused('Audio ·')
if mode==0:
key(20);focused('Quality ·');key(23);focused('Original quality · 19.1 Mbps')
screenshot('050-original-bitrate');key(4);focused('Quality ·');key(19);focused('Audio ·')
key(23);text('Audio tracks')
screenshot('050-audio-tracks-'+str(mode))
# The selected Plex default receives initial focus.
delta=streams.index(stereo)-streams.index(original)
key(20 if delta>=0 else 19,abs(delta));focused(stereo['displayTitle'])
before=[r for r in audit()[1] if r['event']=='sample'][-1]['position']
key(23);focused('Playback options')
wait_for(lambda:any(r['event']=='selectedTracks' and any(a.get('channels')==2 for a in r.get('audio',[])) for r in audit()[1]),'Stereo track must actually be selected')
wait_for(lambda:(lambda s:bool(s) and s[-1]['state']==3)([r for r in audit()[1] if r['event']=='sample']),'Track switch ready')
samples=[r for r in audit()[1] if r['event']=='sample']
assert not samples[-1]['playing'],'Paused state must survive track switch'
assert abs(samples[-1]['position']-before)<2500,'Track switch must preserve position'
key(126)
wait_for(lambda:(lambda s:bool(s) and s[-1].get('audio',{}).get('channels')==2 and s[-1].get('playing'))([r for r in audit()[1] if r['event']=='sample']),'Selected stereo audio must play')
raw,records=audit();(OUT/('050-track-switch-'+str(mode)+'.jsonl')).write_bytes(raw)
assert not any(r['event']=='error' for r in records)
passed('Actual stereo selection, position and pause preservation in '+('Original' if mode==0 else 'Plex conversion'))
finally:
adb('shell','am','force-stop','tv.kaleido.app');restore_track()
adb('shell','run-as','tv.kaleido.app','sh','-c','"cat > shared_prefs/preferences.xml"',data=preferences)
def show():
launch();key(22,3);focused('Search');key(23)
focused('Movies, shows, episodes, people')
adb('shell','input','text','silo');text('TV shows');key(66);focused('Silo');key(23);text('Seasons')
root=text('Shuffle episodes');screenshot('050-show-shuffle')
# Focus starts on the season rail. Reach its action row and explicitly focus Shuffle.
if 'Season' in focus(root):key(19)
wait(lambda r:any(x in focus(r) for x in ('Play','Resume','Watch next','Shuffle')),'Show actions')
if 'Shuffle' not in focus(snapshot()):key(22)
focused('Shuffle episodes')
key(20);focused('Season 1');key(23)
wait(lambda r:'Episodes' in labels(r) or any(x.startswith(('Play','Resume')) for x in labels(r)),'Season page')
assert not any('Shuffle' in s for s in labels(snapshot())),'Shuffle must not appear on seasons'
screenshot('050-season-without-shuffle')
passed('Show Shuffle is remote-focusable and absent from season pages')
if __name__=='__main__':
parser=argparse.ArgumentParser();parser.add_argument('check',choices=['audio','show']);args=parser.parse_args()
(audio if args.check=='audio' else show)()