/// <summary> /// Called when a playlist is removed /// </summary> void playlist_Renamed(SpotiFire.Playlist sender, PlaylistEventArgs e) { var toucheePlaylist = GetToucheePlaylist(sender); if (toucheePlaylist != null) { toucheePlaylist.Update(sender); } }
/// <summary> /// Called when an update action of a introduced playlist is started or has ended. /// If the playlist is in the playlist container and the update is completed, /// the playlist will be stored / updated. /// </summary> void playlist_UpdateInProgress(SpotiFire.Playlist sender, PlaylistEventArgs e) { lock (sender) { //LogPlaylist(sender, "update in progress", e); sender.SetUpdateInProgress(!e.UpdateComplete); if (this.IsInSession(sender) && e.UpdateComplete) { CreateOrUpdate(sender); } } }
/// <summary> /// Called when the state of a playlist changes. /// If the playlist is in the playlist container and fully loaded, it introduces the /// playlist if that has not happened before. /// If no pending changes are present and no update is in progress, the playlist /// will be stored / updated. /// </summary> void playlist_StateChanged(SpotiFire.Playlist sender, PlaylistEventArgs e) { lock (sender) { //LogPlaylist(sender, "state changed"); if (this.IsInSession(sender) && sender.IsFullyLoaded()) { if (!sender.IsKnown()) { Introduce(sender); } if (!sender.HasPendingChanges && !sender.IsUpdateInProgress()) { CreateOrUpdate(sender); } } } }
void LogPlaylist(SpotiFire.Playlist playlist, string ev, PlaylistEventArgs e = null) { lock (this) { Console.WriteLine(ev.ToUpper()); Console.WriteLine(" Playlist: " + (playlist.IsLoaded ? playlist.Name : "<unknown>")); Console.WriteLine(" - Loaded: " + playlist.IsLoaded.ToString()); Console.WriteLine(" - Known: " + playlist.IsKnown().ToString()); if (playlist.IsLoaded) { Console.WriteLine(" - IsCollaborative: " + playlist.IsCollaborative.ToString()); Console.WriteLine(" - HasPendingChanges: " + playlist.HasPendingChanges.ToString()); Console.WriteLine(" - IsUpdateInProgress: " + playlist.IsUpdateInProgress().ToString()); Console.WriteLine(" - AllTracksLoaded: " + playlist.AllTracksLoaded().ToString()); } if (e != null) { Console.WriteLine(" - Update completed: " + e.UpdateComplete.ToString()); } } }
void LogPlaylistSimple(SpotiFire.Playlist playlist, string ev, PlaylistEventArgs e = null) { lock (this) { Console.WriteLine("= " + ev.ToUpper() + " - " + (playlist.IsLoaded ? playlist.Name : "<unknown>")); } }
/// <summary> /// Called when the image of a playlist is changed /// </summary> void playlist_ImageChanged(SpotiFire.Playlist sender, PlaylistEventArgs e) { throw new NotImplementedException(); }
/// <summary> /// Called when the metadata of one or more tracks of a playlist is changed. /// </summary> void playlist_MetadataUpdated(SpotiFire.Playlist sender, PlaylistEventArgs e) { //LogPlaylist(sender, "metadata updated"); }
/// <summary> /// Called when a playlist is removed /// </summary> void playlist_Renamed(SpotiFire.Playlist sender, PlaylistEventArgs e) { var toucheePlaylist = GetToucheePlaylist(sender); if (toucheePlaylist != null) toucheePlaylist.Update(sender); }
/// <summary> /// Called when an update action of a introduced playlist is started or has ended. /// If the playlist is in the playlist container and the update is completed, /// the playlist will be stored / updated. /// </summary> void playlist_UpdateInProgress(SpotiFire.Playlist sender, PlaylistEventArgs e) { lock (sender) { //LogPlaylist(sender, "update in progress", e); sender.SetUpdateInProgress(!e.UpdateComplete); if (this.IsInSession(sender) && e.UpdateComplete) CreateOrUpdate(sender); } }
/// <summary> /// Called when the state of a playlist changes. /// If the playlist is in the playlist container and fully loaded, it introduces the /// playlist if that has not happened before. /// If no pending changes are present and no update is in progress, the playlist /// will be stored / updated. /// </summary> void playlist_StateChanged(SpotiFire.Playlist sender, PlaylistEventArgs e) { lock (sender) { //LogPlaylist(sender, "state changed"); if (this.IsInSession(sender) && sender.IsFullyLoaded()) { if (!sender.IsKnown()) Introduce(sender); if (!sender.HasPendingChanges && !sender.IsUpdateInProgress()) CreateOrUpdate(sender); } } }