Example #1
0
        /*
         * Validates that the current song is not in the blockTable. If it is in the blockTable, the song is muted and startReplacementMusic() is called.
         */
        public void checkCurrentSong()
        {
            Song currSong = spotInfo.GetCurrentSong();

            if (currSong == null)
            {
                nowPlayingLabel.Text = "[PAUSED]";
                return;
            }
            nowPlayingLabel.Text = currSong.ArtistName + " - " + currSong.SongTitle;

            if (blockTable.contains(currSong))// || autoDetect)
            {
                //if (autoDetect) blockTable.addSong(currSong);
                trySkipSong();
            }
            else if (isAdvertisement(currSong))
            {
                addLog(currSong + " is an advertisement, going to mute.");
                blockTable.addSong(currSong);
                trySkipSong();
            }
            else if (!blockTable.contains(currSong))
            {
                if (isReplacementMusicPlaying())
                {
                    stopReplacementMusic();
                    if (savedVol > 0)
                    {
                        addLog("Resetting master volume to: " + savedVol);
                        AudioSessionControl spotifyASC = spotInfo.GetSpotifyAudioSession();
                        spotifyASC.SimpleAudioVolume.MasterVolume = savedVol;
                    }
                }
                addLog("Got new Spotify item: " + spotInfo.GetCurrentSong());
            }
        }