mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 04:11:29 +00:00
remove code duplicate play_track
This commit is contained in:
parent
e7a57fc637
commit
230d92f399
|
@ -1,6 +1,6 @@
|
||||||
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.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, play_track
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
|
@ -54,14 +54,3 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
|
||||||
else:
|
else:
|
||||||
play_track(track=tracks_results[int(
|
play_track(track=tracks_results[int(
|
||||||
select[0].split('.', 1)[0])]['track'])
|
select[0].split('.', 1)[0])]['track'])
|
||||||
|
|
||||||
|
|
||||||
def play_track(track, multi=False):
|
|
||||||
listen_url = get_audio_file(track['listen_url'], True)
|
|
||||||
player_fw_storage.storage[track_url_to_uuid(listen_url)] = track
|
|
||||||
if multi:
|
|
||||||
player.loadfile(listen_url, 'append-play')
|
|
||||||
else:
|
|
||||||
player.loadfile(listen_url, 'append-play')
|
|
||||||
track_name = track.get('title')
|
|
||||||
player_menu(f"{track_name} playing...", player_fw_storage.storage)
|
|
||||||
|
|
Loading…
Reference in a new issue