pylav.storage.models package#
Subpackages#
- pylav.storage.models.node package
- Submodules
- pylav.storage.models.node.mocked module
NodeMock
NodeMock.add_to_disabled_sources()
NodeMock.bulk_add_to_disabled_sources()
NodeMock.bulk_remove_from_disabled_sources()
NodeMock.create_managed()
NodeMock.data
NodeMock.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.id
NodeMock.remove_from_disabled_sources()
NodeMock.session_id
NodeMock.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
Node
Node.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.id
Node.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
PlayerConfig
PlayerConfig.add_to_dj_roles()
PlayerConfig.add_to_dj_users()
PlayerConfig.bot
PlayerConfig.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.id
PlayerConfig.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
PlayerState
PlayerState.auto_play
PlayerState.auto_play_playlist_id
PlayerState.auto_shuffle
PlayerState.bot
PlayerState.channel_id
PlayerState.current
PlayerState.delete()
PlayerState.effect_enabled
PlayerState.effects
PlayerState.extras
PlayerState.forced_channel_id
PlayerState.get()
PlayerState.get_cache_key()
PlayerState.history
PlayerState.id
PlayerState.notify_channel_id
PlayerState.paused
PlayerState.pk
PlayerState.playing
PlayerState.position
PlayerState.queue
PlayerState.repeat_current
PlayerState.repeat_queue
PlayerState.save()
PlayerState.self_deaf
PlayerState.shuffle
PlayerState.text_channel_id
PlayerState.volume
- Module contents
Submodules#
pylav.storage.models.config module#
- class pylav.storage.models.config.Config(*args: 'Any', **kwargs: 'Any')[source]#
Bases:
CachedModel
- bot#
- async exists()[source]#
Check if the config exists.
- Returns:
Whether the config exists.
- Return type:
- async fetch_all()[source]#
Update all attributed for the config from the database.
- Returns:
The updated config.
- Return type:
- async fetch_auto_update_managed_nodes()[source]#
Fetch the auto_update_managed_nodes.
- Returns:
The auto_update_managed_nodes.
- Return type:
- async fetch_config_folder()[source]#
Fetch the config folder.
- Returns:
The config folder.
- Return type:
- async fetch_enable_managed_node()[source]#
Fetch the enable_managed_node.
- Returns:
The enable_managed_node.
- Return type:
- async fetch_localtrack_folder()[source]#
Fetch the localtrack folder.
- Returns:
The localtrack folder.
- Return type:
- async fetch_next_execution_update_bundled_external_playlists()[source]#
Fetch the next_execution_update_bundled_external_playlists.
- Returns:
The next_execution_update_bundled_external_playlists.
- Return type:
- async fetch_next_execution_update_bundled_playlists()[source]#
Fetch the next_execution_update_bundled_playlists.
- Returns:
The next_execution_update_bundled_playlists.
- Return type:
- async fetch_next_execution_update_external_playlists()[source]#
Fetch the next_execution_update_external_playlists.
- Returns:
The next_execution_update_external_playlists.
- Return type:
- async fetch_update_bot_activity()[source]#
Fetch the update_bot_activity.
- Returns:
The update_bot_activity.
- Return type:
- async fetch_use_bundled_lava_link_external()[source]#
Fetch the use_bundled_lava_link_external.
- Returns:
The use_bundled_lava_link_external.
- Return type:
- async fetch_use_bundled_pylav_external()[source]#
Fetch the use_bundled_pylav_external.
- Returns:
The use_bundled_pylav_external.
- Return type:
- id#
- async update_auto_update_managed_nodes(auto_update_managed_nodes)[source]#
Update the auto_update_managed_nodes.
- Parameters:
auto_update_managed_nodes – The new auto_update_managed_nodes.
- async update_config_folder(config_folder)[source]#
Update the config folder.
- Parameters:
config_folder – The new config folder.
- async update_download_id(download_id)[source]#
Update the download_id.
- Parameters:
download_id – The new download_id.
- async update_enable_managed_node(enable_managed_node)[source]#
Update the enable_managed_node.
- Parameters:
enable_managed_node – The new enable_managed_node.
- async update_java_path(java_path)[source]#
Update the java path.
- Parameters:
java_path – The new java path.
- async update_localtrack_folder(localtrack_folder)[source]#
Update the localtrack folder.
- Parameters:
localtrack_folder – The new localtrack folder.
- async update_next_execution_update_bundled_external_playlists(next_execution)[source]#
Update the next_execution_update_bundled_external_playlists.
- Parameters:
next_execution – The new next_execution.
- async update_next_execution_update_bundled_playlists(next_execution)[source]#
Update the next_execution_update_bundled_playlists.
- Parameters:
next_execution – The new next_execution_update_bundled_playlists.
- async update_next_execution_update_external_playlists(next_execution)[source]#
Update the next_execution_update_external_playlists.
- Parameters:
next_execution – The new next_execution.
- async update_update_bot_activity(update_bot_activity)[source]#
Update the update_bot_activity.
- Parameters:
update_bot_activity – The new update_bot_activity.
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#
- class pylav.storage.models.query.Query(*args: 'Any', **kwargs: 'Any')[source]#
Bases:
CachedModel
- async bulk_update(tracks, name, info=None, plugin_info=None)[source]#
Bulk update the query.
- Parameters:
tracks (
list[str | Track]
) – The tracks of the playlist.name (
str
) – The name of the playlist
- async exists()[source]#
Check if the config exists.
- Returns:
Whether the config exists.
- Return type:
- async fetch_bulk(info=False, name=False, pluginInfo=False, tracks=False)[source]#
Get all tracks.
- Returns:
All tracks
- Return type:
list[str]
- async fetch_info()[source]#
Get the info of the playlist.
- Returns:
The plugin info of the playlist.
- Return type:
JSON_DICT_TYPE
- async fetch_last_updated()[source]#
Get the last updated time of the playlist.
- Returns:
The last updated time of the playlist.
- Return type:
datetime
- async fetch_name()[source]#
Get the name of the playlist.
- Returns:
The name of the playlist.
- Return type:
- async fetch_plugin_info()[source]#
Get the plugin info of the playlist.
- Returns:
The plugin info of the playlist.
- Return type:
JSON_DICT_TYPE
- async fetch_tracks()[source]#
Get the tracks of the playlist.
- Returns:
The tracks of the playlist.
- Return type:
list[str]
- id#
- async size()[source]#
Count the tracks of the playlist.
- Returns:
The number of tracks in the playlist.
- Return type:
- async update_info(info)[source]#
Update the info of the playlist.
- Parameters:
info (
JSON_DICT_TYPE
) – The plugin info of the playlist.
- async update_name(name)[source]#
Update the name of the playlist.
- Parameters:
name (
str
) – The name of the playlist.
pylav.storage.models.version module#
- class pylav.storage.models.version.BotVersion(*args, **kwargs)[source]#
Bases:
CachedModel
A class to represent the version of the bot in the database
- id#