Skip to content

Commit 1b54a94

Browse files
committed
add AMPACHE_VERSION to class
1 parent cea48e7 commit 1b54a94

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

src/ampache.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class API(object):
3737

3838
def __init__(self):
3939
self.AMPACHE_API = 'xml'
40+
self.AMPACHE_VERSION = '6.6.0'
4041
self.AMPACHE_SERVER = ''
4142
self.AMPACHE_DEBUG = False
4243
self.DOCS_PATH = 'docs/'
@@ -71,6 +72,23 @@ def set_format(self, myformat: str):
7172
print('AMPACHE_API set to ' + myformat)
7273
self.AMPACHE_API = myformat
7374

75+
def set_version(self, myversion: str):
76+
""" set_version
77+
78+
Allow forcing a default API version
79+
80+
api3 = '390001'
81+
api4 = '443000'
82+
api5 = '5.5.6'
83+
api6 = '6.6.0'
84+
85+
INPUTS
86+
* myversion = (string) '6.6.0'|'390001'
87+
"""
88+
if self.AMPACHE_DEBUG:
89+
print('AMPACHE_VERSION set to ' + myversion)
90+
self.AMPACHE_VERSION = myversion
91+
7492
def set_debug(self, mybool: bool):
7593
""" set_debug
7694
@@ -597,7 +615,7 @@ def lost_password(self):
597615
$username;
598616
$key = hash('sha256', 'email');
599617
auth = hash('sha256', $username . $key);
600-
)
618+
)
601619
"""
602620
ampache_url = self.AMPACHE_URL + '/server/' + self.AMPACHE_API + '.server.php'
603621
data = {'action': 'goodbye',
@@ -3713,11 +3731,14 @@ def bookmark_edit(self, filter_id, object_type,
37133731
'type': object_type,
37143732
'position': position,
37153733
'client': client,
3716-
'date': date}
3734+
'date': date,
3735+
'include': include}
37173736
if not client:
37183737
data.pop('client')
37193738
if not date:
37203739
data.pop('date')
3740+
if not include:
3741+
data.pop('include')
37213742
data = urllib.parse.urlencode(data)
37223743
full_url = ampache_url + '?' + data
37233744
ampache_response = self.fetch_url(full_url, self.AMPACHE_API, 'bookmark_edit')
@@ -4004,7 +4025,7 @@ def execute(self, method: str, params=None):
40044025
match method:
40054026
case 'handshake':
40064027
if not "version" in params:
4007-
params["version"] = '6.6.0'
4028+
params["version"] = self.AMPACHE_VERSION
40084029
if not "ampache_url" in params:
40094030
params["ampache_url"] = self.AMPACHE_URL
40104031
if not "ampache_api" in params:

0 commit comments

Comments
 (0)