Example #1
0
        private bool DownloadChannelLogos(ChannelLogos logos, IServiceSet serviceSet)
        {
            try
            {
                foreach (WebChannelBasic ch in channelLogosRequired)
                {
                    try
                    {
                        Stream logoStream = serviceSet.MASStream.GetImage(WebMediaType.TV, null, ch.Id.ToString());
                        Log.Trace("Downloaded logo for channel {0} (length {1})", ch.Title, logoStream.Length);
                        if (logoStream.Length > 0)
                        {
                            logos.WriteToCacheDirectory(ch.Title, "png", logoStream);
                        }
                    }
                    catch (EndpointNotFoundException)
                    {
                        Log.Trace("Logo for channel {0} not available on server", ch.Title);
                    }
                }

                return(true);
            }
            catch (MessageSecurityException)
            {
                return(false);
            }
        }
Example #2
0
        private bool DownloadChannelLogos(ChannelLogos logos, IServiceSet serviceSet)
        {
            try
            {
                foreach (WebChannelBasic ch in channelLogosRequired)
                {
                    try
                    {
                        Stream logoStream = serviceSet.MASStream.GetImage(WebMediaType.TV, null, ch.Id.ToString());
                        logos.WriteToCacheDirectory(ch.Title, "png", logoStream);
                        Log.Debug("Downloaded logo for channel {0}", ch.Title);
                    }
                    catch (EndpointNotFoundException)
                    {
                        Log.Trace("Logo for channel {0} not available on server", ch.Title);
                    }
                }

                return(true);
            }
            catch (MessageSecurityException)
            {
                return(false);
            }
            catch (Exception ex)
            {
                Log.Warn(String.Format("Failed to download channel logos from {0}", serviceSet), ex);
                return(false);
            }
        }