mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-27 00:51:28 +00:00
Compare commits
No commits in common. "81f818bc2f4574f75a7f8767304c51ea83a40d31" and "bdebbcf2b3d35c4f4c2d424f1e89c0f1ae0a3aed" have entirely different histories.
81f818bc2f
...
bdebbcf2b3
|
@ -111,13 +111,12 @@ def get_audio_file(track_uuid, listen_url=False, download=False,
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def get_tracks(page=None, ordering=None, q=None, page_size=None,
|
def get_tracks(page=None, ordering=None, q=None,
|
||||||
artist=None, album=None, library=None,
|
artist=None, album=None, library=None,
|
||||||
tag=None, favourites=None, include_channels=None, pg=None):
|
tag=None, favourites=None, include_channels=None, pg=None):
|
||||||
'''This function get tracks by params'''
|
'''This function get tracks by params'''
|
||||||
params = {
|
params = {
|
||||||
'page': page,
|
'page': page,
|
||||||
'page_size': page_size,
|
|
||||||
'ordering': ordering,
|
'ordering': ordering,
|
||||||
'q': q,
|
'q': q,
|
||||||
'artist': artist,
|
'artist': artist,
|
||||||
|
@ -170,7 +169,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, tag=None,
|
def get_artists(page=None, q=None, artist=None, album=None,
|
||||||
library=None, scope=None, favourites=None, refresh=False, pg=None):
|
library=None, scope=None, favourites=None, refresh=False, pg=None):
|
||||||
'''This function get artists by params'''
|
'''This function get artists by params'''
|
||||||
params = {
|
params = {
|
||||||
|
@ -178,7 +177,6 @@ def get_artists(page=None, q=None, artist=None, album=None, tag=None,
|
||||||
'q': q,
|
'q': q,
|
||||||
'artist': artist,
|
'artist': artist,
|
||||||
'album': album,
|
'album': album,
|
||||||
'tag': tag,
|
|
||||||
'library': library,
|
'library': library,
|
||||||
'scope': scope,
|
'scope': scope,
|
||||||
'favourites': favourites,
|
'favourites': favourites,
|
||||||
|
@ -274,10 +272,9 @@ def list_libraries(page=None, page_size=None, q=None, scope='all', pg=None):
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def get_tags(q=None, ordering='-creation_date', pg=None):
|
def get_tags(q=None, pg=None):
|
||||||
params = {
|
params = {
|
||||||
'q': q,
|
'q': q,
|
||||||
'ordering': ordering
|
|
||||||
}
|
}
|
||||||
if pg:
|
if pg:
|
||||||
r = current_instance.s.get(pg)
|
r = current_instance.s.get(pg)
|
||||||
|
|
|
@ -2,7 +2,6 @@ from src.fw_api import get_artists, get_tracks, get_audio_file
|
||||||
from src.fw_api_hints import hint_scope
|
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.fw_tags import list_tags
|
|
||||||
from src.mpv_control import player, player_menu, track_url_to_uuid
|
from src.mpv_control import player, player_menu, track_url_to_uuid
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
@ -11,12 +10,12 @@ fzf = FzfPrompt()
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def list_artists(pg=None, search=None, library=None, scope=None, tag=None):
|
def list_artists(pg=None, search=None, library=None, scope=None):
|
||||||
artists = get_artists(q=search, library=library, pg=pg, scope=scope, tag=tag)
|
artists = get_artists(q=search, library=library, pg=pg, scope=scope)
|
||||||
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', 'Tag', 'Library', 'Limit by scope']
|
view = ['Search', 'Library', 'Limit by scope']
|
||||||
if artists_next:
|
if artists_next:
|
||||||
view.append('Next page')
|
view.append('Next page')
|
||||||
if artists_prev:
|
if artists_prev:
|
||||||
|
@ -40,8 +39,6 @@ def list_artists(pg=None, search=None, library=None, scope=None, tag=None):
|
||||||
elif select == 'Search':
|
elif select == 'Search':
|
||||||
print('Search by artist:')
|
print('Search by artist:')
|
||||||
list_artists(search=input())
|
list_artists(search=input())
|
||||||
elif select == 'Tag':
|
|
||||||
list_artists(tag=list_tags())
|
|
||||||
elif select == 'Library':
|
elif select == 'Library':
|
||||||
select_lib = libraries()
|
select_lib = libraries()
|
||||||
list_artists(library=select_lib)
|
list_artists(library=select_lib)
|
||||||
|
|
|
@ -25,9 +25,8 @@ def libraries(pg=None, radio=False):
|
||||||
index = libs.index(lib_i)
|
index = libs.index(lib_i)
|
||||||
lib_name = lib_i.get('name')
|
lib_name = lib_i.get('name')
|
||||||
lib_tracks_count = lib_i.get('uploads_count')
|
lib_tracks_count = lib_i.get('uploads_count')
|
||||||
lib_access = lib_i.get('privacy_level')
|
|
||||||
lib_by = lib_i.get('actor').get('full_username')
|
lib_by = lib_i.get('actor').get('full_username')
|
||||||
libraries_listing.append(f'{index}.{lib_name} | {lib_by} | {lib_tracks_count} | {lib_access}')
|
libraries_listing.append(f'{index}.{lib_name} | {lib_by} | {lib_tracks_count}')
|
||||||
lib_select = fzf.prompt(
|
lib_select = fzf.prompt(
|
||||||
libraries_listing,
|
libraries_listing,
|
||||||
f'--header=\'found {libs_count} libraries\nmap: library name | owner | tracks count\'')
|
f'--header=\'found {libs_count} libraries\nmap: library name | owner | tracks count\'')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from src.fw_api import get_tags, get_tracks
|
from src.fw_api import get_tags
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ fzf = FzfPrompt()
|
||||||
|
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def list_tags(pg=None, search=None, error_given=''):
|
def list_tags(pg=None, search=None):
|
||||||
tags = get_tags(q=search, pg=pg)
|
tags = get_tags(q=search, pg=pg)
|
||||||
tags_next = tags.get('next')
|
tags_next = tags.get('next')
|
||||||
tags_prev = tags.get('previous')
|
tags_prev = tags.get('previous')
|
||||||
|
@ -21,7 +21,7 @@ def list_tags(pg=None, search=None, error_given=''):
|
||||||
index = tags_results.index(i)
|
index = tags_results.index(i)
|
||||||
tag_name = i.get('name')
|
tag_name = i.get('name')
|
||||||
view.append(f'{index}.{tag_name}')
|
view.append(f'{index}.{tag_name}')
|
||||||
select = fzf.prompt(view, f"--header=\'{error_given}\'")[0].split('.', 1)[0]
|
select = fzf.prompt(view)[0].split('.', 1)[0]
|
||||||
if select == 'Next page':
|
if select == 'Next page':
|
||||||
return list_tags(pg=tags_next)
|
return list_tags(pg=tags_next)
|
||||||
elif select == 'Prev page':
|
elif select == 'Prev page':
|
||||||
|
@ -30,7 +30,4 @@ def list_tags(pg=None, search=None, error_given=''):
|
||||||
print('Search by tag:')
|
print('Search by tag:')
|
||||||
return list_tags(search=input())
|
return list_tags(search=input())
|
||||||
else:
|
else:
|
||||||
selected_tag = tags_results[int(select)].get('name')
|
return tags_results[int(select)].get('name')
|
||||||
if get_tracks(tag=selected_tag, page_size=1)['count'] == 0:
|
|
||||||
return list_tags(pg=pg, search=search, error_given='This tag no contain tracks, select another')
|
|
||||||
return selected_tag
|
|
||||||
|
|
Loading…
Reference in a new issue