mirror of
https://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-22 10:19:20 +02:00
Parse uuid via regexp from url
This commit is contained in:
parent
10ccbecd9e
commit
10328263a0
|
@ -7,6 +7,7 @@ from shutil import get_terminal_size
|
|||
import mpv
|
||||
import time
|
||||
import sys
|
||||
import re
|
||||
|
||||
fzf = FzfPrompt()
|
||||
|
||||
|
@ -25,11 +26,15 @@ class player_fw_storage:
|
|||
@logger.catch
|
||||
def track_url_to_uuid(listen_url=None):
|
||||
'''Attempt get uuid from track listen url or current playing url'''
|
||||
hex = '[0-9a-fA-F]+'
|
||||
find_uuid = f'{hex}-{hex}-{hex}-{hex}-{hex}'
|
||||
|
||||
if listen_url:
|
||||
uuid = listen_url.split(r'/')[-2]
|
||||
uuid = re.findall(find_uuid, listen_url)
|
||||
else:
|
||||
uuid = player.stream_open_filename.split(r'/')[-2]
|
||||
return uuid
|
||||
uuid = re.findall(find_uuid, player.stream_open_filename)
|
||||
|
||||
return uuid[0]
|
||||
|
||||
|
||||
if track_activity_history:
|
||||
|
|
Loading…
Reference in New Issue