Example #1
0
        /// <summary>
        /// A media player that takes control of a NotifyIcon icon,
        /// tooltip and balloon to display status.
        /// </summary>
        /// <param name="icon">
        /// The notify icon to use to display status.
        /// </param>
        public Player(NotifyIcon icon)
        {
            notifyIcon = icon;

            player = new MediaPlayer();
            player.BufferingStarted += OnBufferingStarted;
            player.BufferingEnded += OnBufferingEnded;
            player.MediaEnded += OnMediaEnded;
            player.MediaFailed += OnMediaFailed;

            idleIcon = Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Idle.ico");
            playingIcon = Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Playing.ico");
            playingMutedIcon = Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Playing-muted.ico");

            bufferingIcons = new Icon[] {
                Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Buffering1.ico"),
                Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Buffering2.ico"),
                Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Buffering3.ico"),
                Util.ResourceAsIcon("GaGa.NotifyIconPlayer.Resources.Buffering4.ico"),
            };

            bufferingIconTimer = new DispatcherTimer(DispatcherPriority.Background);
            bufferingIconTimer.Interval = TimeSpan.FromMilliseconds(300);
            bufferingIconTimer.Tick += OnBufferingIconTimerTick;
            currentBufferingIcon = 0;

            source = null;
            isIdle = true;

            UpdateIcon();
        }
Example #2
0
        ///
        /// Events: menu
        ///

        /// <summary>
        /// Stream clicked, play it.
        /// </summary>
        private void OnStreamItemClick(Object sender, EventArgs e)
        {
            ToolStripMenuItem item   = (ToolStripMenuItem)sender;
            PlayerStream      stream = new PlayerStream(item.Text, (Uri)item.Tag);

            player.Play(stream);
        }
Example #3
0
 /// <summary>
 /// Stores program settings.
 /// </summary>
 public GaGaSettings()
 {
     LastBalanceTrackBarValue           = 0;
     LastVolumeTrackBarValue            = 10;
     LastPlayerStream                   = null;
     OptionsEnableAutoPlayChecked       = false;
     OptionsEnableMultimediaKeysChecked = true;
 }
Example #4
0
        static void Main(string[] args)
        {
            string[] lines = File.ReadAllLines(TEAM_CODE_FILE);

            foreach (string line in lines)
            {
                string[] parts = line.Split('\t');
                string   code  = parts[0];
                string   name  = parts[1];
                TeamMapping[name] = code;
                TeamMapping[code] = name;
            }

            string mode = args[0];

            // set paths
            if (args.Length > 3)
            {
                CACHE_PATH  = args[3];
                OUTPUT_PATH = args[4];
            }

            if (mode == "crawl")
            {
                int startYear = int.Parse(args[1]);
                int endYear   = int.Parse(args[2]);// set paths

                ErrorLog = new StreamWriter(Path.Combine(OUTPUT_PATH, "Error.log"));

                /*
                 * for (int year = endYear; year >= startYear; year--)
                 * {
                 *  foreach (string team in teams)
                 *  {
                 *      CrawlTeam(team, year);
                 *  }
                 * }
                 */

                // seed the crawl with the first month of the seasons
                Dictionary <string, bool> dates   = new Dictionary <string, bool>();
                HashSet <string>          visited = new HashSet <string>();
                string[] months = new string[] { "11", "12", "01", "02", "03", "04" };

                for (int year = endYear; year >= startYear; year--)
                {
                    foreach (string month in months)
                    {
                        string yearStr = (month.StartsWith("0") ? (year + 1).ToString() : year.ToString());
                        string start   = yearStr + "-" + month + "-01";

                        CrawlDate(start, visited);
                    }
                }

                // close open streams if we have them
                if (GameStream != null)
                {
                    GameStream.Close();
                }
                if (PlayerStream != null)
                {
                    PlayerStream.Close();
                }
                ErrorLog.Close();
            }

            if (mode == "game")
            {
                CrawlGame(args[1]);
            }
        }
Example #5
0
 /// <summary>
 /// Stop playing and set a given stream as current.
 /// Unmutes the player.
 /// </summary>
 /// <param name="stream">Source stream to set as current.</param>
 public void Select(PlayerStream stream)
 {
     Stop();
     source = stream;
     UpdateIcon();
 }
Example #6
0
 /// <summary>
 /// Set a given stream as current and play it.
 /// Unmutes the player.
 /// </summary>
 /// <param name="stream">Source stream to play.</param>
 public void Play(PlayerStream stream)
 {
     source = stream;
     Play();
 }