diff --git a/bot/handlers/inline_default/on_inline_default.py b/bot/handlers/inline_default/on_inline_default.py index 43c4f25..924d286 100644 --- a/bot/handlers/inline_default/on_inline_default.py +++ b/bot/handlers/inline_default/on_inline_default.py @@ -3,6 +3,9 @@ from aiogram import Router, F from aiogram.types import InlineQuery from bot.results.deezer import get_deezer_search_results +from bot.results.soundcloud import get_soundcloud_search_results +from bot.results.youtube import get_youtube_search_results +from bot.results.spotify import get_spotify_search_results from bot.modules.settings import UserSettings @@ -12,7 +15,12 @@ router = Router() @router.inline_query(F.query != '') async def default_inline_query(inline_query: InlineQuery, settings: UserSettings): await inline_query.answer( - await get_deezer_search_results(inline_query.query, settings), + await { + 'd': get_deezer_search_results, + 'c': get_soundcloud_search_results, + 'y': get_youtube_search_results, + 's': get_spotify_search_results + }[settings['default_search_provider'].value](inline_query.query, settings), cache_time=0, is_personal=True ) diff --git a/bot/modules/settings/model.py b/bot/modules/settings/model.py index a3e5012..b601ac6 100644 --- a/bot/modules/settings/model.py +++ b/bot/modules/settings/model.py @@ -40,6 +40,16 @@ settings_strings: dict[str, Setting] = { 'yes': 'Only exact matches', 'no': 'Fuzzy matches also' }, + ), + 'default_search_provider': Setting( + name='Default search provider', + description='Which service to use when searching without service filter', + choices={ + 'd': 'Deezer', + 'c': 'SoundCloud', + 'y': 'YouTube', + 's': 'Spotify' + } ) } diff --git a/pyproject.toml b/pyproject.toml index 77fa6ed..c28798c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,6 @@ readme = "README.md" python = "^3.11" aiogram = "^3.1.1" rich = "^13.6.0" -py-deezer = "^1.1.4.post1" shazamio = { path = "lib/ShazamIO" } sqlitedict = "^2.1.0" spotipy = "^2.23.0" @@ -21,6 +20,7 @@ aiohttp = "^3.8.6" nest-asyncio = "^1.5.8" icecream = "^2.1.3" m3u8 = "^3.6.0" +cryptography = "^41.0.7" [build-system]