summaryrefslogtreecommitdiff
path: root/src/bot.py
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2022-06-15 12:05:51 -0500
committerHombreLaser <sebastian-440@live.com>2022-06-15 12:05:51 -0500
commite07e82b9dd93c97e53521f9fcdc967febf8d0eeb (patch)
treeadd66fb450082b2cdcf6811ea8711d3463ea8a7c /src/bot.py
parent71a2a3fd8b13f6c3e942df5e68bb56e5aad50c2f (diff)
Added bot's code
Diffstat (limited to 'src/bot.py')
-rw-r--r--src/bot.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/bot.py b/src/bot.py
new file mode 100644
index 0000000..9b10736
--- /dev/null
+++ b/src/bot.py
@@ -0,0 +1,62 @@
+from config import Config
+from ampache.client import AmpacheClient
+from collections import deque
+import pymumble_py3 as pymumble
+
+class Bot:
+ """
+ The bot class. It reads a config file (given in the constructor)
+ and with it populates its own and the ampache client's variables.
+ """
+ def __init__(self, config_file):
+ # The file may not exist. If it doesn't, the configparser will
+ # throw a key error exception. TODO: first open the file, if
+ # it doesn't exist it will throw a more ad hoc exception.
+ self._configuration = Config(config_file)
+ self._playlist = deque()
+ self._init_client()
+ self._init_bot()
+ self._init_misc()
+
+ def _init_misc(self):
+ miscellaneous = self._configuration.get_directories()
+ self._download_dir = miscellaneous[0]
+ self._automatically_delete = miscellaneous[1]
+
+ def _init_client(self):
+ client_info = self._configuration.get_ampache_config()
+ auth_info = self._configuration.get_auth()
+ self._client = AmpacheClient(client_info[0], auth_info,
+ client_info[1])
+
+ def _init_bot(self):
+ mumble_info = self._configuration.get_mumble_config()
+ host = mumble_info[0]
+ password = mumble_info[1]
+ certfile = mumble_info[2]
+ keyfile = mumble_info[3]
+ bot_nick = mumble_info[4]
+ self._bot = pymumble.Mumble(host, bot_nick, password=password, certfile=certfile,
+ keyfile=keyfile, reconnect=True, stereo=True)
+
+ def read_command(self):
+ pass
+
+ def parse_command(self):
+ pass
+
+ def add_to_playlist(self, ):
+ pass
+
+ def play_song(self, ):
+ pass
+
+ # API methods.
+ def query_song(self, song_id):
+ pass
+
+ def query_album(self, album_id):
+ pass
+
+ def download_song(self):
+ pass