Skip to content

Commit 8648eb5

Browse files
committed
add song_tags, fixs param not matching dsong_delete, lost_password
1 parent 51d0730 commit 8648eb5

1 file changed

Lines changed: 27 additions & 5 deletions

File tree

src/ampache.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ def get_id_list(self, data, attribute: str):
253253
return a list of id's from the data you've got from the api
254254
255255
INPUTS
256-
* data = (mixed) XML or JSON from the API
257-
* attribute = (string) attribute you are searching for
256+
* data = (mixed) XML or JSON from the API
257+
* attribute = (string) attribute you are searching for
258258
"""
259259
id_list = list()
260260
if not data:
@@ -645,7 +645,7 @@ def lost_password(self, auth):
645645
'auth': auth}
646646
data = urllib.parse.urlencode(data)
647647
full_url = ampache_url + '?' + data
648-
ampache_response = self.fetch_url(full_url, self.AMPACHE_API, 'goodbye')
648+
ampache_response = self.fetch_url(full_url, self.AMPACHE_API, 'lost_password')
649649
if isinstance(ampache_response, bool):
650650
return False
651651
return self.return_data(ampache_response)
@@ -673,7 +673,7 @@ def url_to_song(self, url):
673673
This takes a url and returns the song object in question
674674
675675
INPUTS
676-
* url = (string) Full Ampache URL from server, translates back into a song XML
676+
* url = (string) Full Ampache URL from server, translates back into a song XML
677677
"""
678678
ampache_url = self.AMPACHE_URL + '/server/' + self.AMPACHE_API + '.server.php'
679679
data = {'action': 'url_to_song',
@@ -1435,7 +1435,28 @@ def song_delete(self, filter_id: int):
14351435
'filter': filter_id}
14361436
data = urllib.parse.urlencode(data)
14371437
full_url = ampache_url + '?' + data
1438-
ampache_response = self.fetch_url(full_url, self.AMPACHE_API, 'song')
1438+
ampache_response = self.fetch_url(full_url, self.AMPACHE_API, 'song_delete')
1439+
if isinstance(ampache_response, bool):
1440+
return False
1441+
return self.return_data(ampache_response)
1442+
1443+
def song_tags(self, filter_id: int):
1444+
""" song_tags
1445+
MINIMUM_API_VERSION=7.5.0
1446+
1447+
Get the full song file tags using VaInfo
1448+
This is used to get tags for remote catalogs to allow maximum data to be returned
1449+
1450+
INPUTS
1451+
* filter_id = (string) UID of song to fetch
1452+
"""
1453+
ampache_url = self.AMPACHE_URL + '/server/' + self.AMPACHE_API + '.server.php'
1454+
data = {'action': 'song_tags',
1455+
'auth': self.AMPACHE_SESSION,
1456+
'filter': filter_id}
1457+
data = urllib.parse.urlencode(data)
1458+
full_url = ampache_url + '?' + data
1459+
ampache_response = self.fetch_url(full_url, self.AMPACHE_API, 'song_tags')
14391460
if isinstance(ampache_response, bool):
14401461
return False
14411462
return self.return_data(ampache_response)
@@ -5350,3 +5371,4 @@ def execute(self, method: str, params=None):
53505371
params["cond"] = False
53515372
return self.videos(params["filter_str"], params["exact"], params["offset"], params["limit"],
53525373
params["sort"], params["cond"])
5374+
return None

0 commit comments

Comments
 (0)