|
2 | 2 |
|
3 | 3 |
|
4 | 4 | """ |
5 | | -Copyright (C)2023 Ampache.org |
| 5 | +Copyright (C)2024 Ampache.org |
6 | 6 | -------------------------------------------- |
7 | 7 | Ampache XML and JSON Api library for python3 |
8 | 8 | -------------------------------------------- |
@@ -3998,3 +3998,27 @@ def user_update(self, username, password=False, fullname=False, email=False, |
3998 | 3998 | website, state, city, disable, maxbitrate, |
3999 | 3999 | fullname_public, reset_apikey, reset_streamtoken, clear_stats) |
4000 | 4000 |
|
| 4001 | + def execute(self, method: str, params=None): |
| 4002 | + if params is None: |
| 4003 | + params = {} |
| 4004 | + match method: |
| 4005 | + case 'handshake': |
| 4006 | + if not "version" in params: |
| 4007 | + params["version"] = '6.6.0' |
| 4008 | + if not "ampache_url" in params: |
| 4009 | + params["ampache_url"] = self.AMPACHE_URL |
| 4010 | + if not "ampache_api" in params: |
| 4011 | + params["ampache_api"] = self.AMPACHE_KEY |
| 4012 | + if not "ampache_user" in params: |
| 4013 | + params["ampache_user"] = self.AMPACHE_USER |
| 4014 | + if not "timestamp" in params or params["timestamp"] == 0: |
| 4015 | + return self.handshake(params["ampache_url"], self.encrypt_string(params["ampache_api"], params["ampache_user"]), False, |
| 4016 | + False, params["version"]) |
| 4017 | + return self.handshake(params["ampache_url"], self.encrypt_password(params["ampache_api"], int(params["timestamp"])), params["ampache_user"], |
| 4018 | + int(params["timestamp"]), params["version"]) |
| 4019 | + case 'ping': |
| 4020 | + if not "ampache_url" in params: |
| 4021 | + params["ampache_url"] = self.AMPACHE_URL |
| 4022 | + if not "ampache_api" in params: |
| 4023 | + params["ampache_api"] = self.AMPACHE_KEY |
| 4024 | + return self.ping(params["ampache_url"], params["ampache_api"]) |
0 commit comments