documentation
This commit is contained in:
parent
1ea964b341
commit
f7f553396a
@ -105,7 +105,7 @@ namespace Selector.CLI
|
||||
break;
|
||||
case WatcherType.Playlist:
|
||||
throw new NotImplementedException("Playlist watchers not implemented");
|
||||
break;
|
||||
// break;
|
||||
}
|
||||
|
||||
List<IConsumer> consumers = new();
|
||||
|
@ -6,6 +6,9 @@ namespace Selector
|
||||
public class ListeningChangeEventArgs: EventArgs {
|
||||
public CurrentlyPlayingContext Previous { get; set; }
|
||||
public CurrentlyPlayingContext Current { get; set; }
|
||||
/// <summary>
|
||||
/// Spotify Username
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
PlayerTimeline Timeline { get; set; }
|
||||
|
||||
|
@ -5,6 +5,9 @@ namespace Selector
|
||||
{
|
||||
public interface IPlayerWatcher: IWatcher
|
||||
{
|
||||
/// <summary>
|
||||
/// Track or episode changes
|
||||
/// </summary>
|
||||
public event EventHandler<ListeningChangeEventArgs> ItemChange;
|
||||
public event EventHandler<ListeningChangeEventArgs> AlbumChange;
|
||||
public event EventHandler<ListeningChangeEventArgs> ArtistChange;
|
||||
@ -15,6 +18,9 @@ namespace Selector
|
||||
public event EventHandler<ListeningChangeEventArgs> DeviceChange;
|
||||
public event EventHandler<ListeningChangeEventArgs> PlayingChange;
|
||||
|
||||
/// <summary>
|
||||
/// Last retrieved currently playing
|
||||
/// </summary>
|
||||
public CurrentlyPlayingContext Live { get; }
|
||||
public PlayerTimeline Past { get; }
|
||||
}
|
||||
|
@ -5,9 +5,23 @@ namespace Selector
|
||||
{
|
||||
public interface IWatcher
|
||||
{
|
||||
/// <summary>
|
||||
/// Make single poll action on remote resource
|
||||
/// </summary>
|
||||
/// <param name="cancelToken">Token for early cancell</param>
|
||||
/// <returns>awaitable task</returns>
|
||||
public Task WatchOne(CancellationToken cancelToken);
|
||||
/// <summary>
|
||||
/// Begin periodically polling with interval of PollPeriod
|
||||
/// </summary>
|
||||
/// <param name="cancelToken"></param>
|
||||
/// <returns></returns>
|
||||
public Task Watch(CancellationToken cancelToken);
|
||||
|
||||
/// <summary>
|
||||
/// Time interval in ms between polls from Watch()
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public int PollPeriod { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,25 @@ namespace Selector
|
||||
public interface IWatcherCollection
|
||||
{
|
||||
public bool IsRunning { get; }
|
||||
/// <summary>
|
||||
/// Add watcher to collection, will start watcher if collection is running
|
||||
/// </summary>
|
||||
/// <param name="watcher">New watcher</param>
|
||||
public void Add(IWatcher watcher);
|
||||
/// <summary>
|
||||
/// Add watcher with given consumers to collection, will start watcher if collection is running
|
||||
/// </summary>
|
||||
/// <param name="watcher">New watcher</param>
|
||||
/// <param name="consumers">Consumers to subscribe to new watcher</param>
|
||||
public void Add(IWatcher watcher, List<IConsumer> consumers);
|
||||
|
||||
/// <summary>
|
||||
/// Start watcher collection
|
||||
/// </summary>
|
||||
public void Start();
|
||||
/// <summary>
|
||||
/// Stop watcher collection
|
||||
/// </summary>
|
||||
public void Stop();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ namespace Selector
|
||||
public IWatcher Watcher { get; set; }
|
||||
private List<IConsumer> Consumers { get; set; } = new();
|
||||
public bool IsRunning { get; private set; }
|
||||
/// <summary>
|
||||
/// Reference to Watcher.Watch() task when running
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Task Task { get; set; }
|
||||
public CancellationTokenSource TokenSource { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user