From 6947c24b2375ed7d84d5056b241a5431b6efe361 Mon Sep 17 00:00:00 2001 From: Waket Zheng Date: Sat, 24 Jan 2026 11:08:07 +0800 Subject: [PATCH] README.rst: avoid check val twice --- README.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 57446fc..416225c 100644 --- a/README.rst +++ b/README.rst @@ -44,10 +44,14 @@ Playing a file: >>> import time >>> player = MediaPlayer(filename) - >>> val = '' - >>> while val != 'eof': + >>> while True: ... frame, val = player.get_frame() - ... if val != 'eof' and frame is not None: + ... if val == 'eof': + ... break + ... if frame is None: + ... time.sleep(0.01) + ... print('not ready') + ... else: ... img, t = frame ... # display img