コード例 #1
0
        public static ArtistArt FromUrl(DBArtistInfo mv, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (!ignoreRestrictions)
            {
                minSize        = new ImageSize();
                minSize.Width  = MusicVideosCore.Settings.MinimumArtistWidth;
                minSize.Height = MusicVideosCore.Settings.MinimumArtistHeight;
            }

            maxSize.Width  = MusicVideosCore.Settings.MaximumArtistWidth;
            maxSize.Height = MusicVideosCore.Settings.MaximumArtistHeight;

            bool redownload = MusicVideosCore.Settings.RedownloadArtistArtwork;

            ArtistArt newArtistart = new ArtistArt();

            newArtistart.Filename = GenerateFilename(mv, url);
            status = newArtistart.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status)
            {
            case ImageLoadResults.SUCCESS:
                logger.Info("Added artist art for \"{0}\" from: {1}", mv.Artist, url);
                break;

            case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                logger.Debug("Added resized artist art for \"{0}\" from: {1}", mv.Artist, url);
                break;

            case ImageLoadResults.FAILED_ALREADY_LOADED:
                logger.Debug("Artist art for \"{0}\" from the following URL is already loaded: {1}", mv.Artist, url);
                return(null);

            case ImageLoadResults.FAILED_TOO_SMALL:
                logger.Error("Downloaded artist art for \"{0}\" failed minimum resolution requirements: {1}", mv.Artist, url);
                return(null);

            case ImageLoadResults.FAILED:
                logger.Error("Failed downloading artist art for \"{0}\": {1}", mv.Artist, url);
                return(null);
            }

            return(newArtistart);
        }
コード例 #2
0
ファイル: ArtistArt.cs プロジェクト: andrewjswan/mvcentral
        public static ArtistArt FromUrl(DBArtistInfo mv, string url, bool ignoreRestrictions, out ImageLoadResults status)
        {
            ImageSize minSize = null;
            ImageSize maxSize = new ImageSize();

            if (!ignoreRestrictions) {
                minSize = new ImageSize();
                minSize.Width = MusicVideosCore.Settings.MinimumArtistWidth;
                minSize.Height = MusicVideosCore.Settings.MinimumArtistHeight;
            }

            maxSize.Width = MusicVideosCore.Settings.MaximumArtistWidth;
            maxSize.Height = MusicVideosCore.Settings.MaximumArtistHeight;

            bool redownload = MusicVideosCore.Settings.RedownloadArtistArtwork;

            ArtistArt newArtistart = new ArtistArt();
            newArtistart.Filename = GenerateFilename(mv, url);
            status = newArtistart.FromUrl(url, ignoreRestrictions, minSize, maxSize, redownload);

            switch (status) {
                case ImageLoadResults.SUCCESS:
                    logger.Info("Added artist art for \"{0}\" from: {1}", mv.Artist, url);
                    break;
                case ImageLoadResults.SUCCESS_REDUCED_SIZE:
                    logger.Debug("Added resized artist art for \"{0}\" from: {1}", mv.Artist, url);
                    break;
                case ImageLoadResults.FAILED_ALREADY_LOADED:
                    logger.Debug("Artist art for \"{0}\" from the following URL is already loaded: {1}", mv.Artist, url);
                    return null;
                case ImageLoadResults.FAILED_TOO_SMALL:
                    logger.Error("Downloaded artist art for \"{0}\" failed minimum resolution requirements: {1}", mv.Artist, url);
                    return null;
                case ImageLoadResults.FAILED:
                    logger.Error("Failed downloading artist art for \"{0}\": {1}", mv.Artist, url);
                    return null;
            }

            return newArtistart;
        }