Compare commits

..

No commits in common. "88d619f304122d2f256273bfbe284924aaf6a9e4" and "d39a86a2a9abd5f70f8119f23a705d6e14ecf581" have entirely different histories.

4 changed files with 20 additions and 29 deletions

View File

@ -159,7 +159,7 @@ def get_recently_listened(page=None, q=None, scope=None, include_channels=None,
@logger.catch
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'''
params = {
'page': page,
@ -167,7 +167,6 @@ def get_artists(page=None, q=None, artist=None, album=None,
'artist': artist,
'album': album,
'library': library,
'scope': scope,
'favourites': favourites,
'refresh': refresh
}

View File

@ -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
''')

View File

@ -1,5 +1,4 @@
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_libraries import libraries
from src.mpv_control import player, player_menu, track_url_to_uuid
@ -10,12 +9,12 @@ fzf = FzfPrompt()
@logger.catch
def list_artists(pg=None, search=None, library=None, scope=None):
artists = get_artists(q=search, library=library, pg=pg, scope=scope)
def list_artists(pg=None, search=None, library=None):
artists = get_artists(q=search, library=library, pg=pg)
artists_next = artists.get('next')
artists_prev = artists.get('previous')
artists_results = artists.get('results')
view = ['Search', 'Library', 'Limit by scope']
view = ['Search', 'Library']
if artists_next:
view.append('Next page')
if artists_prev:
@ -24,9 +23,8 @@ def list_artists(pg=None, search=None, library=None, scope=None):
for i in artists_results:
index = artists_results.index(i)
artist_name = i.get('name')
artist_tracks_count = i.get('tracks_count')
view.append(f'{index}.{artist_name} | {artist_tracks_count}')
select = fzf.prompt(view, '--header=\'map: artist | tracks count\'')[0].split('.', 1)[0]
view.append(f'{index}.{artist_name}')
select = fzf.prompt(view)[0].split('.', 1)[0]
if select == 'Next page':
list_artists(pg=artists_next)
elif select == 'Prev page':
@ -37,10 +35,6 @@ def list_artists(pg=None, search=None, library=None, scope=None):
elif select == 'Library':
select_lib = libraries()
list_artists(library=select_lib)
elif select == 'Limit by scope':
hint_scope()
scope = input()
list_artists(scope=scope)
else:
albums = artists_results[int(select)].get('albums')
if albums:

View File

@ -1,5 +1,4 @@
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 pyfzf.pyfzf import FzfPrompt
from loguru import logger
@ -10,10 +9,10 @@ fzf = FzfPrompt()
@logger.catch
def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False):
if is_history_view:
action = 'listened'
caption = 'listened:'
tracks = get_recently_listened(q=search, scope=scope, pg=pg)
else:
action = 'liked'
caption = 'liked:'
tracks = get_favorires_tracks(q=search, scope=scope, pg=pg)
tracks_next = tracks.get('next')
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)
track_name = i['track'].get('title')
who_user = i['user'].get('username')
view.append(f'{index}.{track_name} | {who_user}')
select = fzf.prompt(view, f'--multi --header=\'map: track title | who {action}\'')
view.append(f'{index}.{track_name} | {caption} {who_user}')
select = fzf.prompt(view, '--multi')
if 'Next page' in select:
list_fav_or_history(pg=tracks_next, is_history_view=is_history_view)
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:')
list_fav_or_history(search=input(), is_history_view=is_history_view)
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()
list_fav_or_history(scope=scope, search=search, is_history_view=is_history_view)
elif 'Play this page' in select: