used isort + black
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
from rich import print
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
|
from rich import print
|
||||||
|
|
||||||
|
|
||||||
async def runner():
|
async def runner():
|
||||||
from .common import dp, bot
|
from . import callbacks, handlers
|
||||||
|
from .common import bot, dp
|
||||||
from . import handlers, callbacks
|
|
||||||
from .modules.error import on_error
|
from .modules.error import on_error
|
||||||
|
|
||||||
dp.error.register(on_error)
|
dp.error.register(on_error)
|
||||||
@@ -20,8 +20,8 @@ async def runner():
|
|||||||
|
|
||||||
def plugins():
|
def plugins():
|
||||||
import nest_asyncio
|
import nest_asyncio
|
||||||
from rich import traceback
|
|
||||||
from icecream import ic
|
from icecream import ic
|
||||||
|
from rich import traceback
|
||||||
|
|
||||||
nest_asyncio.apply()
|
nest_asyncio.apply()
|
||||||
traceback.install()
|
traceback.install()
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
from . import (
|
|
||||||
full_menu,
|
|
||||||
on_home,
|
|
||||||
settings,
|
|
||||||
)
|
|
||||||
from bot.middlewares import PrivateButtonMiddleware, SettingsInjectorMiddleware
|
from bot.middlewares import PrivateButtonMiddleware, SettingsInjectorMiddleware
|
||||||
|
|
||||||
|
from . import full_menu, on_home, settings
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
from aiogram import Router, F, Bot
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import CallbackQuery
|
from aiogram.types import CallbackQuery
|
||||||
|
|
||||||
from bot.factories.full_menu import FullMenuCallback
|
from bot.factories.full_menu import FullMenuCallback
|
||||||
|
|
||||||
from bot.keyboards.inline.settings import get_settings_kb
|
from bot.keyboards.inline.settings import get_settings_kb
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
from aiogram import Router, F, Bot
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import CallbackQuery
|
from aiogram.types import CallbackQuery
|
||||||
|
|
||||||
from bot.factories.full_menu import FullMenuCallback
|
from bot.factories.full_menu import FullMenuCallback
|
||||||
|
|
||||||
from bot.keyboards.inline.full_menu import get_full_menu_kb
|
from bot.keyboards.inline.full_menu import get_full_menu_kb
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
from aiogram import Router, Bot
|
from aiogram import Bot, Router
|
||||||
from aiogram.types import CallbackQuery
|
|
||||||
from aiogram.exceptions import TelegramBadRequest
|
from aiogram.exceptions import TelegramBadRequest
|
||||||
|
from aiogram.types import CallbackQuery
|
||||||
|
|
||||||
from bot.factories.open_setting import OpenSettingCallback, SettingChoiceCallback
|
from bot.factories.open_setting import OpenSettingCallback, SettingChoiceCallback
|
||||||
|
|
||||||
from bot.keyboards.inline.setting import get_setting_kb
|
from bot.keyboards.inline.setting import get_setting_kb
|
||||||
from bot.modules.settings import settings_strings, UserSettings
|
from bot.modules.settings import UserSettings, settings_strings
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from aiogram import Bot, Dispatcher
|
from aiogram import Bot, Dispatcher
|
||||||
from bot.modules.fsm import InDbStorage
|
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
|
|
||||||
|
from bot.modules.fsm import InDbStorage
|
||||||
|
|
||||||
from .utils.config import config
|
from .utils.config import config
|
||||||
|
|
||||||
bot = Bot(token=config.telegram.bot_token)
|
bot = Bot(token=config.telegram.bot_token)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from aiogram.filters.callback_data import CallbackData
|
from aiogram.filters.callback_data import CallbackData
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from aiogram.filters import BaseFilter
|
from aiogram.filters import BaseFilter
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
|
|
||||||
class MusicUrlFilter(BaseFilter):
|
class MusicUrlFilter(BaseFilter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
from . import (
|
|
||||||
initialize,
|
|
||||||
inline_song,
|
|
||||||
inline_url,
|
|
||||||
inline_error,
|
|
||||||
inline_default,
|
|
||||||
inline_empty,
|
|
||||||
on_chosen,
|
|
||||||
)
|
|
||||||
|
|
||||||
from bot.middlewares import SaveChosenMiddleware, SettingsInjectorMiddleware
|
from bot.middlewares import SaveChosenMiddleware, SettingsInjectorMiddleware
|
||||||
|
|
||||||
|
from . import (
|
||||||
|
initialize,
|
||||||
|
inline_default,
|
||||||
|
inline_empty,
|
||||||
|
inline_error,
|
||||||
|
inline_song,
|
||||||
|
inline_url,
|
||||||
|
on_chosen,
|
||||||
|
)
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
router.chosen_inline_result.outer_middleware(SaveChosenMiddleware())
|
router.chosen_inline_result.outer_middleware(SaveChosenMiddleware())
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from aiogram import Router, Bot
|
from aiogram import Bot, Router
|
||||||
from rich import print
|
from rich import print
|
||||||
|
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
from aiogram import Router, F
|
from aiogram import F, Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
|
from bot.modules.settings import UserSettings
|
||||||
from bot.results.deezer import get_deezer_search_results
|
from bot.results.deezer import get_deezer_search_results
|
||||||
from bot.results.soundcloud import get_soundcloud_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.results.spotify import get_spotify_search_results
|
||||||
|
from bot.results.youtube import get_youtube_search_results
|
||||||
from bot.modules.settings import UserSettings
|
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from aiogram import Router, F
|
from aiogram import F, Router
|
||||||
from aiogram.types import InlineQuery, InputTextMessageContent, InlineQueryResultArticle
|
from aiogram.types import InlineQuery, InlineQueryResultArticle, InputTextMessageContent
|
||||||
|
|
||||||
from bot.keyboards.inline.full_menu import get_full_menu_kb
|
from bot.keyboards.inline.full_menu import get_full_menu_kb
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from bot.results.error import get_error_search_results
|
|
||||||
from bot.filters import ServiceSearchFilter
|
from bot.filters import ServiceSearchFilter
|
||||||
|
from bot.results.error import get_error_search_results
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
on_inline_spotify,
|
|
||||||
on_inline_deezer,
|
on_inline_deezer,
|
||||||
on_inline_youtube,
|
|
||||||
on_inline_soundcloud,
|
on_inline_soundcloud,
|
||||||
|
on_inline_spotify,
|
||||||
|
on_inline_youtube,
|
||||||
)
|
)
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from bot.results.deezer import get_deezer_search_results
|
|
||||||
from bot.filters import ServiceSearchFilter
|
from bot.filters import ServiceSearchFilter
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.results.deezer import get_deezer_search_results
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from bot.results.soundcloud import get_soundcloud_search_results
|
|
||||||
from bot.filters import ServiceSearchMultiletterFilter
|
from bot.filters import ServiceSearchMultiletterFilter
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.results.soundcloud import get_soundcloud_search_results
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from bot.results.spotify import get_spotify_search_results
|
|
||||||
from bot.filters import ServiceSearchFilter
|
from bot.filters import ServiceSearchFilter
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.results.spotify import get_spotify_search_results
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from bot.results.youtube import get_youtube_search_results
|
|
||||||
from bot.filters import ServiceSearchFilter
|
from bot.filters import ServiceSearchFilter
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.results.youtube import get_youtube_search_results
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
|
|
||||||
from aiogram.types import InlineQuery
|
from aiogram.types import InlineQuery
|
||||||
|
|
||||||
from bot.results.url import get_url_results
|
|
||||||
from bot.filters import MusicUrlFilter
|
from bot.filters import MusicUrlFilter
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.results.url import get_url_results
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from aiogram import Router
|
from aiogram import Router
|
||||||
from . import spotify, deezer, youtube, soundcloud, recode_cached, suppress_verify
|
|
||||||
|
from . import deezer, recode_cached, soundcloud, spotify, suppress_verify, youtube
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
from aiogram import Router, Bot, F
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import (
|
from aiogram.types import (
|
||||||
BufferedInputFile,
|
BufferedInputFile,
|
||||||
URLInputFile,
|
|
||||||
InputMediaAudio,
|
|
||||||
ChosenInlineResult,
|
ChosenInlineResult,
|
||||||
|
InputMediaAudio,
|
||||||
|
URLInputFile,
|
||||||
)
|
)
|
||||||
|
|
||||||
from bot.modules.deezer import deezer, DeezerBytestream
|
|
||||||
from bot.utils.config import config
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
from bot.modules.deezer import DeezerBytestream, deezer
|
||||||
|
from bot.utils.config import config
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,12 @@
|
|||||||
from aiogram import Router, Bot, F
|
from io import BytesIO
|
||||||
from aiogram.types import (
|
|
||||||
BufferedInputFile,
|
|
||||||
InputMediaAudio,
|
|
||||||
ChosenInlineResult,
|
|
||||||
)
|
|
||||||
|
|
||||||
from bot.modules.youtube.downloader import YouTubeBytestream
|
from aiogram import Bot, F, Router
|
||||||
|
from aiogram.types import BufferedInputFile, ChosenInlineResult, InputMediaAudio
|
||||||
|
|
||||||
from bot.utils.config import config
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.youtube.downloader import YouTubeBytestream
|
||||||
from io import BytesIO
|
from bot.utils.config import config
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
from aiogram import Router, Bot, F
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import (
|
from aiogram.types import (
|
||||||
BufferedInputFile,
|
BufferedInputFile,
|
||||||
URLInputFile,
|
|
||||||
InputMediaAudio,
|
|
||||||
ChosenInlineResult,
|
ChosenInlineResult,
|
||||||
|
InputMediaAudio,
|
||||||
|
URLInputFile,
|
||||||
)
|
)
|
||||||
|
|
||||||
from bot.modules.soundcloud import soundcloud, SoundCloudBytestream
|
|
||||||
from bot.utils.config import config
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
from bot.modules.soundcloud import SoundCloudBytestream, soundcloud
|
||||||
|
from bot.utils.config import config
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
from aiogram import Router, Bot, F
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import (
|
from aiogram.types import (
|
||||||
BufferedInputFile,
|
BufferedInputFile,
|
||||||
URLInputFile,
|
|
||||||
InputMediaAudio,
|
|
||||||
ChosenInlineResult,
|
ChosenInlineResult,
|
||||||
|
InputMediaAudio,
|
||||||
|
URLInputFile,
|
||||||
)
|
)
|
||||||
|
|
||||||
from bot.modules.spotify import spotify
|
|
||||||
from bot.modules.youtube import youtube, AgeRestrictedError
|
|
||||||
from bot.modules.youtube.song import SongItem
|
|
||||||
from bot.modules.deezer import deezer
|
|
||||||
from bot.utils.config import config
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
from bot.modules.deezer import deezer
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.spotify import spotify
|
||||||
|
from bot.modules.youtube import AgeRestrictedError, youtube
|
||||||
|
from bot.modules.youtube.song import SongItem
|
||||||
|
from bot.utils.config import config
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
from aiogram import Router, Bot, F
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import (
|
from aiogram.types import ChosenInlineResult
|
||||||
ChosenInlineResult,
|
|
||||||
)
|
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
from aiogram import Router, Bot, F
|
from aiogram import Bot, F, Router
|
||||||
from aiogram.types import (
|
from aiogram.types import (
|
||||||
BufferedInputFile,
|
BufferedInputFile,
|
||||||
URLInputFile,
|
|
||||||
InputMediaAudio,
|
|
||||||
ChosenInlineResult,
|
ChosenInlineResult,
|
||||||
|
InputMediaAudio,
|
||||||
|
URLInputFile,
|
||||||
)
|
)
|
||||||
|
|
||||||
from bot.modules.youtube import youtube, AgeRestrictedError
|
|
||||||
from bot.utils.config import config
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.youtube import AgeRestrictedError, youtube
|
||||||
|
from bot.utils.config import config
|
||||||
|
|
||||||
router = Router()
|
router = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from aiogram.utils.keyboard import (
|
from aiogram.utils.keyboard import (
|
||||||
InlineKeyboardMarkup,
|
|
||||||
InlineKeyboardButton,
|
|
||||||
InlineKeyboardBuilder,
|
InlineKeyboardBuilder,
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
)
|
)
|
||||||
from bot.factories.full_menu import FullMenuCallback
|
|
||||||
|
|
||||||
|
from bot.factories.full_menu import FullMenuCallback
|
||||||
from bot.keyboards.inline import search_variants as sv
|
from bot.keyboards.inline import search_variants as sv
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
from aiogram.utils.keyboard import (
|
from aiogram.utils.keyboard import (
|
||||||
InlineKeyboardMarkup,
|
|
||||||
InlineKeyboardButton,
|
|
||||||
InlineKeyboardBuilder,
|
InlineKeyboardBuilder,
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
deezer = {"d": "🎵 Search in Deezer"}
|
deezer = {"d": "🎵 Search in Deezer"}
|
||||||
soundcloud = {"c": "☁️ Search in SoundCloud"}
|
soundcloud = {"c": "☁️ Search in SoundCloud"}
|
||||||
youtube = {"y": "▶️ Search in YouTube"}
|
youtube = {"y": "▶️ Search in YouTube"}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from aiogram.utils.keyboard import (
|
from aiogram.utils.keyboard import (
|
||||||
InlineKeyboardMarkup,
|
|
||||||
InlineKeyboardButton,
|
|
||||||
InlineKeyboardBuilder,
|
InlineKeyboardBuilder,
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
)
|
)
|
||||||
from bot.factories.open_setting import SettingChoiceCallback
|
|
||||||
from bot.factories.full_menu import FullMenuCallback
|
|
||||||
|
|
||||||
|
from bot.factories.full_menu import FullMenuCallback
|
||||||
|
from bot.factories.open_setting import SettingChoiceCallback
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from aiogram.utils.keyboard import (
|
from aiogram.utils.keyboard import (
|
||||||
InlineKeyboardMarkup,
|
|
||||||
InlineKeyboardButton,
|
|
||||||
InlineKeyboardBuilder,
|
InlineKeyboardBuilder,
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
)
|
)
|
||||||
from bot.factories.open_setting import OpenSettingCallback
|
|
||||||
from bot.factories.full_menu import FullMenuCallback
|
|
||||||
|
|
||||||
|
from bot.factories.full_menu import FullMenuCallback
|
||||||
|
from bot.factories.open_setting import OpenSettingCallback
|
||||||
from bot.modules.settings import settings_strings
|
from bot.modules.settings import settings_strings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
|
from .inject_settings import SettingsInjectorMiddleware
|
||||||
from .private_button import PrivateButtonMiddleware
|
from .private_button import PrivateButtonMiddleware
|
||||||
from .save_chosen import SaveChosenMiddleware
|
from .save_chosen import SaveChosenMiddleware
|
||||||
from .inject_settings import SettingsInjectorMiddleware
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
from typing import Any, Awaitable, Callable, Dict
|
||||||
|
|
||||||
from aiogram.dispatcher.middlewares.base import BaseMiddleware
|
from aiogram.dispatcher.middlewares.base import BaseMiddleware
|
||||||
from aiogram.types import TelegramObject
|
from aiogram.types import TelegramObject
|
||||||
|
|
||||||
from typing import Any, Awaitable, Callable, Dict
|
|
||||||
|
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
from typing import Any, Awaitable, Callable, Dict
|
||||||
|
|
||||||
from aiogram.dispatcher.middlewares.base import BaseMiddleware
|
from aiogram.dispatcher.middlewares.base import BaseMiddleware
|
||||||
from aiogram.types import CallbackQuery
|
from aiogram.types import CallbackQuery
|
||||||
|
|
||||||
from typing import Any, Awaitable, Callable, Dict
|
|
||||||
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Any, Awaitable, Callable, Dict
|
||||||
|
|
||||||
from aiogram.dispatcher.middlewares.base import BaseMiddleware
|
from aiogram.dispatcher.middlewares.base import BaseMiddleware
|
||||||
from aiogram.types import ChosenInlineResult
|
from aiogram.types import ChosenInlineResult
|
||||||
|
|
||||||
from typing import Any, Awaitable, Callable, Dict
|
|
||||||
from dataclasses import dataclass
|
|
||||||
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from .db import Db
|
from .db import Db
|
||||||
|
|
||||||
|
|
||||||
db = Db()
|
db = Db()
|
||||||
|
|
||||||
__all__ = ["db"]
|
__all__ = ["db"]
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from sqlitedict import SqliteDict
|
from sqlitedict import SqliteDict
|
||||||
|
|
||||||
from bot.utils.config import config
|
from bot.utils.config import config
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from .deezer import Deezer
|
|
||||||
from .downloader import DeezerBytestream
|
|
||||||
from bot.utils.config import config
|
from bot.utils.config import config
|
||||||
|
|
||||||
|
from .deezer import Deezer
|
||||||
|
from .downloader import DeezerBytestream
|
||||||
|
|
||||||
deezer = Deezer(
|
deezer = Deezer(
|
||||||
arl=config.tokens.deezer.arl,
|
arl=config.tokens.deezer.arl,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from .song import Songs
|
|
||||||
from .engine import DeezerEngine
|
|
||||||
from .driver import DeezerDriver
|
|
||||||
from .downloader import DownloaderBuilder
|
from .downloader import DownloaderBuilder
|
||||||
|
from .driver import DeezerDriver
|
||||||
|
from .engine import DeezerEngine
|
||||||
|
from .song import Songs
|
||||||
|
|
||||||
|
|
||||||
class Deezer(object):
|
class Deezer(object):
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
from attrs import define
|
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from .driver import DeezerDriver
|
from attrs import define
|
||||||
|
|
||||||
from . import track_formats
|
from . import track_formats
|
||||||
from .util import UrlDecrypter, ChunkDecrypter
|
from .driver import DeezerDriver
|
||||||
from .song import FullSongItem
|
from .song import FullSongItem
|
||||||
|
from .util import ChunkDecrypter, UrlDecrypter
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from attrs import define
|
from attrs import define
|
||||||
|
|
||||||
from .engine import DeezerEngine
|
from .engine import DeezerEngine
|
||||||
|
|
||||||
from .util import clean_query
|
from .util import clean_query
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from aiohttp import ClientResponse
|
from aiohttp import ClientResponse
|
||||||
|
|
||||||
from attrs import define
|
from attrs import define
|
||||||
|
|
||||||
|
|
||||||
HTTP_HEADERS = {
|
HTTP_HEADERS = {
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
|
||||||
"(KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
|
"(KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36",
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
from attrs import define
|
from attrs import define
|
||||||
|
|
||||||
from .driver import DeezerDriver
|
|
||||||
|
|
||||||
from ..common.song import BaseSongItem
|
from ..common.song import BaseSongItem
|
||||||
|
from .driver import DeezerDriver
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
# https://pypi.org/project/music-helper/
|
# https://pypi.org/project/music-helper/
|
||||||
import warnings
|
|
||||||
import re
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import re
|
||||||
from cryptography.hazmat.backends import default_backend
|
import warnings
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
||||||
|
|
||||||
from attrs import define
|
from attrs import define
|
||||||
|
from cryptography.hazmat.backends import default_backend
|
||||||
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||||
|
|
||||||
from .track_formats import TrackFormat
|
from .track_formats import TrackFormat
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
from .handler import on_error, Error
|
from .handler import Error, on_error
|
||||||
from .pretty import PrettyException
|
from .pretty import PrettyException
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
from bot.common import console
|
from dataclasses import dataclass
|
||||||
from aiogram.types.error_event import ErrorEvent
|
|
||||||
from aiogram import Bot
|
from aiogram import Bot
|
||||||
from aiogram.dispatcher import router as s_router
|
from aiogram.dispatcher import router as s_router
|
||||||
|
from aiogram.types.error_event import ErrorEvent
|
||||||
from rich.traceback import Traceback
|
from rich.traceback import Traceback
|
||||||
from .pretty import PrettyException
|
|
||||||
|
|
||||||
|
from bot.common import console
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from .pretty import PrettyException
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -19,8 +19,8 @@ class Error:
|
|||||||
|
|
||||||
|
|
||||||
async def on_error(event: ErrorEvent, bot: Bot):
|
async def on_error(event: ErrorEvent, bot: Bot):
|
||||||
import os
|
|
||||||
import base64
|
import base64
|
||||||
|
import os
|
||||||
|
|
||||||
error_id = base64.urlsafe_b64encode(os.urandom(6)).decode()
|
error_id = base64.urlsafe_b64encode(os.urandom(6)).decode()
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import os
|
|
||||||
import traceback
|
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
import traceback
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
from bot.modules.database import db
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Any, DefaultDict, Dict, Optional
|
from typing import Any, DefaultDict, Dict, Optional
|
||||||
|
|
||||||
from aiogram.fsm.state import State
|
from aiogram.fsm.state import State
|
||||||
from aiogram.fsm.storage.base import (
|
from aiogram.fsm.storage.base import BaseStorage, StateType, StorageKey
|
||||||
BaseStorage,
|
|
||||||
StateType,
|
from bot.modules.database import db
|
||||||
StorageKey,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
from .model import UserSettings, Setting, settings_strings
|
from .model import Setting, UserSettings, settings_strings
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from ..database import db
|
from ..database import db
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from .soundcloud import SoundCloud
|
|
||||||
from .downloader import SoundCloudBytestream
|
|
||||||
from bot.utils.config import config
|
from bot.utils.config import config
|
||||||
|
|
||||||
|
from .downloader import SoundCloudBytestream
|
||||||
|
from .soundcloud import SoundCloud
|
||||||
|
|
||||||
soundcloud = SoundCloud(
|
soundcloud = SoundCloud(
|
||||||
client_id=config.tokens.soundcloud.client_id,
|
client_id=config.tokens.soundcloud.client_id,
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from attrs import define
|
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
|
import m3u8
|
||||||
|
from attrs import define
|
||||||
|
|
||||||
from .driver import SoundCloudDriver
|
from .driver import SoundCloudDriver
|
||||||
from .song import SongItem
|
from .song import SongItem
|
||||||
|
|
||||||
import m3u8
|
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class SoundCloudBytestream:
|
class SoundCloudBytestream:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from attrs import define
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
from attrs import define
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from .engine import SoundCloudEngine
|
|
||||||
from .driver import SoundCloudDriver
|
|
||||||
from .song import Songs
|
|
||||||
from .downloader import DownloaderBuilder
|
from .downloader import DownloaderBuilder
|
||||||
|
from .driver import SoundCloudDriver
|
||||||
|
from .engine import SoundCloudEngine
|
||||||
|
from .song import Songs
|
||||||
|
|
||||||
|
|
||||||
class SoundCloud(object):
|
class SoundCloud(object):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from .spotify import Spotify
|
|
||||||
from bot.utils.config import config
|
from bot.utils.config import config
|
||||||
|
|
||||||
|
from .spotify import Spotify
|
||||||
|
|
||||||
spotify = Spotify(
|
spotify = Spotify(
|
||||||
client_id=config.tokens.spotify.client_id,
|
client_id=config.tokens.spotify.client_id,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from attrs import define
|
|
||||||
import spotipy
|
import spotipy
|
||||||
|
from attrs import define
|
||||||
|
|
||||||
from ..common.song import BaseSongItem
|
from ..common.song import BaseSongItem
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
from .recognise import recognise_music_service, RecognisedService
|
|
||||||
from .id_getter import get_id
|
from .id_getter import get_id
|
||||||
|
from .recognise import RecognisedService, recognise_music_service
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from .recognise import RecognisedService
|
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
|
from .recognise import RecognisedService
|
||||||
|
|
||||||
|
|
||||||
async def get_url_after_redirect(url: str) -> str:
|
async def get_url_after_redirect(url: str) -> str:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
from urllib.parse import urlparse, ParseResult
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import Awaitable, Callable, Literal
|
||||||
from typing import Callable, Awaitable, Literal
|
from urllib.parse import ParseResult, urlparse
|
||||||
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
from bot.modules.database.db import DBDict
|
from bot.modules.database.db import DBDict
|
||||||
|
|
||||||
from bot.modules.youtube import youtube
|
|
||||||
from bot.modules.spotify import spotify
|
|
||||||
from bot.modules.deezer import deezer
|
from bot.modules.deezer import deezer
|
||||||
from bot.modules.soundcloud import soundcloud
|
from bot.modules.soundcloud import soundcloud
|
||||||
|
from bot.modules.spotify import spotify
|
||||||
|
from bot.modules.youtube import youtube
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from .youtube import YouTube
|
|
||||||
from pytubefix.exceptions import AgeRestrictedError
|
from pytubefix.exceptions import AgeRestrictedError
|
||||||
|
|
||||||
|
from .youtube import YouTube
|
||||||
|
|
||||||
youtube = YouTube()
|
youtube = YouTube()
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
from attrs import define
|
import asyncio
|
||||||
from pytubefix import YouTube, Stream
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
|
||||||
from pydub import AudioSegment
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from attrs import define
|
||||||
|
from pydub import AudioSegment
|
||||||
import asyncio
|
from pytubefix import Stream, YouTube
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
from attrs import define
|
|
||||||
import ytmusicapi
|
|
||||||
|
|
||||||
from .downloader import Downloader, YouTubeBytestream
|
|
||||||
|
|
||||||
from typing import Awaitable
|
from typing import Awaitable
|
||||||
|
|
||||||
|
import ytmusicapi
|
||||||
|
from attrs import define
|
||||||
|
|
||||||
from ..common.song import BaseSongItem
|
from ..common.song import BaseSongItem
|
||||||
|
from .downloader import Downloader, YouTubeBytestream
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import ytmusicapi
|
import ytmusicapi
|
||||||
|
|
||||||
from .song import Songs
|
|
||||||
from .downloader import Downloader
|
from .downloader import Downloader
|
||||||
|
from .song import Songs
|
||||||
|
|
||||||
|
|
||||||
class YouTube(object):
|
class YouTube(object):
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
from aiogram.types import (
|
|
||||||
InlineQueryResultDocument,
|
|
||||||
InlineQueryResultCachedAudio,
|
|
||||||
InlineKeyboardMarkup,
|
|
||||||
InlineKeyboardButton,
|
|
||||||
)
|
|
||||||
|
|
||||||
from bot.modules.database.db import DBDict
|
|
||||||
from bot.modules.settings import UserSettings
|
|
||||||
|
|
||||||
from bot.modules.common.song import BaseSongItem
|
|
||||||
from typing import TypeVar
|
from typing import TypeVar
|
||||||
|
|
||||||
|
from aiogram.types import (
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
|
InlineQueryResultCachedAudio,
|
||||||
|
InlineQueryResultDocument,
|
||||||
|
)
|
||||||
|
|
||||||
|
from bot.modules.common.song import BaseSongItem
|
||||||
|
from bot.modules.database.db import DBDict
|
||||||
|
from bot.modules.settings import UserSettings
|
||||||
|
|
||||||
BaseSongT = TypeVar("BaseSongT", bound=BaseSongItem)
|
BaseSongT = TypeVar("BaseSongT", bound=BaseSongItem)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from .search import get_deezer_search_results
|
from .search import get_deezer_search_results
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["get_deezer_search_results"]
|
__all__ = ["get_deezer_search_results"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from aiogram.types import InlineQueryResultDocument, InlineQueryResultCachedAudio
|
from aiogram.types import InlineQueryResultCachedAudio, InlineQueryResultDocument
|
||||||
|
|
||||||
from bot.modules.deezer import deezer
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
|
from bot.modules.deezer import deezer
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
|
||||||
from ..common.search import get_common_search_result
|
from ..common.search import get_common_search_result
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
from aiogram.types import (
|
from aiogram.types import InlineQueryResultArticle, InputTextMessageContent
|
||||||
InlineQueryResultArticle,
|
|
||||||
InputTextMessageContent,
|
|
||||||
)
|
|
||||||
|
|
||||||
from bot.modules.database import db
|
|
||||||
from bot.modules.error import Error
|
|
||||||
|
|
||||||
from bot.common import console
|
from bot.common import console
|
||||||
|
from bot.modules.database import db
|
||||||
|
from bot.modules.error import Error
|
||||||
|
|
||||||
|
|
||||||
async def get_error_search_results(
|
async def get_error_search_results(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from .search import get_soundcloud_search_results
|
from .search import get_soundcloud_search_results
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["get_soundcloud_search_results"]
|
__all__ = ["get_soundcloud_search_results"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from aiogram.types import InlineQueryResultDocument, InlineQueryResultCachedAudio
|
from aiogram.types import InlineQueryResultCachedAudio, InlineQueryResultDocument
|
||||||
|
|
||||||
from bot.modules.soundcloud import soundcloud
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.soundcloud import soundcloud
|
||||||
|
|
||||||
from ..common.search import get_common_search_result
|
from ..common.search import get_common_search_result
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from .search import get_spotify_search_results
|
from .search import get_spotify_search_results
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["get_spotify_search_results"]
|
__all__ = ["get_spotify_search_results"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from aiogram.types import InlineQueryResultDocument, InlineQueryResultCachedAudio
|
from aiogram.types import InlineQueryResultCachedAudio, InlineQueryResultDocument
|
||||||
|
|
||||||
from bot.modules.spotify import spotify
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.spotify import spotify
|
||||||
|
|
||||||
from ..common.search import get_common_search_result
|
from ..common.search import get_common_search_result
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
from aiogram.types import InlineQueryResultDocument, InlineQueryResultCachedAudio
|
import inspect
|
||||||
|
|
||||||
|
from aiogram.types import InlineQueryResultCachedAudio, InlineQueryResultDocument
|
||||||
|
|
||||||
from bot.modules.url import recognise_music_service, get_id
|
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.url import get_id, recognise_music_service
|
||||||
|
|
||||||
from ..common.search import get_common_search_result
|
from ..common.search import get_common_search_result
|
||||||
|
|
||||||
import inspect
|
|
||||||
|
|
||||||
|
|
||||||
async def get_url_results(
|
async def get_url_results(
|
||||||
query: str, settings: UserSettings
|
query: str, settings: UserSettings
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from .search import get_youtube_search_results
|
from .search import get_youtube_search_results
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["get_youtube_search_results"]
|
__all__ = ["get_youtube_search_results"]
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from aiogram.types import InlineQueryResultDocument, InlineQueryResultCachedAudio
|
from aiogram.types import InlineQueryResultCachedAudio, InlineQueryResultDocument
|
||||||
|
|
||||||
from bot.modules.youtube import youtube
|
|
||||||
from bot.modules.database import db
|
from bot.modules.database import db
|
||||||
from bot.modules.settings import UserSettings
|
from bot.modules.settings import UserSettings
|
||||||
|
from bot.modules.youtube import youtube
|
||||||
|
|
||||||
from ..common.search import get_common_search_result
|
from ..common.search import get_common_search_result
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from ._config import Config
|
from ._config import Config
|
||||||
|
|
||||||
|
|
||||||
config = Config()
|
config = Config()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from .serializers import Serialize
|
|
||||||
from .api import Shazam
|
from .api import Shazam
|
||||||
from .converter import Geo
|
from .converter import Geo
|
||||||
from .enums import GenreMusic
|
from .enums import GenreMusic
|
||||||
|
from .serializers import Serialize
|
||||||
|
|
||||||
__all__ = ("Serialize", "Shazam", "Geo", "GenreMusic")
|
__all__ = ("Serialize", "Shazam", "Geo", "GenreMusic")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from copy import copy
|
from copy import copy
|
||||||
from typing import List, Optional, Any
|
from typing import Any, List, Optional
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from .enums import FrequencyBand
|
from .enums import FrequencyBand
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
import uuid
|
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
import uuid
|
||||||
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
|
|
||||||
from typing import Dict, Any, Union
|
from .converter import Converter, Geo
|
||||||
|
from .enums import GenreMusic
|
||||||
from .misc import Request
|
from .misc import Request, ShazamUrl
|
||||||
from .misc import ShazamUrl
|
|
||||||
from .schemas.artists import ArtistQuery
|
from .schemas.artists import ArtistQuery
|
||||||
from .signature import DecodedMessage
|
from .signature import DecodedMessage
|
||||||
from .enums import GenreMusic
|
|
||||||
from .converter import Converter, Geo
|
|
||||||
from .typehints import CountryCode
|
from .typehints import CountryCode
|
||||||
from .utils import ArtistQueryGenerator
|
from .utils import ArtistQueryGenerator, get_song
|
||||||
from .utils import get_song
|
|
||||||
|
|
||||||
|
|
||||||
class Shazam(Converter, Geo, Request):
|
class Shazam(Converter, Geo, Request):
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from shazamio.exceptions import BadMethod
|
from shazamio.exceptions import BadMethod
|
||||||
from shazamio.utils import validate_json
|
from shazamio.utils import validate_json
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
from dataclass_factory import Factory
|
from dataclass_factory import Factory
|
||||||
|
|
||||||
from shazamio.factory import FactorySchemas
|
from shazamio.factory import FactorySchemas
|
||||||
from shazamio.schemas.artists import ArtistInfo
|
from shazamio.schemas.artists import ArtistInfo, ArtistV3
|
||||||
from shazamio.schemas.artists import ArtistV3
|
|
||||||
from shazamio.schemas.attributes import ArtistAttribute
|
from shazamio.schemas.attributes import ArtistAttribute
|
||||||
from shazamio.schemas.models import (
|
from shazamio.schemas.models import (
|
||||||
SongSection,
|
|
||||||
VideoSection,
|
|
||||||
RelatedSection,
|
|
||||||
LyricsSection,
|
|
||||||
BeaconDataLyricsSection,
|
|
||||||
ArtistSection,
|
ArtistSection,
|
||||||
|
BeaconDataLyricsSection,
|
||||||
|
LyricsSection,
|
||||||
MatchModel,
|
MatchModel,
|
||||||
|
RelatedSection,
|
||||||
|
ResponseTrack,
|
||||||
|
SongSection,
|
||||||
|
TrackInfo,
|
||||||
|
VideoSection,
|
||||||
|
YoutubeData,
|
||||||
)
|
)
|
||||||
from shazamio.schemas.models import TrackInfo
|
|
||||||
from shazamio.schemas.models import YoutubeData
|
|
||||||
from shazamio.schemas.models import ResponseTrack
|
|
||||||
|
|
||||||
|
|
||||||
FACTORY_TRACK = Factory(
|
FACTORY_TRACK = Factory(
|
||||||
schemas={
|
schemas={
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
from shazamio.user_agent import USER_AGENTS
|
from shazamio.user_agent import USER_AGENTS
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from shazamio.schemas.attributes import AttributeName
|
from shazamio.schemas.attributes import AttributeName
|
||||||
from shazamio.schemas.base import BaseDataModel
|
from shazamio.schemas.base import BaseDataModel
|
||||||
from shazamio.schemas.photos import ImageModel
|
from shazamio.schemas.photos import ImageModel
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from shazamio.schemas.attributes import AttributeName
|
from shazamio.schemas.attributes import AttributeName
|
||||||
from shazamio.schemas.base import BaseDataModel
|
from shazamio.schemas.base import BaseDataModel
|
||||||
from shazamio.schemas.photos import ImageModel
|
from shazamio.schemas.photos import ImageModel
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ from __future__ import annotations
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from shazamio.schemas.attributes import AttributeName
|
from shazamio.schemas.attributes import AttributeName
|
||||||
from shazamio.schemas.base import BaseHrefNextData
|
from shazamio.schemas.base import BaseHrefNextData, BaseIdTypeHref
|
||||||
from shazamio.schemas.base import BaseIdTypeHref
|
|
||||||
from shazamio.schemas.photos import ImageModel
|
from shazamio.schemas.photos import ImageModel
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from shazamio.schemas.attributes import AttributeName
|
from shazamio.schemas.attributes import AttributeName
|
||||||
from shazamio.schemas.base import BaseDataModel
|
from shazamio.schemas.base import BaseDataModel
|
||||||
from shazamio.schemas.photos import ImageModel
|
from shazamio.schemas.photos import ImageModel
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from shazamio.schemas.artist.views.top_music import PlayParams
|
from shazamio.schemas.artist.views.top_music import PlayParams
|
||||||
from shazamio.schemas.attributes import AttributeName
|
from shazamio.schemas.attributes import AttributeName
|
||||||
from shazamio.schemas.base import BaseDataModel
|
from shazamio.schemas.base import BaseDataModel
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass, field
|
||||||
from dataclasses import field
|
from typing import List, Optional, Union
|
||||||
from typing import List
|
|
||||||
from typing import Optional
|
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
from shazamio.schemas.artist.views.full_albums import FullAlbumsModel
|
from shazamio.schemas.artist.views.full_albums import FullAlbumsModel
|
||||||
from shazamio.schemas.artist.views.last_release import LastReleaseModel
|
from shazamio.schemas.artist.views.last_release import LastReleaseModel
|
||||||
from shazamio.schemas.artist.views.simular_artists import SimularArtist
|
from shazamio.schemas.artist.views.simular_artists import SimularArtist
|
||||||
from shazamio.schemas.artist.views.top_music import TopMusicVideosView
|
from shazamio.schemas.artist.views.top_music import TopMusicVideosView
|
||||||
from shazamio.schemas.artist.views.top_song import TopSong
|
from shazamio.schemas.artist.views.top_song import TopSong
|
||||||
from shazamio.schemas.attributes import ArtistAttribute
|
from shazamio.schemas.attributes import ArtistAttribute
|
||||||
from shazamio.schemas.enums import ArtistExtend
|
from shazamio.schemas.enums import ArtistExtend, ArtistView
|
||||||
from shazamio.schemas.enums import ArtistView
|
|
||||||
from shazamio.schemas.errors import ErrorModel
|
from shazamio.schemas.errors import ErrorModel
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from typing import List
|
from typing import List, Optional
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, Field
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
|
|
||||||
class AttributeName(BaseModel):
|
class AttributeName(BaseModel):
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
from typing import Generic
|
from typing import Generic, Optional, TypeVar
|
||||||
from typing import Optional
|
|
||||||
from typing import TypeVar
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from pydantic.generics import GenericModel
|
from pydantic.generics import GenericModel
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T", bound=BaseModel)
|
T = TypeVar("T", bound=BaseModel)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass, field
|
||||||
from dataclasses import field
|
from typing import List, Optional, Union
|
||||||
from typing import List
|
from urllib.parse import urlencode, urlparse, urlunparse
|
||||||
from typing import Optional
|
|
||||||
from typing import Union
|
|
||||||
from urllib.parse import urlencode
|
|
||||||
from urllib.parse import urlparse
|
|
||||||
from urllib.parse import urlunparse
|
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel, Field
|
||||||
from pydantic import Field
|
|
||||||
|
|
||||||
|
|
||||||
class ImageModel(BaseModel):
|
class ImageModel(BaseModel):
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from shazamio.factory_misc import FACTORY_ARTIST
|
from shazamio.factory_misc import FACTORY_ARTIST, FACTORY_TRACK
|
||||||
from shazamio.factory_misc import FACTORY_TRACK
|
from shazamio.schemas.artists import ArtistInfo, ArtistResponse, ArtistV2
|
||||||
from shazamio.schemas.artists import ArtistInfo
|
from shazamio.schemas.models import ResponseTrack, TrackInfo, YoutubeData
|
||||||
from shazamio.schemas.artists import ArtistResponse
|
|
||||||
from shazamio.schemas.artists import ArtistV2
|
|
||||||
from shazamio.schemas.models import ResponseTrack
|
|
||||||
from shazamio.schemas.models import TrackInfo
|
|
||||||
from shazamio.schemas.models import YoutubeData
|
|
||||||
|
|
||||||
|
|
||||||
class Serialize:
|
class Serialize:
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
from typing import Dict, List
|
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
from math import exp, sqrt
|
|
||||||
from binascii import crc32
|
from binascii import crc32
|
||||||
from io import BytesIO
|
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
|
from io import BytesIO
|
||||||
|
from math import exp, sqrt
|
||||||
|
from typing import Dict, List
|
||||||
|
|
||||||
from .enums import FrequencyBand, SampleRate
|
from .enums import FrequencyBand, SampleRate
|
||||||
|
|
||||||
DATA_URI_PREFIX = "data:audio/vnd.shazam.sig;base64,"
|
DATA_URI_PREFIX = "data:audio/vnd.shazam.sig;base64,"
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Dict
|
from typing import Dict, List, Optional, Union
|
||||||
from typing import List
|
|
||||||
from typing import Optional
|
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
import aiofiles
|
import aiofiles
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from aiohttp import ContentTypeError
|
from aiohttp import ContentTypeError
|
||||||
from pydub import AudioSegment
|
from pydub import AudioSegment
|
||||||
|
|
||||||
from shazamio.exceptions import FailedDecodeJson
|
from shazamio.exceptions import FailedDecodeJson
|
||||||
from shazamio.schemas.artists import ArtistQuery
|
from shazamio.schemas.artists import ArtistQuery
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user