public MusicContentNode(BluChannel channel, MusicContentNode parent, BrowseContentResponse response) { _channel = channel ?? throw new ArgumentNullException(nameof(channel)); Parent = parent; if (response == null) { throw new ArgumentNullException(nameof(response)); } _searchKey = response.SearchKey; ServiceName = response.ServiceName; Entries = response.Items != null?response.Items.Select(element => new MusicContentEntry(channel, this, element)).ToArray() : new MusicContentEntry[0]; }
public MusicBrowser(BluChannel channel, BrowseContentResponse response) : base(channel, null, response) { }
private BluPlayer(BluChannel channel, SyncStatusResponse synStatus, StatusResponse status, BrowseContentResponse content) { _channel = channel ?? throw new ArgumentNullException(nameof(channel)); Endpoint = _channel.Endpoint; Name = synStatus.Name; Brand = synStatus.Brand; PresetList = new PlayerPresetList(_channel, status); PlayQueue = new PlayQueue(_channel, status); MusicBrowser = new MusicBrowser(_channel, content); VolumeChanges = _channel.VolumeChanges .SkipWhile(response => response.Decibel == status.Decibel) .DistinctUntilChanged(response => response.Decibel) .Select(response => response.Volume); StateChanges = _channel.StatusChanges .SkipWhile(response => response.State == status.State) .DistinctUntilChanged(response => response.State) .Select(response => BluParser.ParseState(response.State)); ShuffleModeChanges = _channel.StatusChanges .SkipWhile(response => response.Shuffle == status.Shuffle) .DistinctUntilChanged(response => response.Shuffle) .Select(response => (ShuffleMode)response.Shuffle); RepeatModeChanges = _channel.StatusChanges .SkipWhile(response => response.Repeat == status.Repeat) .DistinctUntilChanged(response => response.Repeat) .Select(response => (RepeatMode)response.Repeat); MediaChanges = _channel.StatusChanges .SkipWhile(response => response.Title1 == status.Title1 && response.Title2 == status.Title2 && response.Title3 == status.Title3) .DistinctUntilChanged(response => $"{response.Title1}{response.Title2}{response.Title3}") .Select(response => new PlayerMedia(response, Endpoint)); PositionChanges = _channel.StatusChanges .SkipWhile(response => response.Seconds == status.Seconds && response.TotalLength == status.TotalLength) .DistinctUntilChanged(response => $"{response.Seconds}{response.TotalLength}") .Select(response => new PlayPosition(response)); }