Enums¶
- class lava_lyra.enums.LavaSearchType(value)[source]¶
Bases:
EnumThe enum for the different search types for LavaSearch plugin.
LavaSearchType.TRACK searches for tracks only.
LavaSearchType.ALBUM searches for albums only.
LavaSearchType.ARTIST searches for artists only.
LavaSearchType.PLAYLIST searches for playlists only.
LavaSearchType.TEXT searches for text results only.
- ALBUM = 'album'¶
- ARTIST = 'artist'¶
- PLAYLIST = 'playlist'¶
- TEXT = 'text'¶
- TRACK = 'track'¶
- class lava_lyra.enums.LogLevel(value)[source]¶
Bases:
IntEnumThe enum for specifying the logging level within Lyra. This class serves as shorthand for logging.<level> This enum is exclusively for the logging feature in Lyra. If you are not using this feature, this class is not necessary.
LogLevel.DEBUG sets the logging level to “debug”.
LogLevel.INFO sets the logging level to “info”.
LogLevel.WARN sets the logging level to “warn”.
LogLevel.ERROR sets the logging level to “error”.
LogLevel.CRITICAL sets the logging level to “CRITICAL”.
- CRITICAL = 50¶
- DEBUG = 10¶
- ERROR = 40¶
- INFO = 20¶
- WARN = 30¶
- class lava_lyra.enums.LoopMode(value)[source]¶
Bases:
EnumThe enum for the different loop modes. This feature is exclusively for the queue utility of lyra. If you are not using this feature, this class is not necessary.
LoopMode.TRACK sets the queue loop to the current track.
LoopMode.QUEUE sets the queue loop to the whole queue.
- QUEUE = 'queue'¶
- TRACK = 'track'¶
- class lava_lyra.enums.MixEndReason(value)[source]¶
Bases:
EnumMix end reasons (NodeLink specific)
MixEndReason.FINISHED indicates that playback completed naturally. MixEndReason.REMOVED indicates that the mix was manually removed via API. MixEndReason.ERROR indicates that a stream error occurred. MixEndReason.MAIN_ENDED indicates that the main track ended, triggering auto-cleanup
- ERROR = 'ERROR'¶
- FINISHED = 'FINISHED'¶
- MAIN_ENDED = 'MAIN_ENDED'¶
- REMOVED = 'REMOVED'¶
- class lava_lyra.enums.NodeAlgorithm(value)[source]¶
Bases:
EnumThe enum for the different node algorithms in Lyra.
The enums in this class are to only differentiate different methods, since the actual method is handled in the get_best_node() method.
NodeAlgorithm.by_ping returns a node based on it’s latency, preferring a node with the lowest response time
NodeAlgorithm.by_total_players return a nodes based on how many total players it has. This algorithm prefers nodes with the least amount of total players.
NodeAlgorithm.by_playing_players return a nodes based on how many players are currently playing. This algorithm prefers nodes with the least amount of actively playing players. This is more accurate than by_total_players as it only considers active players.
NodeAlgorithm.by_health returns a node based on its health score, which considers latency, uptime, player load, and connection stability. This is the recommended algorithm for multi-node setups.
- by_health = 'BY_HEALTH'¶
- by_ping = 'BY_PING'¶
- by_playing_players = 'BY_PLAYING_PLAYERS'¶
- by_total_players = 'BY_TOTAL_PLAYERS'¶
- class lava_lyra.enums.PlaylistType(value)[source]¶
Bases:
EnumThe enum for the different playlist types for Lyra.
PlaylistType.YOUTUBE defines that the playlist is from YouTube
PlaylistType.SOUNDCLOUD defines that the playlist is from SoundCloud.
PlaylistType.SPOTIFY defines that the playlist is from Spotify
PlaylistType.APPLE_MUSIC defines that the playlist is from Apple Music.
PlaylistType.OTHER defines that the playlist is from an unknown source (possible from 3rd-party plugins).
- APPLE_MUSIC = 'applemusic'¶
- BILIBILI = 'bilibili'¶
- FACEBOOK = 'facebook'¶
- INSTAGRAM = 'instagram'¶
- OTHER = 'other'¶
- SOUNDCLOUD = 'soundcloud'¶
- SPOTIFY = 'spotify'¶
- YOUTUBE = 'youtube'¶
- YTDLP = 'ytdlp'¶
- property none: None¶
- class lava_lyra.enums.RouteIPType(value)[source]¶
Bases:
EnumThe enum for specifying the route planner IP block type for Lavalink. This feature is exclusively for the RoutePlanner class. If you are not using this feature, this class is not necessary.
RouteIPType.IPV4 specifies that the IP block type is IPV4
RouteIPType.IPV6 specifies that the IP block type is IPV6
- IPV4 = 'Inet4Address'¶
- IPV6 = 'Inet6Address'¶
- class lava_lyra.enums.RouteStrategy(value)[source]¶
Bases:
EnumThe enum for specifying the route planner strategy for Lavalink. This feature is exclusively for the RoutePlanner class. If you are not using this feature, this class is not necessary.
RouteStrategy.ROTATE_ON_BAN specifies that the node is rotating IPs whenever they get banned by Youtube.
RouteStrategy.LOAD_BALANCE specifies that the node is selecting random IPs to balance out requests between them.
RouteStrategy.NANO_SWITCH specifies that the node is switching between IPs every CPU clock cycle.
RouteStrategy.ROTATING_NANO_SWITCH specifies that the node is switching between IPs every CPU clock cycle and is rotating between IP blocks on ban.
- LOAD_BALANCE = 'BalancingIpRoutePlanner'¶
- NANO_SWITCH = 'NanoIpRoutePlanner'¶
- ROTATE_ON_BAN = 'RotatingIpRoutePlanner'¶
- ROTATING_NANO_SWITCH = 'RotatingNanoIpRoutePlanner'¶
- class lava_lyra.enums.SearchType(value)[source]¶
Bases:
EnumThe enum for the different search types for Lyra. This feature is exclusively for the Spotify search feature of Lyra. If you are not using this feature, this class is not necessary.
SearchType.ytsearch searches using regular Youtube, which is best for all scenarios.
SearchType.ytmsearch searches using YouTube Music, which is best for getting audio-only results.
SearchType.scsearch searches using SoundCloud, which is an alternative to YouTube or YouTube Music.
- amsearch = 'amsearch'¶
- bilisearch = 'bilisearch'¶
- other = 'other'¶
- scsearch = 'scsearch'¶
- sprec = 'sprec'¶
- spsearch = 'spsearch'¶
- ytmsearch = 'ytmsearch'¶
- ytsearch = 'ytsearch'¶
- class lava_lyra.enums.TrackType(value)[source]¶
Bases:
EnumThe enum for the different track types for Lyra.
TrackType.YOUTUBE defines that the track is from YouTube
TrackType.YOUTUBE_MUSIC defines that the track is from YouTube Music
TrackType.SOUNDCLOUD defines that the track is from SoundCloud.
TrackType.SPOTIFY defines that the track is from Spotify
TrackType.APPLE_MUSIC defines that the track is from Apple Music.
TrackType.HTTP defines that the track is from an HTTP source.
TrackType.LOCAL defines that the track is from a local source.
TrackType.OTHER defines that the track is from an unknown source (possible from 3rd-party plugins).
- APPLE_MUSIC = 'applemusic'¶
- BILIBILI = 'bilibili'¶
- FACEBOOK = 'facebook'¶
- HTTP = 'http'¶
- INSTAGRAM = 'instagram'¶
- LOCAL = 'local'¶
- OTHER = 'other'¶
- SOUNDCLOUD = 'soundcloud'¶
- SPOTIFY = 'spotify'¶
- YOUTUBE = 'youtube'¶
- YOUTUBE_MUSIC = 'ytmusic'¶
- YTDLP = 'ytdlp'¶
- class lava_lyra.enums.URLRegex[source]¶
Bases:
objectThe enum for all the URL Regexes in use by Lyra.
URLRegex.SPOTIFY_URL returns the Spotify URL Regex.
URLRegex.DISCORD_MP3_URL returns the Discord MP3 URL Regex.
URLRegex.YOUTUBE_URL returns the Youtube URL Regex.
URLRegex.YOUTUBE_PLAYLIST returns the Youtube Playlist Regex.
URLRegex.YOUTUBE_TIMESTAMP returns the Youtube Timestamp Regex.
URLRegex.AM_URL returns the Apple Music URL Regex.
URLRegex.SOUNDCLOUD_URL returns the SoundCloud URL Regex.
URLRegex.BASE_URL returns the standard URL Regex.
- AM_SINGLE_IN_ALBUM_REGEX = re.compile('https?://music\\.apple\\.com/(?P<country>[a-zA-Z]{2})/(?P<type>album|playlist|song|artist)/(?P<name>.+)/(?P<id>[^/?]+)(\\?i=)(?P<id2>[^&]+)(?:&.*)?$')¶
- AM_URL = re.compile('https?://music\\.apple\\.com/(?P<country>[a-zA-Z]{2})/(?P<type>album|playlist|song|artist)/(?P<name>.+?)/(?P<id>[^/?]+?)(?:/)?(?:\\?.*)?$')¶
- BASE_URL = re.compile('https?://(?:www\\.)?.+')¶
- BILIBILI_URL = re.compile('^https?://(?:(?:www|m)\\.)?(?:bilibili\\.com|b23\\.tv)/(?P<type>video|audio)/(?P<id>(?:(?P<audioType>am|au|av)?(?P<audioId>[0-9]+))|[A-Za-z0-9]+)/?(?:\\?.*)?$')¶
- DISCORD_MP3_URL = re.compile('https?://cdn.discordapp.com/attachments/(?P<channel_id>[0-9]+)/(?P<message_id>[0-9]+)/(?P<file>[a-zA-Z0-9_.]+)+')¶
- LAVALINK_SEARCH = re.compile('(?P<type>ytm?|sc)search:')¶
- SOUNDCLOUD_PLAYLIST_URL = re.compile('^(https?:\\/\\/)?(www.)?(m\\.)?soundcloud\\.com\\/.*/sets/.*')¶
- SOUNDCLOUD_TRACK_IN_SET_URL = re.compile('^(https?:\\/\\/)?(www.)?(m\\.)?soundcloud\\.com/[a-zA-Z0-9-._]+/[a-zA-Z0-9-._]+(\\?in)')¶
- SOUNDCLOUD_URL = re.compile('((?:https?:)?\\/\\/)?((?:www|m)\\.)?soundcloud.com\\/.*/.*')¶
- SPOTIFY_URL = re.compile('https?://open\\.spotify\\.com/(?:intl-[a-zA-Z-]+/)?(?P<type>album|playlist|track|artist)/(?P<id>[a-zA-Z0-9]+)(?:/)?(?:\\?.*)?$')¶
- YOUTUBE_PLAYLIST_URL = re.compile('^((?:https?:)?\\/\\/)?((?:www|m)\\.)?((?:youtube\\.com|youtu.be))/playlist\\?list=.*')¶
- YOUTUBE_TIMESTAMP = re.compile('(?P<video>^.*?)(\\?t|&start)=(?P<time>\\d+)?.*')¶
- YOUTUBE_URL = re.compile('^((?:https?:)?\\/\\/)?((?:www|m|music)\\.)?((?:youtube\\.com|youtu.be))(\\/(?:[\\w\\-]+\\?v=|embed\\/|v\\/)?)([\\w\\-]+)(\\S+)?$')¶
- YTDLP_SUPPORTED_URLS = [re.compile('https?://(?:www\\.)?facebook\\.com/.*/videos/\\d+'), re.compile('https?://(?:www\\.)?facebook\\.com/watch/\\?v=\\d+'), re.compile('https?://fb\\.watch/[a-zA-Z0-9_-]+'), re.compile('https?://(?:www\\.)?facebook\\.com/share/v/[a-zA-Z0-9]+'), re.compile('https?://(?:www\\.)?facebook\\.com/reel/\\d+'), re.compile('https?://(?:www\\.)?facebook\\.com/(?:watch|video).*[?&]v=\\d+'), re.compile('https?://(?:www\\.)?instagram\\.com/(?:p|reel|tv)/[a-zA-Z0-9_-]+')]¶