From 5351a5f3966fa968ccfded0a81b6c266ae3a8d0e Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 21 Jan 2020 18:32:53 +1000 Subject: [PATCH] compare only on rank, as voices may be subclassed --- qt/aqt/sound.py | 3 ++- qt/aqt/tts.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 4ee49ae7c..3d25f8f9f 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -14,6 +14,7 @@ from concurrent.futures import Future from typing import Any, Callable, Dict, List, Optional, Tuple import pyaudio +from operator import itemgetter import anki import aqt @@ -169,7 +170,7 @@ class AVPlayer: if rank is not None: ranked.append((rank, p)) - ranked.sort() + ranked.sort(key=itemgetter(0)) if ranked: return ranked[-1][1] diff --git a/qt/aqt/tts.py b/qt/aqt/tts.py index 7ce7ce877..a93a885f6 100644 --- a/qt/aqt/tts.py +++ b/qt/aqt/tts.py @@ -9,7 +9,7 @@ or {{tts ja_JP voices=Kyoko,Otoya,Another_name:Field}} -The first argument must be a language code. +The first argument must be an underscored language code, eg en_US. If provided, voices is a comma-separated list of one or more voices that the user would prefer. Spaces must not be included. Underscores will be