protected virtual void OnPlayerNotification(Plugin.NotificationType notification) => PlayerNotification?.Invoke(this, notification);
public void ReceiveNotification(string sourceFileUrl, Plugin.NotificationType type) { switch (type) { case Plugin.NotificationType.PluginStartup: { this.Load(this.mbApiInterface.Setting_GetPersistentStoragePath()); this.RestartServer(); string title = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.TrackTitle); string artist = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.Artist); string album = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.Album); string url = this.mbApiInterface.NowPlaying_GetFileUrl(); string playing = GetPlaybackStateString(this.mbApiInterface.Player_GetPlayState()); int duration = this.mbApiInterface.NowPlaying_GetDuration(); int position = this.mbApiInterface.Player_GetPosition(); float volume = this.mbApiInterface.Player_GetVolume(); bool shuffle = this.mbApiInterface.Player_GetShuffle(); string repeat = GetRepeatString(this.mbApiInterface.Player_GetRepeat()); bool scrobbling = this.mbApiInterface.Player_GetScrobbleEnabled(); this.server.UpdateTrack(title, artist, album, url, playing, duration, position, volume, shuffle, repeat, scrobbling); return; } case Plugin.NotificationType.TrackChanged: { string title = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.TrackTitle); string artist = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.Artist); string album = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.Album); string url = this.mbApiInterface.NowPlaying_GetFileUrl(); string playing = GetPlaybackStateString(this.mbApiInterface.Player_GetPlayState()); int duration = this.mbApiInterface.NowPlaying_GetDuration(); int position = this.mbApiInterface.Player_GetPosition(); float volume = this.mbApiInterface.Player_GetVolume(); bool shuffle = this.mbApiInterface.Player_GetShuffle(); string repeat = GetRepeatString(this.mbApiInterface.Player_GetRepeat()); bool scrobbling = this.mbApiInterface.Player_GetScrobbleEnabled(); this.server.UpdateTrack(title, artist, album, url, playing, duration, position, volume, shuffle, repeat, scrobbling); return; } case Plugin.NotificationType.PlayStateChanged: { string title = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.TrackTitle); string artist = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.Artist); string album = this.mbApiInterface.NowPlaying_GetFileTag(Plugin.MetaDataType.Album); string url = this.mbApiInterface.NowPlaying_GetFileUrl(); string playing = GetPlaybackStateString(this.mbApiInterface.Player_GetPlayState()); int duration = this.mbApiInterface.NowPlaying_GetDuration(); int position = this.mbApiInterface.Player_GetPosition(); float volume = this.mbApiInterface.Player_GetVolume(); bool shuffle = this.mbApiInterface.Player_GetShuffle(); string repeat = GetRepeatString(this.mbApiInterface.Player_GetRepeat()); bool scrobbling = this.mbApiInterface.Player_GetScrobbleEnabled(); this.server.UpdateTrack(title, artist, album, url, playing, duration, position, volume, shuffle, repeat, scrobbling); return; } default: return; } }