27 lines
767 B
Python
27 lines
767 B
Python
import requests
|
|
|
|
host = 'http://192.168.124.12:4533'
|
|
|
|
def getPlaylist(token):
|
|
headers = {
|
|
'x-nd-authorization': f'Bearer {token}'
|
|
}
|
|
res = requests.get(f'{host}/api/playlist?_end=50&_order=ASC&_sort=id&_start=0', headers = headers)
|
|
resJson = res.json()
|
|
return resJson
|
|
|
|
def downloadPlayList(palyListId, token):
|
|
headers = {
|
|
'Accept': 'audio/x-mpegurl',
|
|
'x-nd-authorization': f'Bearer {token}'
|
|
}
|
|
res = requests.get(f'{host}/api/playlist/{palyListId}/tracks', headers = headers)
|
|
return res.content
|
|
|
|
def delPlaylist(playlistId, token):
|
|
headers = {
|
|
'x-nd-authorization': f'Bearer {token}'
|
|
}
|
|
res = requests.delete(f'{host}/api/playlist/{playlistId}', headers = headers)
|
|
resJson = res.json()
|
|
return resJson |