From 235254257e1660cb130e427a107e986ecec003bf Mon Sep 17 00:00:00 2001 From: Parker Date: Wed, 18 Dec 2024 17:42:23 -0600 Subject: Expand conditional checks for results, tracks, and load_type --- code/utils/ai_recommendations.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'code/utils/ai_recommendations.py') diff --git a/code/utils/ai_recommendations.py b/code/utils/ai_recommendations.py index 2fc71d3..1ff5415 100644 --- a/code/utils/ai_recommendations.py +++ b/code/utils/ai_recommendations.py @@ -62,16 +62,28 @@ async def add_song_recommendations( ytsearch = f"ytsearch:{song} by {artist} audio" results = await player.node.get_tracks(ytsearch) - if not (results and results.tracks) or results.load_type in ( - LoadType.EMPTY, - LoadType.ERROR, + if ( + not results + or not results.tracks + or not results.load_type + or results.load_type + in ( + LoadType.EMPTY, + LoadType.ERROR, + ) ): dzsearch = f"dzsearch:{song}" results = await player.node.get_tracks(dzsearch) - if not (results and results.tracks) or results.load_type in ( - LoadType.EMPTY, - LoadType.ERROR, + if ( + not results + or not results.tracks + or not results.load_type + or results.load_type + in ( + LoadType.EMPTY, + LoadType.ERROR, + ) ): continue -- cgit v1.2.3-70-g09d2