Files
Vocard/voicelink/enums.py
Choco 8a663a939b Vocard v2.6.9 Update: A lot new features, bug fixes, and code clean-up (#34)
* Update docker-compose.yml

No dotenv file needed. All environment values are now defined in docker-compose

* Update RU.json

* Updated docker-compose

* Update README.md

* Resolved issue where playback didn’t start after user joined channel 247

* Added logging system

* Updated logging system

* Update player.py

* Added 24/7 required intent

* Update main.py

* Added logs folder

* Updated logging system

* Updated logging system

* Added some typehint

* Removed error_log

* Renamed a valuable

* Removed unnecessary value

* Fixed some bugs

* Added bot status settings

* Added autocomplete in playtop

* Added a new emoji in Loop button

* Optimized code

* Update requirements.txt

* Fixed autoplay with empty queue

This commit addresses the issue where autoplay was being activated even when the history queue had no tracks. The problem has been resolved to ensure smooth user experience

* Enhanced Loop Control Button Functionality

* Updated the loop button in controller

* Fixed activity update

Resolved the issue where activity updates were not reflected when the value remained the same.

* Added sync function in debug view

* Optimized code

* Added version in the debug

* Added nodes panel in debug view

* Merged .env into settings.json

* Rewritten ipc_client

* Separated the dashboard from the project

* Removed some necessary requirements

* Remove support for replit

* Update README.md

* Update settings Example.json

* Added get_recommendations into node class

* Saved log file when updating

* Rewritten some method in ipc_client

* Written swap and remove method in queue

* Added remove_track and swap_track method in player

* Update methods.py

* Added secure protocol in ipc client

* Fixed some bugs

* Added some method in ipc cilent

* Update methods.py

* Update methods.py

* Added playlist method

* Optimized Spotify client code

* Added Category class in Spotify client

* Added settings method in ipc client

* Fixed some bugs

* Send track requester_id in initPlayer

* Fixed some bugs

* Fixed some bugs

* Optimized some code

* Dump discord.py

* Added start and end position for each track

* Update methods.py

* Fixed a bug

* Fixed some bugs

* Fixed IPC client creation issue

* Rewrote filters

* Fixed some bugs

* Added filter event in ipc method

* Added filter selector in music controller

* Added inbox method

* Optimized some code

* Updated zh-TW local_lang

* Fixed some bugs

* Delete supervisord.conf

* Fixed some bugs

* Updated wording in IPC client

* Update pool.py

* Fixed no song suggestions when spotify_client is None

* Fixed connection problem from the dashboard

* Fixed some bugs

* Added voice status (#33)

* Updated the placeholder name for clarity

* Added voice status

* Dump bot version

* Added global template for voice status

* Added new placeholder

* Updated settings view

* Updated version tag

* Improved codes

* Fixed some bugs

* Supported clear queue endpoint in ipc

* Update methods.py

* Update README.md

* Remove PLACEHOLDERS.MD

---------

Co-authored-by: Azarath7 <158289825+Azarath7@users.noreply.github.com>
2024-09-11 11:51:51 +08:00

94 lines
3.1 KiB
Python

"""MIT License
Copyright (c) 2023 - present Vocard Development
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from enum import Enum, auto
class LoopType(Enum):
"""The enum for the different loop types for Voicelink
LoopType.off: 1
LoopType.track: 2
LoopType.queue: 3
"""
off = auto()
track = auto()
queue = auto()
class SearchType(Enum):
"""The enum for the different search types for Voicelink.
This feature is exclusively for the Spotify search feature of Voicelink.
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.
"""
ytsearch = "ytsearch"
ytmsearch = "ytmsearch"
scsearch = "scsearch"
amsearch = "amsearch"
def __str__(self) -> str:
return self.value
class RequestMethod(Enum):
"""The enum for the different request methods in Voicelink
"""
get = "get"
patch = "patch"
delete = "delete"
post = "post"
def __str__(self) -> str:
return self.value
class NodeAlgorithm(Enum):
"""The enum for the different node algorithms in Voicelink.
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_region returns a node based on its voice region,
which the region is specified by the user in the method as an arg.
This method will only work if you set a voice region when you create a node.
"""
# We don't have to define anything special for these, since these just serve as flags
by_ping = auto()
by_region = auto()
by_players = auto()
def __str__(self) -> str:
return self.value