remove code duplicate play_track

This commit is contained in:
localhost_frssoft 2023-08-03 11:17:43 +03:00
parent e7a57fc637
commit 230d92f399

View file

@ -1,6 +1,6 @@
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 src.mpv_control import player, player_menu, track_url_to_uuid, player_fw_storage, play_track
from pyfzf.pyfzf import FzfPrompt
from loguru import logger
@ -54,14 +54,3 @@ def list_fav_or_history(pg=None, search=None, scope=None, is_history_view=False)
else:
play_track(track=tracks_results[int(
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)