コード例 #1
0
 public static void SetKnown(this SpotiFire.Playlist playlist, bool known)
 {
     if (known)
     {
         if (!playlist.IsKnown())
         {
             _playlistStatus[playlist] = new PlaylistHandlerStatus();
         }
     }
     else
     {
         _playlistStatus.Remove(playlist);
     }
 }
コード例 #2
0
 /// <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);
             }
         }
     }
 }
コード例 #3
0
 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());
         }
     }
 }
コード例 #4
0
 public static bool IsTrackingTracks(this SpotiFire.Playlist playlist)
 {
     return(playlist.IsKnown() && _playlistStatus[playlist].TrackingTracks);
 }
コード例 #5
0
 public static bool IsUpdateInProgress(this SpotiFire.Playlist playlist)
 {
     return(playlist.IsKnown() && _playlistStatus[playlist].UpdateInProgress);
 }