mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 21:49:19 +02:00
Listing user libraries for radio
This commit is contained in:
parent
474235d9e2
commit
5184f81277
|
@ -51,6 +51,17 @@ def list_tracks(page=None, q=None, artist=None, album=None, favourites=None):
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
|
|
||||||
|
def list_libraries(page=None, page_size=None, q=None, scope='all'):
|
||||||
|
params = {
|
||||||
|
'page': page,
|
||||||
|
'page_size': page_size,
|
||||||
|
'q': q,
|
||||||
|
'scope': scope,
|
||||||
|
}
|
||||||
|
r = requests.get(f'https://{instance}/api/v1/libraries', params)
|
||||||
|
return r.json()
|
||||||
|
|
||||||
|
|
||||||
# [FunkWhale radios]
|
# [FunkWhale radios]
|
||||||
def get_radios():
|
def get_radios():
|
||||||
r = s.get(f'https://{instance}/api/v1/radios/radios/')
|
r = s.get(f'https://{instance}/api/v1/radios/radios/')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from src.fw_api import s, get_radios, post_radio_session, get_track_radio, concatinate_endpoint
|
from src.fw_api import s, get_radios, post_radio_session, get_track_radio, list_libraries, concatinate_endpoint
|
||||||
from src.utils import download_track
|
from src.utils import download_track
|
||||||
from src.mpv_control import player
|
from src.mpv_control import player
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
|
@ -34,8 +34,17 @@ def list_radios():
|
||||||
elif 'Random' in selected:
|
elif 'Random' in selected:
|
||||||
radio_load(id_radio, 'random')
|
radio_load(id_radio, 'random')
|
||||||
elif 'Library' in selected:
|
elif 'Library' in selected:
|
||||||
print('Input library address (ex. example@example.example): ')
|
libs = list_libraries()['results']
|
||||||
lib_addr = input()
|
libraries_listing = []
|
||||||
|
for lib_i in libs:
|
||||||
|
lib_name = lib_i.get('actor').get('full_username')
|
||||||
|
if lib_name not in libraries_listing:
|
||||||
|
libraries_listing.append(lib_name)
|
||||||
|
libraries_listing.append('Custom')
|
||||||
|
lib_addr = fzf.prompt(libraries_listing)[0]
|
||||||
|
if lib_addr == 'Custom':
|
||||||
|
print('Input remote user library (ex. nick@funkwhale.domain.example: ')
|
||||||
|
lib_addr = input()
|
||||||
radio_load(None, 'actor-content', lib_addr, lib_addr)
|
radio_load(None, 'actor-content', lib_addr, lib_addr)
|
||||||
elif 'Recently Added' in selected:
|
elif 'Recently Added' in selected:
|
||||||
radio_load(id_radio, 'recently-added')
|
radio_load(id_radio, 'recently-added')
|
||||||
|
|
Loading…
Reference in New Issue