Exemple #1
0
        public static void Initialize(int deviceNumber)
        {
            Player = new MusicPlayer.Player(deviceNumber);
            Player.SongInfoFormatString                    = Utilities.GetValue("Player.SongInfoFormatString", "{Artist} - {Title}");
            Player.SecondsBeforeUpdatePlayCount            = Utilities.GetValue("Player.SecondsBeforeUpdatePlayCount", 20);
            Player.IgnorePreviouslyPlayedSongsInRandomMode = Utilities.GetValue("Player.IgnorePreviouslyPlayedSongsInRandomMode", false);
            Player.NeverPlayIgnoredSongs                   = Utilities.GetValue("Player.NeverPlayIgnoredSongs", false);
            Player.AudioscrobblerEnabled                   = Utilities.GetValue("Player.AudioscrobblerEnabled", false);
            Player.AudioscrobblerUserName                  = Utilities.GetValue("Player.AudioscrobblerUserName", "");
            Player.AudioscrobblerPassword                  = Utilities.GetValue("Player.AudioscrobblerPassword", "");


            Player.RepeatCurrentTrack     = Convert.ToBoolean(Utilities.GetValue("Player.RepeatCurrentTrack", false));
            Player.Playlist.PlaylistStyle = (PlaylistStyle)Utilities.GetValue("Player.PlaylistStyle", 0);

            Library = new MusicLibrary.Library();
        }
Exemple #2
0
        public HttpServer(MusicPlayer.Player player, MusicLibrary.Library library)
        {
            _serverTemplate = Properties.Resources.HttpServerTemplate;

            _player  = player;
            _library = library;

            _helper = new LyricsHelper(library);
            _helper.LyricsNotFound += delegate { _lastLyrics = "Not found."; };
            _helper.LyricsFound    += new EventHandler <LyricsFoundEventArgs>(Helper_LyricsFound);

            // Create a new server socket, set up all the endpoints, bind the socket and then listen
            _listener = new Socket(0, SocketType.Stream, ProtocolType.Tcp);
            var endpoint = new IPEndPoint(IPAddress.Any, 8001);

            _listener.Bind(endpoint);
            _listener.Listen(-1);
            // start listening
            _listener.BeginAccept(AcceptFinished, null);
        }