def __init__(self, app_id: str, name: str, window: QTWSMainWindow, web: QTWSWebView): global qtws_app_id self.bus = dbus.SessionBus() self.service_name = "org.mpris.MediaPlayer2.qtws_" + name + str( random.randint(0, 9999)) bus_name = dbus.service.BusName(self.service_name, bus=self.bus) super().__init__(bus_name, "/org/mpris/MediaPlayer2") self.window = window self.web = web self.track_path = "/it/datasound/mpris/" + str(random.randint(0, 9999)) self.track = Object(bus_name, self.track_path) self.properties = dict() self.properties[self.MPRIS_INTERFACE] = dict() self.properties[self.MPRIS_INTERFACE]["CanQuit"] = True self.properties[self.MPRIS_INTERFACE]["CanRaise"] = False self.properties[self.MPRIS_INTERFACE]["HasTrackList"] = False self.properties[self.MPRIS_INTERFACE]["Identity"] = name self.properties[ self.MPRIS_INTERFACE]["DesktopEntry"] = "silos-" + app_id self.properties[ self.MPRIS_INTERFACE]["SupportedUriSchemes"] = dbus.Array( [], signature="s") self.properties[ self.MPRIS_INTERFACE]["SupportedMimeTypes"] = dbus.Array( [], signature="s") self.PropertiesChanged(self.MPRIS_INTERFACE, self.properties[self.MPRIS_INTERFACE], []) self.properties[self.MPRIS_PLAYER_INTERFACE] = dict() self.properties[ self.MPRIS_PLAYER_INTERFACE]["PlaybackStatus"] = "Stopped" self.properties[self.MPRIS_PLAYER_INTERFACE]["LoopStatus"] = "None" self.properties[self.MPRIS_PLAYER_INTERFACE]["Shuffle"] = False self.properties[self.MPRIS_PLAYER_INTERFACE]["Volume"] = 1.0 self.properties[self.MPRIS_PLAYER_INTERFACE]["Rate"] = 1.0 self.properties[self.MPRIS_PLAYER_INTERFACE]["MinimumRate"] = 0.01 self.properties[self.MPRIS_PLAYER_INTERFACE]["MaximumRate"] = 32.0 self.properties[self.MPRIS_PLAYER_INTERFACE]["Position"] = 0 self.properties[self.MPRIS_PLAYER_INTERFACE]["CanGoNext"] = False self.properties[self.MPRIS_PLAYER_INTERFACE]["CanGoPrevious"] = False self.properties[self.MPRIS_PLAYER_INTERFACE]["CanPlay"] = True self.properties[self.MPRIS_PLAYER_INTERFACE]["CanPause"] = True self.properties[self.MPRIS_PLAYER_INTERFACE]["CanSeek"] = True self.properties[self.MPRIS_PLAYER_INTERFACE]["CanControl"] = True self.PropertiesChanged(self.MPRIS_PLAYER_INTERFACE, self.properties[self.MPRIS_PLAYER_INTERFACE], [])