All the things
This commit is contained in:
@@ -7,6 +7,7 @@ from UserNotifications import (
|
||||
)
|
||||
from Foundation import NSURL
|
||||
from radiotrack import RadioTrack
|
||||
from top2000 import Top200Song
|
||||
|
||||
|
||||
class UserNotification:
|
||||
@@ -52,10 +53,9 @@ class SongNotification(UserNotification):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def notify_song(self, song: RadioTrack):
|
||||
def notify_song(self, song: RadioTrack, top2000: Top200Song = None):
|
||||
|
||||
url = NSURL.URLWithString_(f"file://{song.cover_path}")
|
||||
|
||||
err = None
|
||||
atachement = (
|
||||
UNNotificationAttachment.attachmentWithIdentifier_URL_options_error_(
|
||||
@@ -70,8 +70,13 @@ class SongNotification(UserNotification):
|
||||
print(err)
|
||||
atachement = None
|
||||
|
||||
if top2000:
|
||||
title = f"{top2000.position}: {song.title}"
|
||||
else:
|
||||
title = song.title
|
||||
|
||||
self.create_notification(
|
||||
song.title,
|
||||
title,
|
||||
song.artist,
|
||||
attachments=[atachement],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user