Пример #1
0
        private async void HandleStationSongMetadata(SongMetadata songMetadata, StationStream currentStream, StationItem currentStation)
        {
            if (CurrentProgram != null)
            {
                if (CurrentProgram.Style == StationProgramStyle.Hosted)
                {
                    CurrentProgram = null; //hosted program ended.
                }
            }

            //filter out station messages
            if (!string.IsNullOrWhiteSpace(currentStream.ParentStation))
            {
                if (currentStation.StationMessages != null)
                {
                    if (currentStation.StationMessages.Contains(songMetadata.Track) ||
                        currentStation.StationMessages.Contains(songMetadata.Artist))
                    {
                        NepAppStationMessageReceived?.Invoke(this, new NepAppStationMessageReceivedEventArgs(songMetadata));
                        metadataLock.Release();
                        return;
                    }
                }
            }

            if (CurrentSong != null)
            {
                if (CurrentSong.ToString().Equals(songMetadata.ToString()))
                {
                    return;
                }
            }

            CurrentSong = songMetadata;
            //this is used for the now playing bar via data binding.
            RaisePropertyChanged(nameof(CurrentSong));

            PreSongChanged?.Invoke(this, new NepAppSongChangedEventArgs(songMetadata));

            await HandleStationSongMetadataStage2Async(songMetadata);
        }