mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-24 21:29:20 +02:00
tracks deduplicator
This commit is contained in:
parent
a6bdeab60c
commit
a5c5984880
|
@ -1,10 +1,11 @@
|
||||||
import src.fw_api
|
import src.fw_api
|
||||||
from src.utils import download_track, print_there, track_info_output
|
from src.utils import download_track, print_there, track_info_output, indices
|
||||||
from src.settings import get_config
|
from src.settings import get_config
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from pyfzf.pyfzf import FzfPrompt
|
from pyfzf.pyfzf import FzfPrompt
|
||||||
from shutil import get_terminal_size
|
from shutil import get_terminal_size
|
||||||
from shlex import quote
|
from shlex import quote
|
||||||
|
from contextlib import suppress
|
||||||
import mpv
|
import mpv
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
@ -145,6 +146,12 @@ def soft_volume_reduce():
|
||||||
|
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def player_menu(header='', storage={}):
|
def player_menu(header='', storage={}):
|
||||||
|
for i in player.playlist_filenames:
|
||||||
|
count_same_tracks = indices(player.playlist_filenames, i)
|
||||||
|
while len(count_same_tracks) > 1:
|
||||||
|
with suppress(SystemError):
|
||||||
|
player.playlist_remove(count_same_tracks[-1])
|
||||||
|
count_same_tracks = indices(player.playlist_filenames, i)
|
||||||
player_fw_storage.storage.update(storage)
|
player_fw_storage.storage.update(storage)
|
||||||
player.volume = get_config("mpv_volume")
|
player.volume = get_config("mpv_volume")
|
||||||
global shuffle
|
global shuffle
|
||||||
|
|
|
@ -78,3 +78,8 @@ def track_info_output(track):
|
||||||
output.append('Failed get related')
|
output.append('Failed get related')
|
||||||
output = '\n'.join(output)
|
output = '\n'.join(output)
|
||||||
os.system(f'less <<EOF\n{output}\nEOF')
|
os.system(f'less <<EOF\n{output}\nEOF')
|
||||||
|
|
||||||
|
|
||||||
|
def indices(lst, item):
|
||||||
|
'''https://ao.phreedom.club/questions/5419204/index-of-duplicates-items-in-a-python-list'''
|
||||||
|
return [i for i, x in enumerate(lst) if x == item]
|
||||||
|
|
Loading…
Reference in New Issue