fix stuff lol
This commit is contained in:
parent
85e9caccb0
commit
7614c05b64
12
np.10s.py
12
np.10s.py
|
@ -2,6 +2,8 @@
|
|||
|
||||
from pydbus import SessionBus
|
||||
import sys
|
||||
import urllib.parse
|
||||
import os.path
|
||||
|
||||
bus = SessionBus()
|
||||
all_names = bus.get("org.freedesktop.DBus", "/org/freedesktop/DBus").ListNames()
|
||||
|
@ -17,6 +19,14 @@ for name in all_names:
|
|||
metadata = mpris.Get("org.mpris.MediaPlayer2.Player", "Metadata")
|
||||
if status == "Playing":
|
||||
title = metadata.get("xesam:title", None)
|
||||
if title is None:
|
||||
url = metadata.get("xesam:url", None)
|
||||
if url is None:
|
||||
continue
|
||||
url = urllib.parse.urlparse(url)
|
||||
path = url.path
|
||||
title = os.path.basename(path)
|
||||
title = os.path.splitext(title)[0]
|
||||
artist = metadata.get("xesam:artist", None)
|
||||
if artist is None:
|
||||
artist = metadata.get("xesam:albumArtist", None)
|
||||
|
@ -27,7 +37,7 @@ for name in all_names:
|
|||
artist = None
|
||||
if len(title.strip()) == 0:
|
||||
title = None
|
||||
if len(album.strip()) == 0:
|
||||
if album is not None and len(album.strip()) == 0:
|
||||
album = None
|
||||
|
||||
if artist is not None:
|
||||
|
|
Loading…
Reference in New Issue