private static string GetCategoryThumbPath(string id, WebOnlineVideosMediaType mediaType)
        {
            string siteName;
            string categoryRecrusiveName;

            OnlineVideosIdGenerator.DecodeCategoryId(id, out siteName, out categoryRecrusiveName);

            Category category;

            if (mediaType == WebOnlineVideosMediaType.Category)
            {
                category = MP2Extended.OnlineVideosManager.GetSiteCategories(siteName).Single(x => x.RecursiveName() == categoryRecrusiveName);
            }
            else
            {
                category = MP2Extended.OnlineVideosManager.GetSubCategories(siteName, categoryRecrusiveName).Single(x => x.RecursiveName() == categoryRecrusiveName);
            }

            // Download the thumb in case it doesn't exist
            if (category.ThumbnailImage == null)
            {
                ImageDownloader.DownloadImages(new List <Category> {
                    category
                });
            }

            return(category.ThumbnailImage);
        }
        private static string GetGlobalSiteThumbPath(string id)
        {
            string siteName;

            OnlineVideosIdGenerator.DecodeSiteId(id, out siteName);
            GlobalSite site = MP2Extended.OnlineVideosManager.GetGlobalSites().Single(x => x.Site.Name == siteName);

            return(Path.Combine(OnlineVideoSettings.Instance.ThumbsDir, ICONS_DIR + @"/" + site.Site.Name + ".png"));
        }
        private static string GetSiteThumbPath(string id)
        {
            string siteName;

            OnlineVideosIdGenerator.DecodeSiteId(id, out siteName);

            SiteUtilBase site = MP2Extended.OnlineVideosManager.GetSites().Single(x => x.Settings.Name == siteName);

            // use Icon with the same name as the Site
            string image = Path.Combine(OnlineVideoSettings.Instance.ThumbsDir, ICONS_DIR + @"/" + site.Settings.Name + ".png");

            if (File.Exists(image))
            {
                return(image);
            }

            // if that does not exist, try icon with the same name as the Util
            image = Path.Combine(OnlineVideoSettings.Instance.ThumbsDir, ICONS_DIR + @"/" + site.Settings.UtilName + ".png");
            return(File.Exists(image) ? image : string.Empty);
        }
        private static string GetVideoThumbPath(string id)
        {
            string siteName;
            string categoryRecrusiveName;
            string videoUrl;

            OnlineVideosIdGenerator.DecodeVideoId(id, out siteName, out categoryRecrusiveName, out videoUrl);

            VideoInfo video = MP2Extended.OnlineVideosManager.GetCategoryVideos(siteName, categoryRecrusiveName).Single(x => x.VideoUrl == videoUrl);

            // Download the thumb in case it doesn't exist
            if (video.ThumbnailImage == null)
            {
                ImageDownloader.DownloadImages(new List <VideoInfo> {
                    video
                });
            }

            return(video.ThumbnailImage);
        }
        /// <summary>
        /// Returns the UserSettings for a Site by it's name. It only returns the settings, which are in the Namespace "System", are bool or enum.
        /// </summary>
        /// <param name="siteName"></param>
        /// <returns></returns>
        public List <WebOnlineVideosSiteSetting> GetSiteSettings(string siteName)
        {
            SiteUtilBase site = GetSites().Single(x => x.Settings.Name == siteName);
            List <WebOnlineVideosSiteSetting> output = new List <WebOnlineVideosSiteSetting>();

            foreach (var prop in site.GetUserConfigurationProperties())
            {
                // limit to what the UI can show
                if (prop.IsEnum || prop.IsBool || prop.Namespace == "System")
                {
                    output.Add(new WebOnlineVideosSiteSetting
                    {
                        SiteId         = OnlineVideosIdGenerator.BuildSiteId(siteName),
                        Name           = prop.DisplayName,
                        Description    = prop.Description,
                        Value          = site.GetConfigValueAsString(prop),
                        PossibleValues = prop.IsEnum ? prop.GetEnumValues() : new string[0],
                        IsBool         = prop.IsBool
                    });
                }
                //Logger.Info("SiteSetting: {0} - {1} isBool: {2} isEnum: {3} EnumValues: {4} Value: {5} NameSpace: {6}", site.Settings.Name, prop.DisplayName, prop.IsBool.ToString(), prop.IsEnum.ToString(), prop.IsEnum ? string.Join(", ", prop.GetEnumValues()) : "", site.GetConfigValueAsString(prop), prop.Namespace);
            }
            return(output);
        }