pylav.storage.models package¶
Subpackages¶
- pylav.storage.models.node package
- Submodules
- pylav.storage.models.node.mocked module
NodeMockNodeMock.add_to_disabled_sources()NodeMock.bulk_add_to_disabled_sources()NodeMock.bulk_remove_from_disabled_sources()NodeMock.create_managed()NodeMock.dataNodeMock.delete()NodeMock.exists()NodeMock.fetch_all()NodeMock.fetch_disabled_sources()NodeMock.fetch_extras()NodeMock.fetch_managed()NodeMock.fetch_name()NodeMock.fetch_reconnect_attempts()NodeMock.fetch_resume_timeout()NodeMock.fetch_search_only()NodeMock.fetch_session()NodeMock.fetch_ssl()NodeMock.fetch_yaml()NodeMock.get_cache_key()NodeMock.get_connection_args()NodeMock.idNodeMock.remove_from_disabled_sources()NodeMock.session_idNodeMock.update_disabled_sources()NodeMock.update_extras()NodeMock.update_managed()NodeMock.update_name()NodeMock.update_reconnect_attempts()NodeMock.update_resume_timeout()NodeMock.update_search_only()NodeMock.update_session()NodeMock.update_ssl()NodeMock.update_yaml()
- pylav.storage.models.node.real module
NodeNode.add_to_disabled_sources()Node.bulk_add_to_disabled_sources()Node.bulk_remove_from_disabled_sources()Node.bulk_update()Node.create_managed()Node.delete()Node.exists()Node.fetch_all()Node.fetch_disabled_sources()Node.fetch_extras()Node.fetch_managed()Node.fetch_name()Node.fetch_reconnect_attempts()Node.fetch_resume_timeout()Node.fetch_search_only()Node.fetch_session()Node.fetch_ssl()Node.fetch_yaml()Node.get_cache_key()Node.get_connection_args()Node.idNode.remove_from_disabled_sources()Node.update_disabled_sources()Node.update_extras()Node.update_managed()Node.update_name()Node.update_reconnect_attempts()Node.update_resume_timeout()Node.update_search_only()Node.update_session()Node.update_ssl()Node.update_yaml()
- Module contents
- pylav.storage.models.player package
- Submodules
- pylav.storage.models.player.config module
PlayerConfigPlayerConfig.add_to_dj_roles()PlayerConfig.add_to_dj_users()PlayerConfig.botPlayerConfig.bulk_add_dj_roles()PlayerConfig.bulk_add_dj_users()PlayerConfig.bulk_remove_dj_roles()PlayerConfig.bulk_remove_dj_users()PlayerConfig.create_global()PlayerConfig.delete()PlayerConfig.dj_roles_reset()PlayerConfig.dj_users_reset()PlayerConfig.exists()PlayerConfig.fetch_all()PlayerConfig.fetch_alone_dc()PlayerConfig.fetch_alone_pause()PlayerConfig.fetch_auto_play()PlayerConfig.fetch_auto_play_playlist_id()PlayerConfig.fetch_auto_shuffle()PlayerConfig.fetch_dj_roles()PlayerConfig.fetch_dj_users()PlayerConfig.fetch_effects()PlayerConfig.fetch_empty_queue_dc()PlayerConfig.fetch_extras()PlayerConfig.fetch_forced_channel_id()PlayerConfig.fetch_max_volume()PlayerConfig.fetch_notify_channel_id()PlayerConfig.fetch_repeat_current()PlayerConfig.fetch_repeat_queue()PlayerConfig.fetch_self_deaf()PlayerConfig.fetch_shuffle()PlayerConfig.fetch_text_channel_id()PlayerConfig.fetch_volume()PlayerConfig.get_cache_key()PlayerConfig.idPlayerConfig.is_dj()PlayerConfig.remove_from_dj_roles()PlayerConfig.remove_from_dj_users()PlayerConfig.update_alone_dc()PlayerConfig.update_alone_pause()PlayerConfig.update_auto_play()PlayerConfig.update_auto_play_playlist_id()PlayerConfig.update_auto_shuffle()PlayerConfig.update_effects()PlayerConfig.update_empty_queue_dc()PlayerConfig.update_extras()PlayerConfig.update_forced_channel_id()PlayerConfig.update_max_volume()PlayerConfig.update_notify_channel_id()PlayerConfig.update_repeat_current()PlayerConfig.update_repeat_queue()PlayerConfig.update_self_deaf()PlayerConfig.update_shuffle()PlayerConfig.update_text_channel_id()PlayerConfig.update_volume()
- pylav.storage.models.player.state module
PlayerStatePlayerState.auto_playPlayerState.auto_play_playlist_idPlayerState.auto_shufflePlayerState.botPlayerState.channel_idPlayerState.currentPlayerState.delete()PlayerState.effect_enabledPlayerState.effectsPlayerState.extrasPlayerState.forced_channel_idPlayerState.get()PlayerState.get_cache_key()PlayerState.historyPlayerState.idPlayerState.notify_channel_idPlayerState.pausedPlayerState.pkPlayerState.playingPlayerState.positionPlayerState.queuePlayerState.repeat_currentPlayerState.repeat_queuePlayerState.save()PlayerState.self_deafPlayerState.shufflePlayerState.text_channel_idPlayerState.volume
- Module contents
Submodules¶
pylav.storage.models.config module¶
pylav.storage.models.equilizer module¶
- class pylav.storage.models.equilizer.Equalizer(*, id: 'int', scope: 'int', author: 'int', name: 'str | None' = None, description: 'str | None' = None, band_25: 'float | None' = None, band_40: 'float | None' = None, band_63: 'float | None' = None, band_100: 'float | None' = None, band_160: 'float | None' = None, band_250: 'float | None' = None, band_400: 'float | None' = None, band_630: 'float | None' = None, band_1000: 'float | None' = None, band_1600: 'float | None' = None, band_2500: 'float | None' = None, band_4000: 'float | None' = None, band_6300: 'float | None' = None, band_10000: 'float | None' = None, band_16000: 'float | None' = None)[source]¶
Bases:
CachedModel- author¶
- band_100¶
- band_1000¶
- band_10000¶
- band_160¶
- band_1600¶
- band_16000¶
- band_25¶
- band_250¶
- band_2500¶
- band_40¶
- band_400¶
- band_4000¶
- band_63¶
- band_630¶
- band_6300¶
- async can_manage(bot, requester)[source]¶
Check if the requester can manage the equalizer.
- Parameters:
bot (
DISCORD_BOT_TYPE) – The bot.requester (
discord.abc.User) – The requester.
- Returns:
If the requester can manage the equalizer.
- Return type:
- description¶
- classmethod from_filter(equalizer, context, scope, description=None)[source]¶
Deserialize a Equalizer from a Filter.
- async classmethod get(identifier)[source]¶
Get an equalizer from the database.
- Parameters:
identifier (
int) – The id of the equalizer.- Returns:
The equalizer if found, else None.
- Return type:
Equalizer | None
- async get_author_name(bot, mention=True)[source]¶
Get the name of the author.
- Parameters:
bot (
DISCORD_BOT_TYPE) – The bot.mention (
bool) – If the name should be mentionable.
- Returns:
The name of the author.
- Return type:
str | None
- id¶
- name¶
- scope¶
- to_dict()[source]¶
Serialize the Equalizer to a dict.
- Returns:
The dict representation of the Equalizer.
- Return type:
- to_filter()[source]¶
Serialize the Equalizer to a Filter.
- Returns:
The filter representation of the Equalizer
- Return type:
- to_yaml(guild)[source]¶
Serialize the Equalizer to a YAML file.
yields a tuple of (io.BytesIO, bool) where the bool is whether the playlist file was compressed using Gzip
- Parameters:
guild (
discord.Guild) – The guild.- Yields:
tuple[io.BytesIO,str | None]– The YAML file and the compression type.
pylav.storage.models.playlist module¶
- class pylav.storage.models.playlist.Playlist(*args: 'Any', **kwargs: 'Any')[source]¶
Bases:
CachedModel- async add_track(tracks)[source]¶
Add a track to the playlist.
- Parameters:
tracks (
list[str | Track]) – The tracks to add.
- async bulk_remove_tracks(tracks)[source]¶
Remove disc jockey users from the player.
- Parameters:
tracks (
list[str]) – The track to remove
- async can_manage(bot, requester)[source]¶
Check if the requester can manage the playlist.
- Parameters:
bot (
DISCORD_BOT_TYPE) – The bot instance.requester (
discord.abc.User) – The requester.
- Returns:
Whether the requester can manage the playlist.
- Return type:
- async exists()[source]¶
Check if the config exists.
- Returns:
Whether the config exists.
- Return type:
- async fetch_all()[source]¶
Fetch all playlists from the database.
- Returns:
The playlists.
- Return type:
- async fetch_author()[source]¶
Fetch the author of the playlist.
- Returns:
The author of the playlist.
- Return type:
- async fetch_name()[source]¶
Fetch the name of the playlist.
- Returns:
The name of the playlist.
- Return type:
- async fetch_scope()[source]¶
Fetch the scope of the playlist.
- Returns:
The scope of the playlist.
- Return type:
- async fetch_tracks()[source]¶
Fetch the tracks of the playlist.
- Returns:
The tracks of the playlist.
- Return type:
list[str]
- async fetch_url()[source]¶
Fetch the url of the playlist.
- Returns:
The url of the playlist.
- Return type:
- async get_author_name(bot, mention=True)[source]¶
Get the name of the author of the playlist.
- Parameters:
bot (
DISCORD_BOT_TYPE) – The bot instance.mention (
bool) – Whether to add a mention if it is mentionable.
- Returns:
The name of the author of the playlist.
- Return type:
str | None
- async get_name_formatted(with_url=True, escape=True)[source]¶
Get the name of the playlist formatted.
- async get_scope_name(bot, mention=True, guild=None)[source]¶
Get the name of the scope of the playlist.
- Parameters:
bot (
DISCORD_BOT_TYPE) – The bot instance.mention (
bool) – Whether to add a mention if it is mentionable.guild (
discord.Guild) – The guild to get the scope name for.
- Returns:
The name of the scope of the playlist.
- Return type:
- id¶
- async remove_track(track)[source]¶
Remove a track from the playlist.
- Parameters:
track (
str) – The track to remove
- async size()[source]¶
Count the tracks of the playlist.
- Returns:
The number of tracks in the playlist.
- Return type:
- to_yaml(guild)[source]¶
Serialize the playlist to a YAML file.
yields a tuple of (io.BytesIO, bool) where the bool is whether the playlist file was compressed using Gzip
- Parameters:
guild (
discord.Guild) – The guild where the yaml will be sent to.- Yields:
tuple[io.BytesIO,str | None]– The YAML file and the compression type.
- async update_author(author)[source]¶
Update the author of the playlist.
- Parameters:
author (
int) – The new author of the playlist.
- async update_name(name)[source]¶
Update the name of the playlist.
- Parameters:
name (
str) – The new name of the playlist.
- async update_scope(scope)[source]¶
Update the scope of the playlist.
- Parameters:
scope (
int) – The new scope of the playlist.
pylav.storage.models.query module¶
pylav.storage.models.version module¶
- class pylav.storage.models.version.BotVersion(*args, **kwargs)[source]¶
Bases:
CachedModelA class to represent the version of the bot in the database
- id¶