mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 02:49:19 +02:00
Compare commits
No commits in common. "88d619f304122d2f256273bfbe284924aaf6a9e4" and "d39a86a2a9abd5f70f8119f23a705d6e14ecf581" have entirely different histories.
88d619f304
...
d39a86a2a9
|
@ -159,7 +159,7 @@ def get_recently_listened(page=None, q=None, scope=None, include_channels=None,
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def get_artists(page=None, q=None, artist=None, album=None,
|
def get_artists(page=None, q=None, artist=None, album=None,
|
||||||
library=None, scope=None, favourites=None, refresh=False, pg=None):
|
library=None, favourites=None, refresh=False, pg=None):
|
||||||
'''This function get artists by params'''
|
'''This function get artists by params'''
|
||||||
params = {
|
params = {
|
||||||
'page': page,
|
'page': page,
|
||||||
|
@ -167,7 +167,6 @@ def get_artists(page=None, q=None, artist=None, album=None,
|
||||||
'artist': artist,
|
'artist': artist,
|
||||||
'album': album,
|
'album': album,
|
||||||
'library': library,
|
'library': library,
|
||||||
'scope': scope,
|
|
||||||
'favourites': favourites,
|
'favourites': favourites,
|
||||||
'refresh': refresh
|
'refresh': refresh
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
def hint_scope():
|
|
||||||
print(
|
|
||||||
'''Limit the results to a given user or pod:
|
|
||||||
Use all (or do not specify the property to disable scope filtering)
|
|
||||||
Use me to retrieve content relative to the current user
|
|
||||||
Use subscribed to retrieve content in libraries you follow
|
|
||||||
Use actor:alice@example.com to retrieve content relative to the account `alice@example.com
|
|
||||||
Use domain:example.com to retrieve content relative to the domain `example.com
|
|
||||||
You can specify multiple coma separated scopes, e.g me,subscribed to retrieve content matching either scopes
|
|
||||||
''')
|
|
|
@ -1,5 +1,4 @@
|
||||||
from src.fw_api import get_artists, get_tracks, get_audio_file
|
from src.fw_api import get_artists, get_tracks, get_audio_file
|
||||||
from src.fw_api_hints import hint_scope
|
|
||||||
from src.fw_albums import list_albums
|
from src.fw_albums import list_albums
|
||||||
from src.fw_libraries import libraries
|
from src.fw_libraries import libraries
|
||||||
from src.mpv_control import player, player_menu, track_url_to_uuid
|
from src.mpv_control import player, player_menu, track_url_to_uuid
|
||||||
|
@ -10,12 +9,12 @@ fzf = FzfPrompt()
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def list_artists(pg=None, search=None, library=None, scope=None):
|
def list_artists(pg=None, search=None, library=None):
|
||||||
artists = get_artists(q=search, library=library, pg=pg, scope=scope)
|
artists = get_artists(q=search, library=library, pg=pg)
|
||||||
artists_next = artists.get('next')
|
artists_next = artists.get('next')
|
||||||
artists_prev = artists.get('previous')
|
artists_prev = artists.get('previous')
|
||||||
artists_results = artists.get('results')
|
artists_results = artists.get('results')
|
||||||
view = ['Search', 'Library', 'Limit by scope']
|
view = ['Search', 'Library']
|
||||||
if artists_next:
|
if artists_next:
|
||||||
view.append('Next page')
|
view.append('Next page')
|
||||||
if artists_prev:
|
if artists_prev:
|
||||||
|
@ -24,9 +23,8 @@ def list_artists(pg=None, search=None, library=None, scope=None):
|
||||||
for i in artists_results:
|
for i in artists_results:
|
||||||
index = artists_results.index(i)
|
index = artists_results.index(i)
|
||||||
artist_name = i.get('name')
|
artist_name = i.get('name')
|
||||||
artist_tracks_count = i.get('tracks_count')
|
view.append(f'{index}.{artist_name}')
|
||||||
view.append(f'{index}.{artist_name} | {artist_tracks_count}')
|
select = fzf.prompt(view)[0].split('.', 1)[0]
|
||||||
select = fzf.prompt(view, '--header=\'map: artist | tracks count\'')[0].split('.', 1)[0]
|
|
||||||
if select == 'Next page':
|
if select == 'Next page':
|
||||||
list_artists(pg=artists_next)
|
list_artists(pg=artists_next)
|
||||||
elif select == 'Prev page':
|
elif select == 'Prev page':
|
||||||
|
@ -37,10 +35,6 @@ def list_artists(pg=None, search=None, library=None, scope=None):
|
||||||
elif select == 'Library':
|
elif select == 'Library':
|
||||||
select_lib = libraries()
|
select_lib = libraries()
|
||||||
list_artists(library=select_lib)
|
list_artists(library=select_lib)
|
||||||
elif select == 'Limit by scope':
|
|
||||||
hint_scope()
|
|
||||||
scope = input()
|
|
||||||
list_artists(scope=scope)
|
|
||||||
else:
|
else:
|
||||||
albums = artists_results[int(select)].get('albums')
|
albums = artists_results[int(select)].get('albums')
|
||||||
if albums:
|
if albums:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from src.fw_api import get_favorires_tracks, get_recently_listened, get_audio_file
|
from src.fw_api import get_favorires_tracks, get_recently_listened, get_audio_file
|
||||||
from src.fw_api_hints import hint_scope
|
|
||||||
from src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage
|
from src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
@ -10,10 +9,10 @@ fzf = FzfPrompt()
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False):
|
def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False):
|
||||||
if is_history_view:
|
if is_history_view:
|
||||||
action = 'listened'
|
caption = 'listened:'
|
||||||
tracks = get_recently_listened(q=search, scope=scope, pg=pg)
|
tracks = get_recently_listened(q=search, scope=scope, pg=pg)
|
||||||
else:
|
else:
|
||||||
action = 'liked'
|
caption = 'liked:'
|
||||||
tracks = get_favorires_tracks(q=search, scope=scope, pg=pg)
|
tracks = get_favorires_tracks(q=search, scope=scope, pg=pg)
|
||||||
tracks_next = tracks.get('next')
|
tracks_next = tracks.get('next')
|
||||||
tracks_prev = tracks.get('previous')
|
tracks_prev = tracks.get('previous')
|
||||||
|
@ -28,8 +27,8 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
|
||||||
index = tracks_results.index(i)
|
index = tracks_results.index(i)
|
||||||
track_name = i['track'].get('title')
|
track_name = i['track'].get('title')
|
||||||
who_user = i['user'].get('username')
|
who_user = i['user'].get('username')
|
||||||
view.append(f'{index}.{track_name} | {who_user}')
|
view.append(f'{index}.{track_name} | {caption} {who_user}')
|
||||||
select = fzf.prompt(view, f'--multi --header=\'map: track title | who {action}\'')
|
select = fzf.prompt(view, '--multi')
|
||||||
if 'Next page' in select:
|
if 'Next page' in select:
|
||||||
list_fav_or_history(pg=tracks_next, is_history_view=is_history_view)
|
list_fav_or_history(pg=tracks_next, is_history_view=is_history_view)
|
||||||
elif 'Prev page' in select:
|
elif 'Prev page' in select:
|
||||||
|
@ -38,7 +37,16 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
|
||||||
print('Search by track:')
|
print('Search by track:')
|
||||||
list_fav_or_history(search=input(), is_history_view=is_history_view)
|
list_fav_or_history(search=input(), is_history_view=is_history_view)
|
||||||
elif 'Limit by scope' in select:
|
elif 'Limit by scope' in select:
|
||||||
hint_scope()
|
print('''
|
||||||
|
Limit the results to a given user or pod:
|
||||||
|
|
||||||
|
Use all (or do not specify the property to disable scope filtering)
|
||||||
|
Use me to retrieve content relative to the current user
|
||||||
|
Use subscribed to retrieve content in libraries you follow
|
||||||
|
Use actor:alice@example.com to retrieve content relative to the account `alice@example.com
|
||||||
|
Use domain:example.com to retrieve content relative to the domain `example.com
|
||||||
|
|
||||||
|
''')
|
||||||
scope = input()
|
scope = input()
|
||||||
list_fav_or_history(scope=scope, search=search, is_history_view=is_history_view)
|
list_fav_or_history(scope=scope, search=search, is_history_view=is_history_view)
|
||||||
elif 'Play this page' in select:
|
elif 'Play this page' in select:
|
||||||
|
|
Loading…
Reference in New Issue