diff --git a/Selector.CLI/WatcherService.cs b/Selector.CLI/WatcherService.cs index 7474e97..8e15cdc 100644 --- a/Selector.CLI/WatcherService.cs +++ b/Selector.CLI/WatcherService.cs @@ -105,7 +105,7 @@ namespace Selector.CLI break; case WatcherType.Playlist: throw new NotImplementedException("Playlist watchers not implemented"); - break; + // break; } List consumers = new(); diff --git a/Selector/Watcher/Interfaces/Events.cs b/Selector/Watcher/Interfaces/Events.cs index 1326ad7..78544a3 100644 --- a/Selector/Watcher/Interfaces/Events.cs +++ b/Selector/Watcher/Interfaces/Events.cs @@ -6,6 +6,9 @@ namespace Selector public class ListeningChangeEventArgs: EventArgs { public CurrentlyPlayingContext Previous { get; set; } public CurrentlyPlayingContext Current { get; set; } + /// + /// Spotify Username + /// public string Username { get; set; } PlayerTimeline Timeline { get; set; } diff --git a/Selector/Watcher/Interfaces/IPlayerWatcher.cs b/Selector/Watcher/Interfaces/IPlayerWatcher.cs index 420c95f..7eecdc6 100644 --- a/Selector/Watcher/Interfaces/IPlayerWatcher.cs +++ b/Selector/Watcher/Interfaces/IPlayerWatcher.cs @@ -5,6 +5,9 @@ namespace Selector { public interface IPlayerWatcher: IWatcher { + /// + /// Track or episode changes + /// public event EventHandler ItemChange; public event EventHandler AlbumChange; public event EventHandler ArtistChange; @@ -15,6 +18,9 @@ namespace Selector public event EventHandler DeviceChange; public event EventHandler PlayingChange; + /// + /// Last retrieved currently playing + /// public CurrentlyPlayingContext Live { get; } public PlayerTimeline Past { get; } } diff --git a/Selector/Watcher/Interfaces/IWatcher.cs b/Selector/Watcher/Interfaces/IWatcher.cs index 3cf92a4..4f9da00 100644 --- a/Selector/Watcher/Interfaces/IWatcher.cs +++ b/Selector/Watcher/Interfaces/IWatcher.cs @@ -5,9 +5,23 @@ namespace Selector { public interface IWatcher { + /// + /// Make single poll action on remote resource + /// + /// Token for early cancell + /// awaitable task public Task WatchOne(CancellationToken cancelToken); + /// + /// Begin periodically polling with interval of PollPeriod + /// + /// + /// public Task Watch(CancellationToken cancelToken); + /// + /// Time interval in ms between polls from Watch() + /// + /// public int PollPeriod { get; set; } } } diff --git a/Selector/Watcher/WatcherCollection/IWatcherCollection.cs b/Selector/Watcher/WatcherCollection/IWatcherCollection.cs index 084a440..526dd8a 100644 --- a/Selector/Watcher/WatcherCollection/IWatcherCollection.cs +++ b/Selector/Watcher/WatcherCollection/IWatcherCollection.cs @@ -7,10 +7,25 @@ namespace Selector public interface IWatcherCollection { public bool IsRunning { get; } + /// + /// Add watcher to collection, will start watcher if collection is running + /// + /// New watcher public void Add(IWatcher watcher); + /// + /// Add watcher with given consumers to collection, will start watcher if collection is running + /// + /// New watcher + /// Consumers to subscribe to new watcher public void Add(IWatcher watcher, List consumers); + /// + /// Start watcher collection + /// public void Start(); + /// + /// Stop watcher collection + /// public void Stop(); } } diff --git a/Selector/Watcher/WatcherCollection/WatcherContext.cs b/Selector/Watcher/WatcherCollection/WatcherContext.cs index 878e6cd..b02220d 100644 --- a/Selector/Watcher/WatcherCollection/WatcherContext.cs +++ b/Selector/Watcher/WatcherCollection/WatcherContext.cs @@ -12,6 +12,10 @@ namespace Selector public IWatcher Watcher { get; set; } private List Consumers { get; set; } = new(); public bool IsRunning { get; private set; } + /// + /// Reference to Watcher.Watch() task when running + /// + /// public Task Task { get; set; } public CancellationTokenSource TokenSource { get; set; }