mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 01:39:20 +02:00
Compare commits
No commits in common. "eaf293e519a8f2534094f5a8820d5e326ac8e1c6" and "1d6e63e9e9c05c1b9405a683e9e951b3b53865ad" have entirely different histories.
eaf293e519
...
1d6e63e9e9
|
@ -1,10 +1,9 @@
|
|||
from src.fw_api import get_tracks
|
||||
from src.fw_api import get_tracks, get_audio_file
|
||||
from src.fw_tags import list_tags
|
||||
from src.fw_libraries import libraries
|
||||
from src.mpv_control import play_track
|
||||
from src.mpv_control import player, player_menu, track_url_to_uuid, play_track
|
||||
from pyfzf.pyfzf import FzfPrompt
|
||||
from loguru import logger
|
||||
import time
|
||||
|
||||
fzf = FzfPrompt()
|
||||
|
||||
|
@ -12,13 +11,11 @@ fzf = FzfPrompt()
|
|||
@logger.catch
|
||||
def list_tracks(pg=None, search=None, tag=None, library=None):
|
||||
tracks = get_tracks(q=search, pg=pg, tag=tag, library=library)
|
||||
tracks_count = tracks.get('count')
|
||||
tracks_next = tracks.get('next')
|
||||
tracks_prev = tracks.get('previous')
|
||||
tracks_results = tracks.get('results')
|
||||
view = ['Search', 'Tags', 'Library', 'Play this page']
|
||||
if tracks_next:
|
||||
view.append('Play all pages')
|
||||
view.append('Next page')
|
||||
if tracks_prev:
|
||||
view.append('Prev page')
|
||||
|
@ -27,7 +24,7 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
|
|||
index = tracks_results.index(i)
|
||||
track_name = i.get('title')
|
||||
view.append(f'{index}.{track_name}')
|
||||
select = fzf.prompt(view, f'--header=\'Found {tracks_count} tracks\'')
|
||||
select = fzf.prompt(view)
|
||||
if select == []:
|
||||
return
|
||||
else:
|
||||
|
@ -48,19 +45,5 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
|
|||
elif select == 'Play this page':
|
||||
for i in tracks_results:
|
||||
play_track(track=i, multi=True)
|
||||
elif select == 'Play all pages':
|
||||
if tracks_count > 1000:
|
||||
yn = input('WARNING: you really want add more than 1000 tracks? (y/[n])\n').lower()
|
||||
if yn in ('', 'n'):
|
||||
return
|
||||
count_loaded = 0
|
||||
while tracks_count > count_loaded:
|
||||
for i in tracks_results:
|
||||
play_track(track=i, multi=True)
|
||||
count_loaded += 1
|
||||
time.sleep(0.2)
|
||||
tracks = get_tracks(pg=tracks_next)
|
||||
tracks_next = tracks.get('next')
|
||||
tracks_results = tracks.get('results')
|
||||
else:
|
||||
play_track(track=tracks_results[int(select)])
|
||||
|
|
Loading…
Reference in New Issue