mirror of
https://tilde.club/~comet/git/musefetch.git
synced 2026-01-23 23:40:18 +00:00
Add Song Duration
This commit is contained in:
@@ -30,11 +30,15 @@ def main():
|
|||||||
cover = from_url(metadata.get("mpris:artUrl", ""))
|
cover = from_url(metadata.get("mpris:artUrl", ""))
|
||||||
cover.height = 15
|
cover.height = 15
|
||||||
|
|
||||||
|
duration = player.Get("org.mpris.MediaPlayer2.Player", "Position") / 1_000_000
|
||||||
|
length = metadata.get("mpris:length", 0) / 1_000_000
|
||||||
|
|
||||||
songdata = [
|
songdata = [
|
||||||
f"Title: {metadata.get('xesam:title', 'Unknown')}",
|
f"Title: {metadata.get('xesam:title', 'Unknown')}",
|
||||||
f"Artist(s): {', '.join(metadata.get('xesam:artist', ['Unknown']))}",
|
f"Artist(s): {', '.join(metadata.get('xesam:artist', ['Unknown']))}",
|
||||||
f"Album: {metadata.get('xesam:album', 'Unknown')}",
|
f"Album: {metadata.get('xesam:album', 'Unknown')}",
|
||||||
f"Playing: {playing}",
|
f"Playing: {playing}",
|
||||||
|
f"{int(duration // 60)}:{int(duration % 60):02d} / {int(length // 60)}:{int(length % 60):02d}",
|
||||||
]
|
]
|
||||||
|
|
||||||
img_lines = str(cover).splitlines()
|
img_lines = str(cover).splitlines()
|
||||||
|
|||||||
Reference in New Issue
Block a user