mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 03:59: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_tags import list_tags
|
||||||
from src.fw_libraries import libraries
|
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 pyfzf.pyfzf import FzfPrompt
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
import time
|
|
||||||
|
|
||||||
fzf = FzfPrompt()
|
fzf = FzfPrompt()
|
||||||
|
|
||||||
|
@ -12,13 +11,11 @@ fzf = FzfPrompt()
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def list_tracks(pg=None, search=None, tag=None, library=None):
|
def list_tracks(pg=None, search=None, tag=None, library=None):
|
||||||
tracks = get_tracks(q=search, pg=pg, tag=tag, library=library)
|
tracks = get_tracks(q=search, pg=pg, tag=tag, library=library)
|
||||||
tracks_count = tracks.get('count')
|
|
||||||
tracks_next = tracks.get('next')
|
tracks_next = tracks.get('next')
|
||||||
tracks_prev = tracks.get('previous')
|
tracks_prev = tracks.get('previous')
|
||||||
tracks_results = tracks.get('results')
|
tracks_results = tracks.get('results')
|
||||||
view = ['Search', 'Tags', 'Library', 'Play this page']
|
view = ['Search', 'Tags', 'Library', 'Play this page']
|
||||||
if tracks_next:
|
if tracks_next:
|
||||||
view.append('Play all pages')
|
|
||||||
view.append('Next page')
|
view.append('Next page')
|
||||||
if tracks_prev:
|
if tracks_prev:
|
||||||
view.append('Prev page')
|
view.append('Prev page')
|
||||||
|
@ -27,7 +24,7 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
|
||||||
index = tracks_results.index(i)
|
index = tracks_results.index(i)
|
||||||
track_name = i.get('title')
|
track_name = i.get('title')
|
||||||
view.append(f'{index}.{track_name}')
|
view.append(f'{index}.{track_name}')
|
||||||
select = fzf.prompt(view, f'--header=\'Found {tracks_count} tracks\'')
|
select = fzf.prompt(view)
|
||||||
if select == []:
|
if select == []:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -48,19 +45,5 @@ def list_tracks(pg=None, search=None, tag=None, library=None):
|
||||||
elif select == 'Play this page':
|
elif select == 'Play this page':
|
||||||
for i in tracks_results:
|
for i in tracks_results:
|
||||||
play_track(track=i, multi=True)
|
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:
|
else:
|
||||||
play_track(track=tracks_results[int(select)])
|
play_track(track=tracks_results[int(select)])
|
||||||
|
|
Loading…
Reference in New Issue