Esempio n. 1
0
        /**
         * Contains the logic for when to mute Spotify
         **/
        private void MainTimer_Tick(object sender, EventArgs e)
        {
            /*if ((pid == 0 && !SetProcessId()))
             * {
             *  try
             *  {
             *      Process.Start(Environment.GetEnvironmentVariable("APPDATA") + @"\Spotify\spotify.exe");
             *  }
             *   catch (Exception ignore) { };
             * }*/
            if (!UpdateTitle())
            {
                pid = 0;
            }
            if (!IsPlaying())
            {
                return;
            }
            string artist = GetArtist();

            if (lastChecked.Equals(artist))
            {
                return;
            }
            lastChecked = artist;
            if (autoAdd) // Auto add to block list
            {
                if (!IsInBlocklist(artist) && IsAd(artist))
                {
                    AddToBlockList(artist);
                    Notify("Automatically added " + artist + " to your blocklist.");
                }
            }
            if (IsInBlocklist(artist)) // Should mute
            {
                if (!muted)
                {
                    Mute(1); // Mute Spotify
                }
                ResumeTimer.Start();
                LogAction("/mute/" + artist);
            }
            else // Should unmute
            {
                if (muted)
                {
                    Mute(0); // Unmute Spotify
                }
                ResumeTimer.Stop();
                Notify(artist + " is not on your blocklist. Open EZBlocker to add it.");
            }
        }
Esempio n. 2
0
        /**
         * Contains the logic for when to mute Spotify
         **/
        private void MainTimer_Tick(object sender, EventArgs e)
        {
            if (!UpdateTitle())
            {
                pid = 0;
            }
            if (!IsPlaying())
            {
                return;
            }
            string artist = GetArtist();

            if (lastChecked.Equals(artist))
            {
                return;
            }
            lastChecked = artist;
            if (autoAdd) // Auto add to block list
            {
                if (!IsInBlocklist(artist) && IsAd(artist))
                {
                    AddToBlockList(artist);
                    Notify("Automatically added " + artist + " to your blocklist.");
                }
            }
            if (IsInBlocklist(artist)) // Should mute
            {
                if (!muted)
                {
                    Mute(1); // Mute Spotify
                }
                ResumeTimer.Start();
                LogAction("/mute/" + artist);
            }
            else // Should unmute
            {
                if (muted)
                {
                    Mute(0); // Unmute Spotify
                }
                ResumeTimer.Stop();
                Notify(artist + " is not on your blocklist. Open EZBlocker to add it.");
            }
        }
Esempio n. 3
0
    public void ResumeTimer()
    {
        ResumeTimer resumeTimer = Instantiate(resumeTimerPrefab) as ResumeTimer;

        resumeTimer.StartTimer();
    }