mirror of
http://gitea.phreedom.club/localhost_frssoft/funkwlmpv
synced 2024-11-06 00:43:15 +00: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 mpv
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
fzf = FzfPrompt()
|
fzf = FzfPrompt()
|
||||||
|
|
||||||
|
@ -25,11 +26,15 @@ class player_fw_storage:
|
||||||
@logger.catch
|
@logger.catch
|
||||||
def track_url_to_uuid(listen_url=None):
|
def track_url_to_uuid(listen_url=None):
|
||||||
'''Attempt get uuid from track listen url or current playing url'''
|
'''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:
|
if listen_url:
|
||||||
uuid = listen_url.split(r'/')[-2]
|
uuid = re.findall(find_uuid, listen_url)
|
||||||
else:
|
else:
|
||||||
uuid = player.stream_open_filename.split(r'/')[-2]
|
uuid = re.findall(find_uuid, player.stream_open_filename)
|
||||||
return uuid
|
|
||||||
|
return uuid[0]
|
||||||
|
|
||||||
|
|
||||||
if track_activity_history:
|
if track_activity_history:
|
||||||
|
|
Loading…
Reference in a new issue