Ejemplo n.º 1
0
        public Stream GetMediaItem(string clientDescription, WebMediaType type, int?provider, string itemId, long?startPosition)
        {
            if (!IsClientAuthorized())
            {
                Log.Warn("Host {0} isn't authorized to call GetMediaItem", WCFUtil.GetClientIPAddress());
                WCFUtil.SetResponseCode(HttpStatusCode.Unauthorized);
                return(Stream.Null);
            }

            try
            {
                return(_downloads.Download(clientDescription, type, provider, itemId, startPosition));
            }
            catch (Exception ex)
            {
                WCFUtil.SetResponseCode(System.Net.HttpStatusCode.NotFound);
                Log.Info(String.Format("GetMediaItem() failed for type={0}; provider={1}; itemId={2}", type, provider, itemId), ex);
                return(Stream.Null);
            }
        }