Esempio n. 1
0
        public void pollForSongChanges()
        {
            string oldSong = "";

            while (true)
            {
                try
                {
                    SongInfo si = JsonConvert.DeserializeObject <SongInfo>(channel.getSongName());

                    if (si.player == webPlayer)
                    {
                        if (oldSong != si.song)
                        {
                            writeToPath(this.path, si.song);
                            SetPreview(si.song);
                            oldSong = si.song;
                        }
                    }
                    else
                    {
                        if (isPluginOpen)
                        {
                            writeToPath(this.path, string.Format("{0} not open.", webPlayer));
                            SetPreview(string.Format("{0} not open.", webPlayer));
                            isPluginOpen = false;
                        }
                    }
                }
                catch (Exception e)
                {
                    writeToPath(this.path, string.Format("{0} not open.", webPlayer));
                    SetPreview(string.Format("{0} not open.", webPlayer));
                }

                Thread.Sleep(500);
            }
        }