Exemple #1
0
        /// <summary>
        /// Send the now playing notification.
        /// </summary>
        /// <param name="track">
        /// A <see cref="NowplayingTrack"/>
        /// </param>
        public void ReportNowplaying(NowplayingTrack track)
        {
            RequestParameters p = new RequestParameters(parameters);

            p.Append(track.getParameters());
            p["method"]  = "track.updateNowPlaying";
            p["api_sig"] = Utilities.MD5(p.ToStringForSig(ApiSecret));

            Request request = new Request(new Uri(this.ApiURL), p);

            // A BadSessionException occurs when another client has made a handshake
            // with this user's credentials, should redo a handshake and pass this
            // exception quietly.
            try
            {
                request.executeThreaded();
            }
            catch (BadSessionException)
            {
                this.ReportNowplaying(track);
            }
        }