Example #1
0
 private void HandleClientConnect(IWebClient client)
 {
     Utils.Logger.Log("Web client connected.");
     lock (KnownDevices)
     {
         if (KnownDevices.Count != 0)
         {
             Clients.Add(client, new LinkedList<IDevice>(KnownDevices.Values).Last.Value);
             client.SendMessage(new Protocol.SelectDeviceNotification(new LinkedList<IDevice>(KnownDevices.Values).Last.Value));
         }
         else
             Clients.Add(client, null);
     }
     client.SendMessage(new Protocol.ProviderNotification(Providers));
     client.SendMessage(new Protocol.DeviceNotification(Controller));
     client.SendMessage(new Protocol.PlaylistNotification(Playlist.Active));
 }
Example #2
0
        void HandleOnSearchRequest(IWebClient client, SearchRequest request)
        {
            Utils.Logger.Log("Requested search for: '" + request.Query + "'.");

            try
            {
                var tracks = Providers.Plugins["Soundcloud"].Search(request.Query);

                var response = new SearchResponse(request.Query, tracks);
                client.SendMessage(response);

                Utils.Logger.Log("Sent response for search for: '" + response.Query + "'.");
            }
            catch (WebException ex)
            {
                if (ex.Status == WebExceptionStatus.Timeout)
                    Utils.Logger.Log("(504) Gateway Timeout to content provider!");
            }
        }