コード例 #1
0
        public static IEnumerable <string> ParseName(this DoubanMovie json)
        {
            if (!String.IsNullOrWhiteSpace(json.Title))
            {
                yield return(json.Title);
            }

            if (!String.IsNullOrWhiteSpace(json.OriginalTitle))
            {
                yield return(json.OriginalTitle);
            }

            if (json.OtherNames != null)
            {
                foreach (var originName in json.OtherNames.Where(z => !String.IsNullOrWhiteSpace(z)))
                {
                    if (originName.EndsWith("(港)") || originName.EndsWith("(台)"))
                    {
                        yield return(originName.Substring(0, originName.Length - 3));
                    }
                    else
                    {
                        yield return(originName);
                    }
                }
            }
        }
コード例 #2
0
        public static string GetRawImageUrl(DoubanMovie json)
        {
            var large = GetLargeImageUrl(json);
            // large like 'http://img4.douban.com/view/movie_poster_cover/ipst/public/p2236401229.jpg'

            var server = large[10].ToString();
            var item = large.Substring(large.LastIndexOf('/'));
            return String.Format(@"http://img{0}.douban.com/view/photo/raw/public{1}", server, item);
        }
コード例 #3
0
        public static string GetRawImageUrl(DoubanMovie json)
        {
            var large = GetLargeImageUrl(json);
            // large like 'http://img4.douban.com/view/movie_poster_cover/ipst/public/p2236401229.jpg'

            var server = large[10].ToString();
            var item   = large.Substring(large.LastIndexOf('/'));

            return(String.Format(@"http://img{0}.douban.com/view/photo/raw/public{1}", server, item));
        }
コード例 #4
0
        private void Load(DoubanMovie json)
        {
            this.LoadName(json);

            this.IsMovie = json.SubType == "movie";

            // EpisodesCount
            if (json.EpisodesCount.IsNullOrWhiteSpace())
            {
                if (this.IsMovie) this.EpisodesCount = "1";
            }
            else
            {
                this.EpisodesCount = json.EpisodesCount;
            }
        }
コード例 #5
0
        private void Load(DoubanMovie json)
        {
            this.LoadName(json);

            this.IsMovie = json.SubType == "movie";

            // EpisodesCount
            if (json.EpisodesCount.IsNullOrWhiteSpace())
            {
                if (this.IsMovie)
                {
                    this.EpisodesCount = "1";
                }
            }
            else
            {
                this.EpisodesCount = json.EpisodesCount;
            }
        }
コード例 #6
0
        private void LoadName(DoubanMovie json)
        {
            foreach (var name in json.ParseName())
            {
                if (this.ParseSeriesName(name)) continue;

                var spliter = name.Split(new string[] { ":", ":" }, 2, StringSplitOptions.RemoveEmptyEntries);
                if (spliter.Length > 0)
                {
                    if (!this.ParseSeriesName(spliter[0]))
                    {
                        this.seriesNames.Add(spliter[0]);
                    }
                    if (spliter.Length > 1)
                    {
                        this.entityNames.Add(spliter[1]);
                    }
                }
            }
        }
コード例 #7
0
        private void LoadName(DoubanMovie json)
        {
            foreach (var name in json.ParseName())
            {
                if (this.ParseSeriesName(name))
                {
                    continue;
                }

                var spliter = name.Split(new string[] { ":", ":" }, 2, StringSplitOptions.RemoveEmptyEntries);
                if (spliter.Length > 0)
                {
                    if (!this.ParseSeriesName(spliter[0]))
                    {
                        this.seriesNames.Add(spliter[0]);
                    }
                    if (spliter.Length > 1)
                    {
                        this.entityNames.Add(spliter[1]);
                    }
                }
            }
        }
コード例 #8
0
 private DoubanMovieParser(DoubanMovie json)
 {
     this.Load(json);
 }
コード例 #9
0
 public static DoubanMovieParser Parse(DoubanMovie json)
     => new DoubanMovieParser(json);
コード例 #10
0
 public static string GetLargeImageUrl(DoubanMovie json)
 {
     return json.ThrowIfNull("json").Images.Large.ThrowIfNullOrEmpty("Large");
 }
コード例 #11
0
 public static string GetLargeImageUrl(DoubanMovie json)
 {
     return(json.ThrowIfNull("json").Images.Large.ThrowIfNullOrEmpty("Large"));
 }
コード例 #12
0
 private DoubanMovieParser(DoubanMovie json)
 {
     this.Load(json);
 }
コード例 #13
0
 public static DoubanMovieParser Parse(DoubanMovie json)
 => new DoubanMovieParser(json);