public static bool TryGetLastPlayedMusicTrack(ProtoPlaylist playlist, out MusicTrack lastMusicTrack) { if (!LastStopTime.TryGetValue(playlist, out var result)) { lastMusicTrack = null; return(false); } LastStopTime.Remove(playlist); if (Api.Client.Core.ClientRealTime - result.ClientTimeLastPlayback > MaxDurationToRememberTrackPosition) { // it stopped too long ago, forget about this lastMusicTrack = null; return(false); } lastMusicTrack = result.LastMusicTrack; return(true); }
public static void RememberLastTrack(ProtoPlaylist playlist, MusicTrack lastMusicTrack) { LastStopTime[playlist] = new PlaylistStopTime(lastMusicTrack, Api.Client.Core.ClientRealTime); }