class TrackNotify(object): def __init__(self): self.dbus_notify = DbusNotify("deepin-music-player", "deepin-music-player") @threaded def on_new_song(self, player, song): icon = CoverManager.get_path_from_song(song) self.dbus_notify.set_icon_from_path(icon) self.dbus_notify.set_summary(song.get_str("title")) body = "" if song.get_str("artist"): body = "%s: %s\n" % (_("Artist"), song.get_str("artist")) if song.get_str("album"): body += "%s: %s\n" % (_("Album"), song.get_str("album")) self.dbus_notify.set_body(body) self.dbus_notify.notify()
def __init__(self): self.dbus_notify = DbusNotify("deepin-music-player", "deepin-music-player")