From dedb5487c1dd3f0b01aa4e81bfdbad6f1c27fd36 Mon Sep 17 00:00:00 2001 From: bacon Date: Sun, 10 Mar 2024 16:15:53 +0300 Subject: [PATCH] cleanup --- lib/YandexPlayer.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/YandexPlayer.py b/lib/YandexPlayer.py index 0b47b00..52f7b10 100644 --- a/lib/YandexPlayer.py +++ b/lib/YandexPlayer.py @@ -1,15 +1,19 @@ -import os - from yandex_music import Client client = Client('AQAAAAAzqNkbAAG8XrWGNg9A5kCakiE_9HDst58').init() def search(_str: str, _type: str = 'all') -> dict: + album_id = None + album_title = None + artist_id = None + artist_name = None + result_json = {} + search_result = client.search(_str, type_=_type) type_ = search_result.best.type best = search_result.best.result - # print(search_result) + if type_ == 'track': artists = '' if best.artists: @@ -18,9 +22,6 @@ def search(_str: str, _type: str = 'all') -> dict: for i in best.albums: album_id = i.id album_title = i.title - else: - album_id = None - album_title = None # Generate json for track result_json = {